Skip to content

fix(ts): pick bench varint forms from versions moq still has, and type-check the bench - #229

Merged
kixelated merged 1 commit into
mainfrom
fix/bench-moq-forms
Oct 29, 2026
Merged

kixelated merged 1 commit into
mainfrom
fix/bench-moq-forms

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Problem

just ts bench fails on main. #196's moq pin dropped Ietf.DRAFT_16 and DRAFT_17 from moq's js/net, so bench/moq.ts's FORMS passed undefined as both versions. moq's isLeadingOnes reads anything it doesn't know as leading ones, so the hand-written decode of varint/quic/2B and wider read QUIC wire as leading ones and failed the output check (found by #222). Nothing type-checks bench/, so the pin bump passed.

Approach

  • FORMS takes each form's version from versions moq still has, typed as moq's StreamVersion:

    • QUIC: Lite.DRAFT_06, the last Lite draft with QUIC varints.
    • Leading ones: Lite.DRAFT_07, the first.

    Encoding and decoding round-trip in Bun for 2-, 4-, and 8-byte QUIC varints and 2-, 3-, and 6-byte leading-ones varints, each with the expected length prefix.

  • just ts check now type-checks bench/ against moq at the pin, through a new bench/tsconfig.json:

    • moq/* maps to target/moq.
    • Bun's types come from moq's @types/bun.

    It runs just moq-pin and moq's bun install --filter @moq/net (36 packages), then tsc -p bench, at about 1 s of CPU. On this branch's parent, it reports the two missing versions.

  • Three type errors the bench had never surfaced, fixed without changing behavior:

    • entry.ts tests "WorkerGlobalScope" in globalThis. The WorkerGlobalScope name exists only in the webworker lib, which clashes with dom.
    • main.ts's bundle, read, and measureSize type their bytes as Uint8Array<ArrayBuffer>, as Bun.gzipSync wants.

Impact

  • No public API change.
  • just check (merge gate) now clones moq at the pin and installs @moq/net's dependencies: a few seconds, mostly network.

Alternatives

  • Ietf.DRAFT_18 for leading ones: works too, but Lite.DRAFT_07 keeps both forms on one version family.
  • Stubbing moq's npm imports to skip the install: less honest, and the install is cheap.

Follow-ups

None.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

…e-check the bench

#196's moq pin dropped Ietf DRAFT_16 and DRAFT_17, so the hand-written route
passed undefined as both forms' versions, which moq reads as leading ones:
its QUIC varint decode of 2 bytes and wider failed the output check. Use
Lite DRAFT_06 for QUIC and DRAFT_07 for leading ones, typed as moq's
StreamVersion, and type-check bench/ against moq at the pin in just check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 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-29T17:53:46.644371Z 7d80a07 PR opened
🔒 Security Review ✅ Completed 2026-10-29T17:54:17.202744Z 7d80a07 PR opened
ℹ️ 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.

@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)

Reviewed head 7d80a0733882056d45e2e1c5d740298701bd78a1 against base 8a8d4b61d7b15fc63161e2134ffd091d5f3b5e7e.

No actionable findings. At the pinned MoQ revision 30f25c04e6d0288d87893dc609ba582518be2cf6, the stream codec explicitly treats Lite-06 as QUIC varints and Lite-07 as leading-ones, so the replacement versions match their encoders. Typing them as StreamVersion and checking the bench against that same checkout closes the missing-export gap without weakening the output comparisons.

The new tsconfig paths resolve from ts/bench to ts/target/moq; the check installs dependencies with the existing frozen-lockfile/ignore-scripts convention, and the default devshell already provides Bun and TypeScript. ArrayBuffer-specific byte annotations agree with the buffer constructors. Using the global property test avoids the DOM/webworker declaration conflict without changing normal page/worker selection.

The additional network/dependency-install requirement for check is an explicit tradeoff, not a local-only lint check anymore. GitHub-only static review of the diff, bench callers, recipes/devshell, and pinned upstream codec. No installation, typecheck, benchmark, cross-engine run, or CI was executed; reported round trips and timings were not independently reproduced.

@kixelated
kixelated merged commit 70265dc into main Oct 29, 2026
1 check passed
@kixelated
kixelated deleted the fix/bench-moq-forms branch October 29, 2026 18:09
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