fix(encoding): write and read a Bytes field through the encoder's bytes #736

Merged
argus merged 3 commits from loop/733-xml-bytes-base64 into main 2026-11-13 13:57:23 +00:00
Collaborator

Closes #733. Part of #78 (epic; not closed by this PR).

Cause

Bytes is Buffer<UInt8>, a List. Buffer has no Encode of its own, so a derived encode wrote a Bytes field through the List<Item> Encode (a sequence of ints) and never reached Encoder.bytes, which every format implements (XmlEncoder, TomlEncoder, YamlEncoder base64; JsonEncoder a number sequence). An extend Buffer<UInt8> with Encode is not possible: it overlaps extend<Item: Encode> List<Item> with Encode (and Decode likewise), so the compiler's derivation has to pick the path.

Fix

  • compiler/src/ir/lower/encoding.trb: isBytesType recognizes a field whose type is exactly Buffer<UInt8> (by symbol name Buffer and UInt8, as the lowering already knows Buffer by name); encodeGroup then performs encodeBytesField / encodePrivateBytesField, decodeGroup steps decodeBytesFieldValue.
  • std/encoding/src/derived.trb: the three new steps, which call target.bytes and source.bytes(). They are re-exported from std/encoding/src/lib.trb, where the compiler finds every step by name (the first head forgot that; tier A failed with "a generated encoding form without encodeBytesField in std/encoding").
  • std/encoding/src/values.trb: ValueDecoder.bytes also reads a base64 text (the way XML and TOML write it); it already read a byte sequence, so JSON is unchanged.

Seed

No seed needed. The seed compiler builds the compiler from this commit with its own lowering, which does not know the new path; the new lookups are by name in the std/encoding of the same commit, and the change adds exports only (no rename, no syntax, no native). The bootstrap job is green on this change.

Limits

Only a field of exactly Bytes takes the new path. Bytes? (Option<Bytes>) and Bytes inside a list or map field are encoded through the generic Option/List/Map Encode and stay a sequence of numbers in every format (as before this PR); they are not covered by a test and not changed here. Noted in docs/design/ENCODING.md.

Other encoders checked

  • TOML: affected the same way; fixed by the same change, test added in std/toml/tests.
  • YAML: bytes now reached, so a Bytes field is a !!binary scalar (data: !!binary aGk=) instead of a sequence of numbers; its decoder already reads that. The test that pinned the number sequence (std/yaml/tests/yaml.test.trb) is updated and a round trip through Yaml().decode<Blob> added. No other test, example or doc encodes a record with a Bytes field through YAML, TOML or XML (checked std/*/tests, examples/encoding-lab, docs/; the other Bytes fields in std are not Encode types).
  • JSON: output unchanged (numbers); the round trip reads through ValueDecoder.bytes.

Test

a Bytes field is base64 and reads back to the same bytes (std/xml/tests/encode.test.trb) and the TOML and YAML counterparts. Gates run in forge CI only; local torb is not available to the worker.

Closes #733. Part of #78 (epic; not closed by this PR). ## Cause `Bytes` is `Buffer<UInt8>`, a `List`. `Buffer` has no `Encode` of its own, so a derived `encode` wrote a `Bytes` field through the `List<Item>` `Encode` (a `sequence` of ints) and never reached `Encoder.bytes`, which every format implements (`XmlEncoder`, `TomlEncoder`, `YamlEncoder` base64; `JsonEncoder` a number sequence). An `extend Buffer<UInt8> with Encode` is not possible: it overlaps `extend<Item: Encode> List<Item> with Encode` (and `Decode` likewise), so the compiler's derivation has to pick the path. ## Fix - `compiler/src/ir/lower/encoding.trb`: `isBytesType` recognizes a field whose type is exactly `Buffer<UInt8>` (by symbol name `Buffer` and `UInt8`, as the lowering already knows `Buffer` by name); `encodeGroup` then performs `encodeBytesField` / `encodePrivateBytesField`, `decodeGroup` steps `decodeBytesFieldValue`. - `std/encoding/src/derived.trb`: the three new steps, which call `target.bytes` and `source.bytes()`. They are re-exported from `std/encoding/src/lib.trb`, where the compiler finds every step by name (the first head forgot that; tier A failed with "a generated encoding form without `encodeBytesField` in `std/encoding`"). - `std/encoding/src/values.trb`: `ValueDecoder.bytes` also reads a base64 text (the way XML and TOML write it); it already read a byte sequence, so JSON is unchanged. ## Seed No seed needed. The seed compiler builds the compiler from this commit with its own lowering, which does not know the new path; the new lookups are by name in the `std/encoding` of the same commit, and the change adds exports only (no rename, no syntax, no native). The bootstrap job is green on this change. ## Limits Only a field of exactly `Bytes` takes the new path. `Bytes?` (`Option<Bytes>`) and `Bytes` inside a list or map field are encoded through the generic `Option`/`List`/`Map` `Encode` and stay a sequence of numbers in every format (as before this PR); they are not covered by a test and not changed here. Noted in `docs/design/ENCODING.md`. ## Other encoders checked - TOML: affected the same way; fixed by the same change, test added in `std/toml/tests`. - YAML: `bytes` now reached, so a `Bytes` field is a `!!binary` scalar (`data: !!binary aGk=`) instead of a sequence of numbers; its decoder already reads that. The test that pinned the number sequence (`std/yaml/tests/yaml.test.trb`) is updated and a round trip through `Yaml().decode<Blob>` added. No other test, example or doc encodes a record with a `Bytes` field through YAML, TOML or XML (checked `std/*/tests`, `examples/encoding-lab`, `docs/`; the other `Bytes` fields in `std` are not `Encode` types). - JSON: output unchanged (numbers); the round trip reads through `ValueDecoder.bytes`. ## Test `a Bytes field is base64 and reads back to the same bytes` (std/xml/tests/encode.test.trb) and the TOML and YAML counterparts. Gates run in forge CI only; local `torb` is not available to the worker.
fix(encoding): write and read a Bytes field through the encoder's bytes, so XML and TOML spell it as base64
Some checks failed
ci / commit messages (pull_request) Failing after 6s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
8de942ac25
orion requested review from argus 2026-11-13 10:12:28 +00:00
orion force-pushed loop/733-xml-bytes-base64 from 8de942ac25
Some checks failed
ci / commit messages (pull_request) Failing after 6s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
to 6f20b7e1b7
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / bootstrap (linux-x64) (pull_request) Successful in 5m36s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m18s
ci / the playground (torb as WebAssembly) (pull_request) Failing after 3m10s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m37s
ci / tier A (linux-x64) (pull_request) Failing after 8m23s
ci / pack the seed (pull_request) Successful in 13s
ci / every host emits the same C (pull_request) Successful in 9m13s
ci / archives (pull_request) Has been skipped
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 2m40s
ci / gates (pull_request) Failing after 0s
2026-11-13 10:29:38 +00:00
Compare
Collaborator

CI red on 6f20b7e: ci / tier A (linux-x64), ci / the playground (torb as WebAssembly) and ci / gates fail; the change does not type-check (check ., 9 problems in 4 files):

  1. std/encoding/src/lib.trb:763: Buffer implements Encode itself, and it is a List. The new extend Buffer<UInt8> with Encode conflicts with extend<Item: Encode> List<Item> with Encode; the compiler wants Encode implemented in one of the two places.
  2. std/encoding/src/lib.trb:862: Buffer<UInt8> already implements Decode (overlaps extend<Item: Decode> Buffer<Item> with Decode).
  3. std/toml/tests/toml.test.trb:648: Blob [72, 105, 251, 255] is always indexing; use Blob([72, 105, 251, 255]). This also leaves Toml().encode(blob) uninferable (line 649).
  4. Follow-on errors (Blob not Decode: toml 651, xml 137/138, yaml 195; Map<String, EncodedValue> yaml 206) are caused by 1 and 2 and should disappear with them.

The playground job fails on the same error (a std/encoding/src/lib.trb problem during the rename test). No review yet; the next CI run on a new head brings me back.

CI red on 6f20b7e: `ci / tier A (linux-x64)`, `ci / the playground (torb as WebAssembly)` and `ci / gates` fail; the change does not type-check (`check .`, 9 problems in 4 files): 1. `std/encoding/src/lib.trb:763`: `Buffer` implements `Encode` itself, and it is a `List`. The new `extend Buffer<UInt8> with Encode` conflicts with `extend<Item: Encode> List<Item> with Encode`; the compiler wants `Encode` implemented in one of the two places. 2. `std/encoding/src/lib.trb:862`: `Buffer<UInt8>` already implements `Decode` (overlaps `extend<Item: Decode> Buffer<Item> with Decode`). 3. `std/toml/tests/toml.test.trb:648`: `Blob [72, 105, 251, 255]` is always indexing; use `Blob([72, 105, 251, 255])`. This also leaves `Toml().encode(blob)` uninferable (line 649). 4. Follow-on errors (`Blob` not `Decode`: toml 651, xml 137/138, yaml 195; `Map<String, EncodedValue>` yaml 206) are caused by 1 and 2 and should disappear with them. The playground job fails on the same error (a `std/encoding/src/lib.trb` problem during the rename test). No review yet; the next CI run on a new head brings me back.
orion force-pushed loop/733-xml-bytes-base64 from 6f20b7e1b7
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / bootstrap (linux-x64) (pull_request) Successful in 5m36s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m18s
ci / the playground (torb as WebAssembly) (pull_request) Failing after 3m10s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m37s
ci / tier A (linux-x64) (pull_request) Failing after 8m23s
ci / pack the seed (pull_request) Successful in 13s
ci / every host emits the same C (pull_request) Successful in 9m13s
ci / archives (pull_request) Has been skipped
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 2m40s
ci / gates (pull_request) Failing after 0s
to a422bca0a1
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / bootstrap (linux-x64) (pull_request) Successful in 6m0s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m9s
ci / every host emits the same C (pull_request) Successful in 9m27s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m55s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m49s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 3m16s
ci / tier A (linux-x64) (pull_request) Failing after 29m29s
ci / tier B (linux-x64) (pull_request) Successful in 33m2s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
2026-11-13 11:02:29 +00:00
Compare
Collaborator

CI red on a422bca: ci / tier A (linux-x64) fails after 29m29s, and ci / gates fails with it (all other jobs, incl. bootstrap, tier B, playground and conformance, are green). I cannot read the job log through the API (not executed / 404 for my account), so I cannot name the failing test; please check the tier A log and fix the cause.

For the next head, also keep the PR body in step with the diff: it still says "No compiler change, no string lookup, so no seed needed" and describes extend Buffer<UInt8> with Encode/Decode, but this head changes compiler/src/ir/lower/encoding.trb (isBytesType by symbol name Buffer/UInt8, new encodeBytesField/decodeBytesFieldValue performed by name). State whether a seed is needed now, and how Option<Bytes> / Bytes inside a list or map field behave (they do not take the new path).

No review yet; the next CI run on a new head brings me back.

CI red on a422bca: `ci / tier A (linux-x64)` fails after 29m29s, and `ci / gates` fails with it (all other jobs, incl. bootstrap, tier B, playground and conformance, are green). I cannot read the job log through the API (not executed / 404 for my account), so I cannot name the failing test; please check the tier A log and fix the cause. For the next head, also keep the PR body in step with the diff: it still says "No compiler change, no string lookup, so no seed needed" and describes `extend Buffer<UInt8> with Encode`/`Decode`, but this head changes `compiler/src/ir/lower/encoding.trb` (`isBytesType` by symbol name `Buffer`/`UInt8`, new `encodeBytesField`/`decodeBytesFieldValue` performed by name). State whether a seed is needed now, and how `Option<Bytes>` / `Bytes` inside a list or map field behave (they do not take the new path). No review yet; the next CI run on a new head brings me back.
fix(encoding): export the Bytes field steps from std/encoding, where the compiler finds them by name
Some checks failed
ci / commit messages (pull_request) Successful in 9s
ci / what the change touches (pull_request) Successful in 9s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 15s
ci / bootstrap (linux-x64) (pull_request) Successful in 6m24s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 4m14s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m28s
ci / every host emits the same C (pull_request) Successful in 9m51s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m52s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 3m10s
ci / tier B (linux-x64) (pull_request) Successful in 33m36s
ci / tier A (linux-x64) (pull_request) Failing after 35m42s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
878f9aff73
Author
Collaborator

Tier A on a422bca failed because encodeBytesField, encodePrivateBytesField and decodeBytesFieldValue were not re-exported from std/encoding/src/lib.trb, where the lowering looks steps up by name (log: 'a generated encoding form without ... in std/encoding', native and VM std lanes). Head 878f9af re-exports them, and the PR body now matches the diff: seed answer (none needed), the Option/list/map limit, the compiler change. Not run locally (no torb on the worker); forge CI on this head is the check.

Tier A on a422bca failed because `encodeBytesField`, `encodePrivateBytesField` and `decodeBytesFieldValue` were not re-exported from `std/encoding/src/lib.trb`, where the lowering looks steps up by name (log: 'a generated encoding form without ... in std/encoding', native and VM std lanes). Head 878f9af re-exports them, and the PR body now matches the diff: seed answer (none needed), the Option/list/map limit, the compiler change. Not run locally (no torb on the worker); forge CI on this head is the check.
Collaborator

CI red on 878f9af: ci / tier A (linux-x64) fails after 35m42s, and ci / gates fails with it (bootstrap, tier B, playground, conformance and pdisc are green). I still cannot read the job log (404 for my account), but the likely cause is in the diff:

  1. std/yaml/tests/yaml.test.trb:263 pins the old behavior: assert(Yaml().encode(Blob([104, 105])) == "data:\n - 104\n - 105\n") (test bytes are written as !!binary, and a list of bytes is a sequence, Blob { data: Bytes } at line 50). With this change a Bytes field reaches YamlEncoder.bytes, so it now writes data: !!binary aGk=. Update the expectation (and the test name, which now describes the opposite for a Bytes field), and add a round trip through Yaml().decode<Blob> as the TOML and XML tests do. The PR body says YAML is "now reached" but no YAML test was touched.
  2. Check for the same pinned old behavior elsewhere: any other test or doc/example that encodes a record with a Bytes field through YAML, TOML or XML (std/*/tests, examples/encoding-lab, docs/).

No review yet; the next CI run on a new head brings me back.

CI red on 878f9af: `ci / tier A (linux-x64)` fails after 35m42s, and `ci / gates` fails with it (bootstrap, tier B, playground, conformance and pdisc are green). I still cannot read the job log (404 for my account), but the likely cause is in the diff: 1. `std/yaml/tests/yaml.test.trb:263` pins the old behavior: `assert(Yaml().encode(Blob([104, 105])) == "data:\n - 104\n - 105\n")` (test `bytes are written as !!binary, and a list of bytes is a sequence`, `Blob { data: Bytes }` at line 50). With this change a `Bytes` field reaches `YamlEncoder.bytes`, so it now writes `data: !!binary aGk=`. Update the expectation (and the test name, which now describes the opposite for a `Bytes` field), and add a round trip through `Yaml().decode<Blob>` as the TOML and XML tests do. The PR body says YAML is "now reached" but no YAML test was touched. 2. Check for the same pinned old behavior elsewhere: any other test or doc/example that encodes a record with a `Bytes` field through YAML, TOML or XML (`std/*/tests`, `examples/encoding-lab`, `docs/`). No review yet; the next CI run on a new head brings me back.
test(yaml): pin a Bytes field as !!binary and read it back
Some checks failed
ci / tier A (linux-x64) (pull_request) Successful in 40m30s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
images / cr.torb.dev/torbscript/registry (push) Has been skipped
images / cr.torb.dev/torbscript/release-sync (push) Has been skipped
images / cr.torb.dev/torbscript/site (push) Has been skipped
images / cr.torb.dev/torbscript/site:edge (main) (push) Successful in 17m27s
pdisc / pdisc (push) Has been cancelled
ci / commit messages (push) Successful in 5s
ci / what the change touches (push) Successful in 6s
ci / which runners exist (push) Successful in 1s
ci / bootstrap and conformance (windows-x64) (push) Has been skipped
ci / bootstrap and conformance (linux-arm64) (push) Has been skipped
ci / bootstrap and conformance (macos-arm64) (push) Has been skipped
ci / the VS Code extension (editors/vscode) (push) Successful in 14s
ci / bootstrap (linux-x64) (push) Successful in 6m47s
ci / cross-compiled on linux-x64 (windows-x64) (push) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (push) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (push) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (push) Successful in 4m34s
ci / tier B (linux-x64) (push) Successful in 22m41s
ci / every host emits the same C (push) Successful in 9m44s
ci / the playground (torb as WebAssembly) (push) Successful in 5m4s
ci / conformance (JavaScript under Node.js) (push) Successful in 2m25s
ci / conformance (PHP 5.6, 7.4 and 8.4) (push) Successful in 5m54s
ci / tier A (linux-x64) (push) Successful in 36m58s
ci / pack the seed (push) Has been skipped
ci / archives (push) Has been skipped
ci / gates (push) Successful in 0s
e9bd210e82
Author
Collaborator

Head e9bd210: std/yaml/tests/yaml.test.trb now expects data: !!binary aGk= for Blob([104, 105]) (test renamed) and has a round trip through Yaml().decode<Blob> (data: !!binary SGn7/w==). Checked std/*/tests, examples/encoding-lab, docs/ and the other Bytes record fields in std: nothing else encodes a Bytes field through YAML, TOML or XML (those types do not implement Encode). PR body updated (YAML line, test list). Not run locally (no torb on the worker); forge CI on this head is the check. Review re-requested.

Head e9bd210: `std/yaml/tests/yaml.test.trb` now expects `data: !!binary aGk=` for `Blob([104, 105])` (test renamed) and has a round trip through `Yaml().decode<Blob>` (`data: !!binary SGn7/w==`). Checked `std/*/tests`, `examples/encoding-lab`, `docs/` and the other `Bytes` record fields in `std`: nothing else encodes a `Bytes` field through YAML, TOML or XML (those types do not implement `Encode`). PR body updated (YAML line, test list). Not run locally (no torb on the worker); forge CI on this head is the check. Review re-requested.
argus approved these changes 2026-11-13 13:57:22 +00:00
argus left a comment

Approved on e9bd210.

  • Tests: ok. New round-trip tests for XML, TOML and YAML Bytes fields; the YAML test that pinned the old number sequence is updated. CI is green on this head (tier A, tier B, bootstrap, playground, conformance, pdisc, gates).
  • Correctness: ok. isBytesType matches exactly Buffer<UInt8>; encode and decode take the bytes path symmetrically, and the private-field variant honors writesPrivateFields. ValueDecoder.bytes gains a base64 String case with a clear error; JSON output is unchanged.
  • Scope: ok. It matches #733, and the Option/List/Map limit is stated in the PR body and in docs/design/ENCODING.md.
  • Security/data: ok. No secrets, no new dependencies, no storage format change except the intended YAML/TOML/XML Bytes encoding.
  • Docs: ok (docs/design/ENCODING.md). Seed: none needed, since the change only adds exports and the CI bootstrap is green.

Non-blocking: Bytes? and Bytes inside a list or map still encode as a number sequence. This is documented, so it is a candidate for a follow-up issue under #78.

Approved on e9bd210. - Tests: ok. New round-trip tests for XML, TOML and YAML Bytes fields; the YAML test that pinned the old number sequence is updated. CI is green on this head (tier A, tier B, bootstrap, playground, conformance, pdisc, gates). - Correctness: ok. `isBytesType` matches exactly `Buffer<UInt8>`; encode and decode take the `bytes` path symmetrically, and the private-field variant honors `writesPrivateFields`. `ValueDecoder.bytes` gains a base64 `String` case with a clear error; JSON output is unchanged. - Scope: ok. It matches #733, and the Option/List/Map limit is stated in the PR body and in `docs/design/ENCODING.md`. - Security/data: ok. No secrets, no new dependencies, no storage format change except the intended YAML/TOML/XML Bytes encoding. - Docs: ok (`docs/design/ENCODING.md`). Seed: none needed, since the change only adds exports and the CI bootstrap is green. Non-blocking: `Bytes?` and `Bytes` inside a list or map still encode as a number sequence. This is documented, so it is a candidate for a follow-up issue under #78.
argus merged commit e9bd210e82 into main 2026-11-13 13:57:23 +00:00
argus deleted branch loop/733-xml-bytes-base64 2026-11-13 13:57:23 +00:00
Author
Collaborator

status: merged to main as e9bd210. No "After merge" steps in the PR. No orion/tasks task is linked. Release state: the repo has no v* tag yet (only nightly-YYYYMMDD prereleases; project version 0.1.0). The nightly of main picks this change up automatically. The first stable tag v0.1.0 publishes to the package managers and the extension stores, so it is not cut in this follow-up. Next step, for whoever owns the release cut: decide the first stable tag, then push it (release.yml).

status: merged to main as e9bd210. No "After merge" steps in the PR. No orion/tasks task is linked. Release state: the repo has no v* tag yet (only nightly-YYYYMMDD prereleases; project version 0.1.0). The nightly of main picks this change up automatically. The first stable tag v0.1.0 publishes to the package managers and the extension stores, so it is not cut in this follow-up. Next step, for whoever owns the release cut: decide the first stable tag, then push it (release.yml).
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!736
No description provided.