Skip to content

lang04: carry the crate graph as JSON, not as a clipped log line - #15

Merged
hongdy22 merged 1 commit into
mainfrom
fix/lang04-metadata-transport
Sep 14, 2026
Merged

hongdy22 merged 1 commit into
mainfrom
fix/lang04-metadata-transport

Conversation

@hongdy22

Copy link
Copy Markdown
Collaborator

Fixes #14.

Result.brief() clips output to 4000 characters because it writes a log a person reads. cargo metadata for this workspace is larger than that, so the copy that crossed the process boundary was a head, an elision marker and a tail. json.loads raised, IntegrityAuditor.metadata() swallowed it and returned {}, and the three gates that read the crate graph fail closed — so a command that had succeeded was reported as workspace-members and crate-versions failing.

What changed

  • The document travels as BuildOutcome.metadata_json, beside the clipped result rather than inside it. brief() is unchanged: it is still the log.
  • metadata_problem() gives the three gates a detail that distinguishes a command that failed from a capture this verifier mangled. The old wording — "did not run or did not parse" — could not tell anyone which, and the second case is our defect, not a finding about a submission.

Regression — infra/tests/test_lang04_metadata_transport.py, 7 checks, runs from the repository root with no cargo, no container and no submission:

  • the document survives at 2 crates and at 40;
  • one test asserts the 40-crate case really is past the clip, so this cannot pass by never exercising the truncation;
  • a failed command, a wrong crate version and an unparseable capture each still fail, with distinct details.

Fails on main (5 of 7).

`Result.brief()` clips long output to 4000 characters, which is the right
shape for a log a person reads and the wrong shape for a document a later
module parses.  `cargo metadata` for this workspace is around 5 KB, so the
copy that crossed the process boundary was a head, an elision marker and a
tail; `json.loads` raised on it, the auditor's `metadata()` swallowed the
error and returned `{}`, and the three gates that read the crate graph fail
closed.  A submission whose `cargo metadata` had succeeded was told that
`workspace-members` and `crate-versions` had failed.

The document now travels as `BuildOutcome.metadata_json`, beside the clipped
result rather than inside it.  `brief()` is unchanged: it is still the log.

`metadata_problem()` gives the three gates a detail that says which of the
two things happened, because a capture this verifier mangled is a defect
here and not a finding about the submission -- the old wording, "did not run
or did not parse", could not tell anyone which.
@hongdy22
hongdy22 force-pushed the fix/lang04-metadata-transport branch from 06e8560 to f62a1b6 Compare September 14, 2026 06:19
@hongdy22
hongdy22 merged commit d3dffeb into main Sep 14, 2026
5 checks passed
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.

lang04: Truncated cargo metadata JSON breaks cross-module structural checks

1 participant