Skip to content

refactor: distinct auth refusal names and mirrored clock names - #6510

Merged
kixelated merged 7 commits into
mainfrom
quest/m1/api-audit/auth-clock-names
Oct 24, 2026
Merged

kixelated merged 7 commits into
mainfrom
quest/m1/api-audit/auth-clock-names

Conversation

@kixelated

@kixelated kixelated commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m1/api-audit/auth-clock-names.md, following its 2026-10-22 decisions.

Changes

  • moq-auth: serve::Refusal (the reference server's policy enum) is now serve::Denial, so Refusal only names the shared 403 body, moq_auth::Refusal.
  • moq-net / moq-stats: stats::Refusal (the counter kind) is now stats::RefusalKind. moq-stats re-exports it under the new name. moq-relay's internal uses follow.
  • moq-net: dropped the time::now() re-export. time::Instant::now() is now the only way to read the clock, and every caller across the workspace switched to it.
  • moq-clock: anchor() is now origin(), matching @moq/clock. Rustdoc spells out the unit split: Rust returns a nanosecond Wall paired with an instant, because a runtime clock's instant zero is before 1970 (the clock leads by 2^32 s). JS returns the wall time of instant zero in milliseconds. The JS TSDoc points back to Rust.
  • @moq/clock: Manual.install() returns an Installed handle instead of a restore closure, mirroring Rust's Manual::install -> Installed. The handle has an idempotent close(), and every caller switched to it. Installed deliberately does not implement Disposable: @moq/auth type-checks @moq/clock against ES2022 libs, which have no Symbol.dispose. Tests that use using wrap the handle themselves.
  • Quests: moq-auth's public SystemTimes (Claims::{expires, issued, not_before} and Grant::expires) are added to quest/m1/time/wall.md, as the plan asked. The finished quest is deleted.

Dropped: lease::Reason and refusal::Reason keep their names (decision 1 below).

Public API and wire impact

Breaking renames, each with a MIGRATE.md entry under ## Unreleased:

  • moq-auth: serve::Refusal -> serve::Denial
  • moq-net: stats::Refusal -> stats::RefusalKind; time::now removed
  • moq-stats: Refusal -> RefusalKind
  • moq-clock: anchor() -> origin()
  • @moq/clock: Manual.install() returns Installed (new exported type)

Wire: none. JSON shapes, stats track names, and metric labels are unchanged. js/auth has no counterpart to the server policy enum, so the Cross-Package Sync rows (js/auth, doc/bin/relay/auth.md) need no edits.

Decisions

  1. The two Reason enums. The quest Goal says reason types should have distinct names, but the decision only renamed the two Refusals. Both Reasons live in public modules and are always written qualified (refusal::Reason, lease::Reason), which follows the "short names under a module namespace" rule.
    • (a) ✅ Keep both names. They are always written module-qualified, so no rename.
    • (b) Rename lease::Reason to lease::End. That touches about 50 sites, mostly in moq-relay's auth code, which conflicts with moq-dev/moq#6509.
  2. Method name on the JS Installed handle. Rust's Installed has no counterpart, because a Rust install lasts for the life of its runtime. [Symbol.dispose] is left out so @moq/clock keeps building against ES2022 libs.
    • (a) ✅ Keep close(), the JS convention for an idempotent terminal op.
    • (b) Use uninstall().

Checks

just check passes locally after merging main (Rust, JS, Python, Go, Kotlin, Dart, C++, OBS, docs, and lint), except the flake stage, which cannot build the github-runner VM check in a sandbox without user namespaces; CI covers it. The merges switched callers main added since (moq-net session setup in tests and benches, four JS install() callers) to Instant::now() and Installed.close(), and quest/m1/auth/token-in-band.md now names serve::Denial::TwoTokens (Codex finding). just test interop --all was not run, since nothing on the wire changed and moq-ffi only switched one internal time::now() call.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

kixelated and others added 3 commits October 22, 2026 23:13
Rename moq_auth::serve::Refusal to serve::Denial and
moq_net::stats::Refusal to stats::RefusalKind, so Refusal names only the
shared 403 body. Rename moq_clock::anchor() to origin() to match
@moq/clock, return an Installed handle from the JS Manual.install() like
Rust's, and drop moq_net::time::now() in favor of Instant::now().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EeyiEy5FWz3z44DYZVo7vU
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EeyiEy5FWz3z44DYZVo7vU
@kixelated
kixelated force-pushed the quest/m1/api-audit/auth-clock-names branch from c4358b0 to 8eb8789 Compare October 23, 2026 06:14
@kixelated kixelated changed the title Auth and clock names refactor: distinct auth refusal names and mirrored clock names Oct 23, 2026
@kixelated

Copy link
Copy Markdown
Collaborator Author

Status: the implementation is done and just check passes locally. The PR stays a draft until two naming decisions are settled. Both are listed under ## Decisions needed, and I recommend (a) for each:

  1. Keep refusal::Reason and lease::Reason as module-qualified names.
  2. Keep close() as the method on the JS Installed handle.

Installed does not implement Disposable, because @moq/auth's ES2022 example build type-checks @moq/clock source and has no Symbol.dispose.

(Written by Claude Opus 5.5)

…th-clock-names

# Conflicts:
#	js/watch/src/sync.test.ts
#	rs/moq-audio/src/decode/consumer.rs
#	rs/moq-mux/src/container/test_util.rs
#	rs/moq-net/MIGRATE.md
#	rs/moq-relay/src/uring.rs
#	rs/moq-room/src/chat.rs
#	rs/moq-stats/MIGRATE.md
#	rs/moq-uring/benches/session_lite.rs
#	rs/moq-uring/tests/integration/session.rs
#	rs/moq-uring/tests/integration/web.rs
@kixelated
kixelated marked this pull request as ready for review October 23, 2026 17:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T00:25:59.108449Z ce130c4 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 40 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cd21a688-3471-459e-b524-550d75bb7466
📥 Commits

Reviewing files that changed from the base of the PR and between a8b3a7c and ce130c4.

📒 Files selected for processing: 100
  • doc/lib/js/clock.md
  • js/auth/src/key.test.ts
  • js/clock/MIGRATE.md
  • js/clock/README.md
  • js/clock/bench/timers.ts
  • js/clock/src/ambient.ts
  • js/clock/src/index.test.ts
  • js/clock/src/index.ts
  • js/clock/src/manual.ts
  • js/hang/src/container/consumer.holes.test.ts
  • js/hang/src/container/consumer.test.ts
  • js/net/bench/drift.ts
  • js/net/bench/refresh.ts
  • js/net/src/auth.test.ts
  • js/net/src/broadcast.test.ts
  • js/net/src/connection/close.test.ts
  • js/net/src/connection/migrate.test.ts
  • js/net/src/goaway-requests.test.ts
  • js/net/src/ietf/aliases.test.ts
  • js/net/src/ietf/publisher.test.ts
  • js/net/src/ietf/subscribe_tracks.test.ts
  • js/net/src/ietf/tail.test.ts
  • js/net/src/lite/compression.test.ts
  • js/net/src/lite/connection.test.ts
  • js/net/src/lite/publisher.test.ts
  • js/net/src/lite/refresh.test.ts
  • js/net/src/lite/subscriber.test.ts
  • js/net/src/parked-expiry.test.ts
  • js/net/src/request-deadline.test.ts
  • js/net/src/resume.test.ts
  • js/net/src/tail.test.ts
  • js/net/src/track.test.ts
  • js/net/src/util/timeout.test.ts
  • js/publish/bench/catalog.ts
  • js/publish/src/broadcast.test.ts
  • js/publish/src/catalog.test.ts
  • js/publish/src/source/retry.test.ts
  • js/publish/src/video/capture.test.ts
  • js/publish/src/video/encoder-stall.test.ts
  • js/publish/src/video/encoder.test.ts
  • js/qmux/src/session.test.ts
  • js/room/src/chat.test.ts
  • js/signals/src/index.test.ts
  • js/watch/src/audio/decoder.test.ts
  • js/watch/src/audio/replay.ts
  • js/watch/src/sync.test.ts
  • js/watch/src/video/decoder.test.ts
  • quest/m1/api-audit/README.md
  • quest/m1/api-audit/auth-clock-names.md
  • quest/m1/api-audit/net-names.md
  • quest/m1/auth/token-in-band.md
  • quest/m1/time/wall.md
  • rs/moq-audio/src/decode/consumer.rs
  • rs/moq-audio/src/encode/producer.rs
  • rs/moq-auth/MIGRATE.md
  • rs/moq-auth/src/serve.rs
  • rs/moq-c/src/publish.rs
  • rs/moq-c/src/video.rs
  • rs/moq-cli/src/main.rs
  • rs/moq-clock/MIGRATE.md
  • rs/moq-clock/src/installed.rs
  • rs/moq-clock/src/lib.rs
  • rs/moq-clock/src/runtime.rs
  • rs/moq-e2ee/tests/support/harness.rs
  • rs/moq-ffi/src/auth.rs
  • rs/moq-gst/src/sink/imp.rs
  • rs/moq-gst/src/sink/pad.rs
  • rs/moq-hls/src/export/mod.rs
  • rs/moq-mux/src/container/test_util.rs
  • rs/moq-net/MIGRATE.md
  • rs/moq-net/src/model/clock.rs
  • rs/moq-net/src/stats.rs
  • rs/moq-net/src/stats/outcomes.rs
  • rs/moq-net/src/time.rs
  • rs/moq-relay/src/auth/refresh.rs
  • rs/moq-relay/src/connection.rs
  • rs/moq-relay/src/internal.rs
  • rs/moq-relay/src/refusals.rs
  • rs/moq-relay/src/uring.rs
  • rs/moq-relay/src/web.rs
  • rs/moq-relay/tests/integration/auth_lifetime.rs
  • rs/moq-relay/tests/integration/drain.rs
  • rs/moq-relay/tests/integration/memory.rs
  • rs/moq-relay/tests/integration/refusals.rs
  • rs/moq-room/src/chat.rs
  • rs/moq-srt/src/server.rs
  • rs/moq-srt/src/ts.rs
  • rs/moq-stats/MIGRATE.md
  • rs/moq-stats/src/lib.rs
  • rs/moq-tokio/src/client.rs
  • rs/moq-tokio/src/connection/auth.rs
  • rs/moq-tokio/src/server.rs
  • rs/moq-transcode/src/catalog.rs
  • rs/moq-uring/benches/session_lite.rs
  • rs/moq-uring/src/worker.rs
  • rs/moq-uring/tests/integration/session.rs
  • rs/moq-uring/tests/integration/web.rs
  • rs/moq-video/src/encode/producer.rs
  • rs/moq-wasm/src/lib.rs
  • test/audio-quality/clients/js/src/probe.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 667f4450d6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-auth/src/serve.rs Resolved
…th-clock-names

# Conflicts:
#	rs/moq-net/MIGRATE.md
@kixelated

Copy link
Copy Markdown
Collaborator Author

Merging. Records the module-qualified Reason names and Installed.close(), as the maintainer chose. CI is green, the current head has a non-Grok review, and quest check passes against main.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 23, 2026
# Conflicts:
#	quest/m1/api-audit/README.md
#	rs/moq-auth/MIGRATE.md
#	rs/moq-auth/src/serve.rs
# Conflicts:
#	rs/moq-net/MIGRATE.md
@kixelated

Copy link
Copy Markdown
Collaborator Author

Merging. Merged main twice to clear conflicts (the api-audit README quest list, the moq-auth and moq-net MIGRATE.md entries, and serve.rs, where main's json.parse::<KeySet>() now returns Denial). quest/m1/api-audit/net-names.md now names stats::RefusalKind; its note is about where the type lives, not its name. This PR's quest is unchanged on main, so nothing replanned it. just check and quest check pass, and Codex gave the head a thumbs-up.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit 1bfbd89 Oct 24, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m1/api-audit/auth-clock-names branch October 24, 2026 03:15
kixelated added a commit that referenced this pull request Oct 24, 2026
Main renamed the free function in #6510.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated added a commit that referenced this pull request Oct 24, 2026
Carry the Wall times through #6510's Denial and Instant::now renames, and keep both MIGRATE.md entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant