Skip to content

Keep the first decode error in sandboxwire.Decoder - #454

Merged
SaladDay merged 1 commit into
feature/agent-outside-sandboxfrom
aos/b4-decoders
Oct 6, 2026
Merged

SaladDay merged 1 commit into
feature/agent-outside-sandboxfrom
aos/b4-decoders

Conversation

@SaladDay

@SaladDay SaladDay commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

B4 simplicity audit, lane L1, PR b. There is no wire change, and every golden fixture is byte-identical. Net −215 production lines and −92 test lines.

  • One decoder. sandboxwire.Decoder now keeps the first error: later reads return zero values, and Err/Finish return that first error. The primitives return values only.
    • Deleted: the four per-protocol reader adapters in sandboxfs, sandboxprocess, sandboxlink and sandboxnet, which each re-implemented this, and Decoder.Remaining, whose only user was a test.
    • Kept local: protocol enum checks, bounded counts and Link's Hello version handling.
    • processshim/ipc.go decodes the same way. Its error texts and validation order are unchanged.
  • One fixture reader. The stdlib-only package internal/sandboxwire/sandboxwiretest (ReadHex) replaces six copies of the annotated-hex reader.

Testing:

  • During development, the old and new decoders were fuzzed against each other for 90 s per protocol, about 39–133 M executions each, covering Link, Network, Process, File and the three shim decoders. Errors, their classification and the decoded messages were identical.
  • All decode tests and fuzz seeds, plus each fuzz target for 15 s.
  • The tests of every importing package, after the rebase onto Correlate Link handshake replies #453.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

sandboxwire.Decoder now keeps its first error: every later read returns
the zero value, Fail records a protocol's own rule unless an error is
already recorded, and Err and Finish return that first error. The File,
Process, Link and Network decoders lose their private adapters that
added the same rule, and the process shim's IPC decoders read in the
same style. Protocol enum checks, bounded counts, Link's Hello version
handling and the shim's error texts stay where they were; malformed
input fails with the same errors and every golden fixture is unchanged.

The six copies of the hex fixture reader become
sandboxwiretest.ReadHex.
@SaladDay
SaladDay merged commit 72a62b6 into feature/agent-outside-sandbox Oct 6, 2026
20 checks passed
@SaladDay
SaladDay deleted the aos/b4-decoders branch October 6, 2026 23:54
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