Skip to content

fix(@moq/lite): encode empty namespace as [] not [""]#1179

Merged
kixelated merged 1 commit into
mainfrom
empty-namespace
Apr 1, 2026
Merged

fix(@moq/lite): encode empty namespace as [] not [""]#1179
kixelated merged 1 commit into
mainfrom
empty-namespace

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Summary

  • Fixed TypeScript namespace encoder: "".split("/") returns [""], so empty namespaces were encoded as a 1-element tuple with an empty string instead of a 0-element tuple. Each namespace part MUST be at least one byte per spec.
  • The Rust side already handled this correctly.
  • Added unit tests for namespace encoding/decoding in both Rust and TypeScript.

Test plan

  • bun test js/lite/src/ietf/ietf.test.ts — 60 tests pass (8 new namespace tests)
  • cargo test -p moq-lite -- ietf::namespace — 6 new tests pass
  • Verified empty namespace encodes as [0x00] (zero-length tuple), not [0x01, 0x00]

🤖 Generated with Claude Code

`"".split("/")` in JavaScript returns `[""]`, so an empty namespace
was encoded as a 1-element tuple with an empty string instead of a
0-element tuple. Each namespace part MUST be at least one byte per spec.

Adds unit tests for namespace encoding in both Rust and TypeScript.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kixelated kixelated enabled auto-merge (squash) April 1, 2026 17:54
@kixelated kixelated merged commit de0c3e9 into main Apr 1, 2026
2 checks passed
@kixelated kixelated deleted the empty-namespace branch April 1, 2026 18:00
This was referenced Apr 1, 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