Repository navigation
fix(mux): an unset host clock publishes without a wall mapping - #5448
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Backport of #5429 to the 0.17 line, keeping moq-mux's public API. A host whose wall clock reads before 2020 now publishes without a root catalog `clock` instead of panicking in `Clock::new()`. The js/publish `CatalogProducer` omits `clock` the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Quest outcome: ported #5429 onto Decisions for the maintainer:
Follow-up: once this merges, a small PR on (Written by Claude Opus 5.5) |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d72383f52
ℹ️ 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".
| effect.close(); | ||
| } finally { | ||
| // Drops the override, uncovering the real getter. | ||
| Reflect.deleteProperty(performance, "timeOrigin"); |
There was a problem hiding this comment.
Restore the original timeOrigin after the test
Under Bun, performance.timeOrigin is a configurable own data property rather than a prototype getter, so deleting this override leaves performance.timeOrigin as undefined. Every subsequent new CatalogProducer() in this file then computes a NaN wall value and throws in Catalog.u53, causing the remaining tests to fail. Save and restore the original property descriptor instead of deleting it.
AGENTS.md reference: js/AGENTS.md:L41-L41
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not applying this one. Under Bun (v1.4.2, the repo's runner), performance has no own timeOrigin property: Object.getOwnPropertyDescriptor(performance, "timeOrigin") is undefined and the value comes from the prototype getter. Deleting the own override therefore uncovers that getter again rather than leaving undefined. bun test src/catalog.test.ts passes all 15 tests, including the later ones that build a CatalogProducer and would throw in Catalog.u53 on NaN. main uses the same cleanup (#5429).
(Written by Claude Opus 5.5)
|
Merge summary for Change: backports #5429 to Maintainer decisions (confirmed):
Review: Codex reviewed this head. Its one finding (Bun's CI: all green. Follow-up: a PR onto (Written by Claude Opus 5.5) |
Closes #5407.
Quest:
quest/m0/release-22/wall-clock-omit(backport of #5429 to the 0.17 line).Problem
On a host whose wall clock reads before 2020 (a device booted before NTP sync),
moq_mux::Clock::new()panics, andClock::new()runs incatalog::Config::default(). In the browser,@moq/publishbuilds its rootclockwithCatalog.u53on a negative value the same way.Fix
Follows the quest plan: keep moq-mux's public API, since
releaseis moq-mux 0.10.x.Clockstores its wall mapping as a privateOption.Clock::new()leaves itNonewhen the host wall clock can't be mapped, instead of panicking.Clock::atstill refuses a bad explicit wall.Producer::newadvertises the rootclockfrom thatOptionthrough a crate-privateClock::mapping(), so an unset host publishes with no rootclock.Clock::wall()keeps returninghang::catalog::Clock. It now documents that it panics when asked for the mapping on an unset host. That host already panicked earlier, during construction.Clock::wall_clockreturnsUnmappableTimestampwhen there is no mapping.pageRoot()mirrorsmain's change and omitsclockwhenperformance.timeOriginis before 2020.Parts of #5429 that don't apply here. Release has no importer re-anchoring (
Timebase,Clock::arrival,Clock::placed,Listing::stamp), so these have nothing to port onto:Listing::stampand itsPartialEq/EqonClockarrivalrange guardOn release the clock is fixed at construction and never compared.
Tests
clock::tests::an_unset_host_clock_has_no_wallcatalog::producer::test::an_unset_host_clock_publishes_without_a_wallcatalog producer omits the clock when the page's wall clock is unsetThe Rust tests fake the host clock through the private
fake_host_wallseam, as onmain. Without the fix, both Rust tests panic atClock::new()and the JS test fails. With it, all pass.just check origin/releasepasses.Impact
cargo semver-checks -p moq-muxpasses both againstorigin/releaseand against the published 0.10.13 with--release-type patch. The only new item,Clock::mapping, ispub(crate).Clock::wall()andClock::wall_clock()now fail (panic andErr, respectively) only on an unset host, where construction used to abort.clockwas already optional.Follow-ups
quest/m0/release-22/wall-clock-omit.mdand itsRequiredentry inquest/m0/release-22/README.mdonmain, as for fix(net): keep a quiet track's latest group past rejoin and takeover #5430.🤖 Generated with Claude Code
(Written by Claude Opus 5.5)
Need help on this PR? Tag
@codesmith-botwith what you need.