Skip to content

feat(json)!: Config means the same thing in json and binary - #3718

Merged
kixelated merged 4 commits into
devfrom
quest/m1/api-json-binary-config-names
Sep 17, 2026
Merged

kixelated merged 4 commits into
devfrom
quest/m1/api-json-binary-config-names

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Problem

Config did not mean the same thing in @moq/json, moq-json, @moq/binary, and moq-binary. JS used Config for codec options and ProducerConfig / ConsumerConfig for the track-owning pair, while Rust stream::ProducerConfig was the codec options, JS declared ConsumerConfig twice with different shapes, and moq-binary kept a with_compression(bool) builder the two sides had to keep in sync by hand.

Approach

Codec options are Config in all four packages. The track-owning pair is producer::Config / consumer::Config under public submodules in Rust and Producer.Config / Consumer.Config in JS, one declaration each. Replace with_compression(bool) with a shared compression: Compression field (None / Deflate in Rust, "none" / "deflate" in JS). Window is unchanged. Call sites, FFI mappings, and doc/lib follow.

Impact

Public API, breaking, on dev. Wire: none.

  • moq-json / @moq/json snapshot and stream: ProducerConfig / ConsumerConfig are gone. Codec options are Config. Track-owning options are producer::Config / consumer::Config (Rust) and Producer.Config / Consumer.Config (JS).
  • moq-binary / @moq/binary: same shape. with_compression(bool) is gone; both sides set compression: Compression.
  • Compression is a crate/package-level enum both sides share, so a bool mismatch is unrepresentable.
  • FFI and C still take a bool and map it onto the enum. moq-json window still uses ProducerConfig / ConsumerConfig.

Alternatives

Keep one Config type for encoder and decoder even when the decoder ignores delta_ratio. Rejected: snapshot consume options are a subset, and JS already picks schema / compression on Consumer.Config. A shared type would make producer-only knobs representable on the consume side.

Rename window in the same PR. Rejected: the quest is snapshot and stream in the four packages; window still has its own op/checkpoint knobs.

(written by grok-4.6)

@kixelated
kixelated marked this pull request as ready for review September 17, 2026 08:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 17, 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-09-17T13:00:01.715750Z a1828a5 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.

@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: 64d4cdc249

ℹ️ 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 doc/lib/js/json.md Resolved
@kixelated
kixelated force-pushed the quest/m1/api-json-binary-config-names branch 2 times, most recently from 5b35456 to 6d6304f Compare September 17, 2026 11:19

@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: 6d6304ff99

ℹ️ 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-json/src/lib.rs Resolved
Comment thread doc/lib/js/json.md Resolved
@kixelated
kixelated force-pushed the quest/m1/api-json-binary-config-names branch from 6d6304f to 753a6d8 Compare September 17, 2026 11:49
@kixelated

Copy link
Copy Markdown
Collaborator Author

Rebased onto origin/dev (through #3711). Codex round: Config rename docs are snapshot/stream only; Compression::is_deflate is crate-private; the JS consumer example takes track.subscribe(). Quest list conflicts after #3710 drop JSON config names without restoring JS names.

Enabling squash auto-merge.

(written by grok-4.6)

@kixelated
kixelated enabled auto-merge (squash) September 17, 2026 11:50
@kixelated
kixelated force-pushed the quest/m1/api-json-binary-config-names branch from 753a6d8 to 3dcec2c Compare September 17, 2026 11:54

@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: 3dcec2c50e

ℹ️ 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".

//! the encoder, which keeps a frame that never reached the wire from desyncing the stream.

mod consumer;
pub mod consumer;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Expose only Config through the new submodules

Making the implementation modules public also exposes unintended duplicate paths such as snapshot::consumer::Consumer, snapshot::producer::Producer, and snapshot::producer::Guard; the same occurs in the stream modules and moq-binary. Downstream users can adopt these unreported aliases, making later cleanup another breaking change. Keep the implementations private and expose narrow producer/consumer facade modules containing only the intended Config names. (Written by GPT-5.6 Sol)

AGENTS.md reference: AGENTS.md:L45-L45

Useful? React with 👍 / 👎.

@kixelated
kixelated force-pushed the quest/m1/api-json-binary-config-names branch 2 times, most recently from 91ecb91 to 48820ee Compare September 17, 2026 12:55
kixelated and others added 4 commits September 17, 2026 05:56
Codec options are Config. The track-owning pair is producer::Config /
consumer::Config in Rust and Producer.Config / Consumer.Config in JS.
Compression is a shared enum instead of with_compression(bool).

Co-Authored-By: grok-4.6 <noreply@x.ai>
Window still uses ProducerConfig / ConsumerConfig and boolean compression.

Co-Authored-By: grok-4.6 <noreply@x.ai>
debug_assert type-checks its arguments without debug_assertions, so the
helper cannot be cfg-gated.

Co-Authored-By: grok-4.6 <noreply@x.ai>
@kixelated
kixelated force-pushed the quest/m1/api-json-binary-config-names branch from 48820ee to a1828a5 Compare September 17, 2026 12:56
@kixelated

Copy link
Copy Markdown
Collaborator Author

MERGE

This is the right break. Config meant four different things across json/binary and Rust/JS; collapsing codec options onto one name and parking track-owning knobs under consumer::Config / Producer.Config / Consumer.Config matches AGENTS (short names under a module, mirror across languages, no shim).

Compression as an enum (instead of with_compression(bool)) makes the none/deflate mismatch unrepresentable. Leaving window on ProducerConfig/ConsumerConfig is the right scope cut; do not drag that rename into this PR.

FFI keeping a bool and mapping at the boundary is fine. Public API and wire impact are stated correctly: breaking on dev, wire none.

Ship it.

(Written by Grok)

@kixelated
kixelated merged commit ff97e2b into dev Sep 17, 2026
5 checks passed
@kixelated
kixelated deleted the quest/m1/api-json-binary-config-names branch September 17, 2026 13:52
@moq-bot moq-bot Bot mentioned this pull request Sep 23, 2026
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