Skip to content

fix(hang): Rust refuses null in an optional catalog field, as JS does - #8978

Merged
kixelated merged 3 commits into
mainfrom
quest/m2/hang04/null
Nov 17, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m2/hang04/null

Conversation

@kixelated

@kixelated kixelated commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m2/hang04/null.md.

Summary

rs/hang read null in any optional field inside a rendition, data track, include, color, projection, or the video section as absent, while js/hang (z.optional) and the hang draft's Root and Malformed Renditions sections refuse it. Rust now refuses it too.

  • New NotNull<T = Same> serde_with adapter in rs/hang/src/catalog/mod.rs: absent stays None (with #[serde(default)]), null is refused, and it wraps the existing adapters (NotNull<DisplayFromStr>, NotNull<Hex>, NotNull<Number>, NotNull<MillisCeil>), which a field-level deserialize_some could not.
  • Every optional field the draft defines uses it, replacing the old Option<...> adapters; MillisCeil's optional form (jitter, delay) refuses null itself while still reading 0 as absent.
  • rs/hang/fixtures/catalog-parity.json gains 70 cases: one per optional or defaulted field of every video, audio, text, json, binary, include, color, and video-section schema (generated by introspecting the JS zod schemas, so no field is missed), plus projection.fov, root version, and an accepted case showing an unknown extension field inside a rendition may still be null.

Choices made without asking (confirmed by the maintainer, 2026-11-16)

  • One adapter applied per field, over a catalog-wide walk of the decoded JSON: it stays type-driven, keeps unknown fields free, and needs no list of field names kept in sync by hand.
  • m2ts.muxRate refuses null too. The m2ts section is Rust-only (not in the draft or JS), but its root member already refuses null, so its field follows the same rule.
  • Color takes a container-level #[serde(default)] instead of one per field, since every field is optional and Color derives Default.

Validation

  • Reproduced first: with only the fixture change, just test -p hang shared_parity_fixtures on the old code failed 60 of the 69 new refusal cases (Rust accepted them); the other 9 (interlaced, enabled, preference, container, role, version) were already refused.
  • With the fix: just test -p hang -p moq-mux 2258/2258 pass; bun test of js/hang parity (361 cases) and js/publish broadcast tests (which load the same fixture) pass.
  • Second, independent check (differential, not committed): nulled every member of every accepted parity catalog in turn (440 distinct mutants), recorded JS's verdict, and ran each through Rust's Catalog::from_str + check_renditions. Rust and JS agreed on all 440.
  • just check: everything passes except one @moq/net test, a reset Announce Stream closes moq-lite-07 with PROTOCOL_VIOLATION, which hit its 5 s timeout under the full parallel run and passes alone in 319 ms; this PR touches no JS net code.

Impact

Public API: none (NotNull is pub(crate)). Wire: a catalog with null in an optional field the draft defines, which JS already refuses, is refused by Rust too. Serialization is unchanged: absent fields are still omitted, never written as null.

Caused by

No single PR: serde reads null as None for every Option field, so this is as old as the catalog structs. moq-dev/moq#8920 fixed only the root sections and media (found by reviewer).

Follow-ups

None.

Models

Size: S
Implementer: Claude Code, claude-opus-5-5, unknown effort (arm A)
Implementer: Claude Code, claude-sonnet-5-5, unknown effort (iterate, S, arm B)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Head: 03f198d

  • Base: origin/main at 8231b31

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a1e6d9-ba36-7041-8c96-5f8acfaa846d, round 2

  • Score: 9/10, The new head only merges upstream changes, introduces no new actionable defects in the previously reviewed change, and remains covered by parity fixtures, though tests were not run as instructed.

  • Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 16, 2026 15:40
Quest-Claim: 081e370a065e0fba
Every optional field the hang draft defines in renditions, data tracks,
includes, color, projection, and the video section now goes through a
NotNull serde_with adapter, so null is refused instead of read as absent.
MillisCeil's optional form refuses null too. The shared parity fixture
gains a null case per field, generated from the JS schemas.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Rust refuses a null catalog field as JS does fix(hang): Rust refuses null in an optional catalog field, as JS does Nov 17, 2026
@kixelated
kixelated marked this pull request as ready for review November 17, 2026 00:14

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review by review (OpenAI)
Head: 6f6566fb646e778103050eb489aa67a570465020

No blocker found. The field adapters preserve the distinction between omission and explicit null without walking unknown extensions. The duration adapter still treats zero jitter/delay as absent, while zero warmup remains a value. The shared fixtures cover rejection of known fields and acceptance of a null extension, which are the two important directions. This tightens catalog acceptance for Rust-only producers, so note the distinction in release notes if they previously emitted nulls. Static review; I did not rerun the reported tests.

pullfrog[bot]
pullfrog Bot previously approved these changes Nov 17, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

I reviewed the new NotNull adapter, every catalog field it now covers, the MillisCeil change for optional fields, and the new parity fixtures.

  • NotNull<T = Same> adapter: it wraps the existing serde_with adapters, so a null in a field the draft defines is refused, an absent field still decodes as None through #[serde(default)], and serialization doesn't change because every struct using it has skip_serializing_none or an explicit skip_serializing_if.
  • Field coverage: every optional field in the video/audio/text/json/binary configs now uses NotNull, and so do the Video section, Color, Equirectangular.fov, Include.instance and M2ts.mux_rate. Fields that were previously relying on serde's implicit Option default (lang, label, codedWidth/codedHeight, displayAspect*) were correctly given an explicit #[serde(default)].
  • MillisCeil with optional fields: jitter and delay now refuse null but still read 0 as absent, and warmup uses NotNull<MillisCeil>, so a zero warmup keeps its meaning.
  • Projection: Projection::deserialize sends known kinds through Known, so fov: null is a hard error rather than quietly turning into Unknown.
  • Parity fixtures: 70 new shared cases give each optional field its own null case, and one more case shows an unknown extension field can still be null.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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 15 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: f8d5fabc-915f-4687-8f04-b6c61b5039d0
Commits

Reviewing files that changed from the base of the PR and between 6f6566f and 03f198d.

Files selected for processing: 13

  • quest/m2/hang04/null.md
  • rs/hang/fixtures/catalog-parity.json
  • rs/hang/src/catalog/audio/mod.rs
  • rs/hang/src/catalog/binary.rs
  • rs/hang/src/catalog/include.rs
  • rs/hang/src/catalog/json.rs
  • rs/hang/src/catalog/m2ts.rs
  • rs/hang/src/catalog/millis.rs
  • rs/hang/src/catalog/mod.rs
  • rs/hang/src/catalog/text/mod.rs
  • rs/hang/src/catalog/video/color.rs
  • rs/hang/src/catalog/video/mod.rs
  • rs/hang/src/catalog/video/projection.rs

No actionable comments were generated in the recent review.

Walkthrough

The change adds a Serde adapter for optional catalog fields and applies it across Rust catalog types. Serialization still represents absent values as null, while deserialization rejects null for fields using the adapter. Optional duration deserialization also rejects null and continues to map zero to None. New parity fixtures cover null catalog values and an unknown namespaced field.

Merge Risk: Minimal · previous review 6f656

This change makes Rust reject explicit null in optional catalog fields, matching JavaScript. No concrete merge-blocking risk was found. Omitted fields still behave as absent, and the new parity fixtures cover the changed behavior.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Rust now refuses explicit null in optional catalog fields, matching JS behavior. The raw summary and objectives confirm a crate-private NotNull serde adapter applied a…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states that Rust now refuses explicit null in optional catalog fields inside renditions, data tracks, includes, color, projection, and the video section, matching the changeset. It nam…
Full details: Title check

Explanation

The title names the main change: Rust now refuses explicit null in optional catalog fields, matching JS behavior. The raw summary and objectives confirm a crate-private NotNull serde adapter applied across catalog structs, so the title matches the changeset.

Full details: Description check

Explanation

The description states that Rust now refuses explicit null in optional catalog fields inside renditions, data tracks, includes, color, projection, and the video section, matching the changeset. It names the NotNull adapter, the catalog-parity fixture additions, the MillisCeil change, and the m2ts.muxRate change, all of which appear in the raw summary. It also lists validation runs and an impact section. The description is specific and directly tied to the changes.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

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: 97bbdfe4-fda3-499b-9152-73df53954469
Commits

Reviewing files that changed from the base of the PR and between ba9c4c6 and 6f6566f.

Files selected for processing: 13

  • quest/m2/hang04/null.md
  • rs/hang/fixtures/catalog-parity.json
  • rs/hang/src/catalog/audio/mod.rs
  • rs/hang/src/catalog/binary.rs
  • rs/hang/src/catalog/include.rs
  • rs/hang/src/catalog/json.rs
  • rs/hang/src/catalog/m2ts.rs
  • rs/hang/src/catalog/millis.rs
  • rs/hang/src/catalog/mod.rs
  • rs/hang/src/catalog/text/mod.rs
  • rs/hang/src/catalog/video/color.rs
  • rs/hang/src/catalog/video/mod.rs
  • rs/hang/src/catalog/video/projection.rs
Files with no reviewable changes: 1

  • quest/m2/hang04/null.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

The only commit since the last review merges origin/main. It doesn't change any of this PR's code.

  • Merged origin/main: the range-diff shows one difference, and it is wording in the quest file that came from the base branch (media's clock/join became sync's clock/interval). The NotNull adapter, the field annotations and the parity fixtures are the same as when they were approved.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit e92ea78 Nov 17, 2026
6 checks passed
@kixelated
kixelated deleted the quest/m2/hang04/null branch November 17, 2026 09:40
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