Skip to content

Go packet defaults for strings, bytes and flags - #622

Merged
gafferongames merged 9 commits into
mainfrom
codex/go-packet-value-defaults
Sep 6, 2026
Merged

gafferongames merged 9 commits into
mainfrom
codex/go-packet-value-defaults

Conversation

@gafferongames

@gafferongames gafferongames commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Go packet structs now apply declared string(N), bytes(N) and flags defaults through their existing New<Type> constructors. Strings and byte buffers receive exact literal bytes, used lengths and zeroed unused capacity; flags retain the full unsigned 64-bit mask. Selected union payloads use these constructors under the shared rule landed in #616, including repeated selection.

This PR ports Go for #589. Packet defaults initialize storage and fields retain their ordinary packet encodings. The compiler uses the existing TableClosure walk to keep the named refusal for defaults reachable from a table, including through arrays, union arms, pointers and maps. An unrelated table does not block supported packet defaults. The specification, comparison page and Go packet roadmap cell state this split.

The first port adds a shared packet oracle for the remaining languages: seven C++ byte/bit goldens, with a defaultless twin explicitly initialized to the same values. The Go verifier checks independent constructor expectations and decodes the C++ bytes. Coverage includes exact-capacity UTF-8, literal backslash bytes, empty defaults, partial literals with zero suffixes, bit 63 and all 64 flag bits, nested and array construction, counted backing capacity, received short/empty prefixes, repeated union selection and the existing false-branch zero rule.

The Go negative control removes only the constructor's byte-array assignment. The modified compiler and generated verifier must build successfully, then execution must fail on the exact FAILED: packet-default constructor bytes assertion. Normal tests compare pins; the existing update-goldens command includes the new oracle's explicit pin update.

Validation on main e552e64b, including landed #616 at 5c9688e6:

  • go test ./... passes, including packet-carrier and table-closure refusal tests.
  • make -j1 test-go passes, including the C++ oracle, Go defaults verifier, constructor negative control, existing packet suites and table fuzz/race checks.
  • Every committed generation target discovered by CI has been regenerated. Existing generated files, source goldens, shared examples, wire pins and conformance data remain unchanged.
  • make -j1 update-goldens passes, executes the new oracle's explicit update, and leaves all seven new byte/bit pins identical. Existing pinned data remain unchanged.
  • All 20 fast CI checks pass on 49583c713d4cca9b53b17ebd15986122cac50b70, including generated-current, Go tests, lint, Windows/MSVC, big-endian and all nine conformance jobs. Full branch certification is still underway on that head.

No packet codec law or C/C++ packet emitter changes. The remaining seven packet ports and Go table defaults are separate work; this PR does not close #589.

Apply fresh construction on every decoder selection, retain managed storage, and cover all nine languages with independent bit oracles and semantic negative controls. Bump WireLaw to 2 and repin generated output and metadata. Full integration gate remains pending.

Co-Authored-By: GPT-6
Merge 6be68a7, resolving generated artifacts through the compiler. make update-goldens including go test ./... passes on the combined tree; full cross-language integration remains pending.

Co-Authored-By: GPT-6
Keep the Go support cell and canonical golden updater aligned with the feature.

Co-Authored-By: GPT-6
@gafferongames
gafferongames merged commit 761a864 into main Sep 6, 2026
35 checks passed
@gafferongames
gafferongames deleted the codex/go-packet-value-defaults branch September 6, 2026 13:18
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.

Packet wire: string, bytes and flags defaults in the eight ports (#396, C++ landed in #576)

1 participant