runner: bundle package — metadata.json and provenance writers - #24
Conversation
|
e438215 to
c676e49
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a new runner/internal/bundle package responsible for writing and reading the bundle-root manifest (metadata.json), generating free-text provenance files (binary.txt, machine-metadata.txt), and validating integrity constraints required to safely --resume a prior campaign. It also adds golden/contract tests to pin the exact manifest bytes consumed cross-repo by converter/convert.py.
Changes:
- Add
metadata.jsonwriter + schema/quirks tests (golden bytes, bash-compat fields). - Add provenance writers for
binary.txtandmachine-metadata.txt, including a native GoO_SYNCfsync probe. - Add
--resumevalidation that ties resumption to manifest identity + stored config byte equality (withdiff -uoutput on mismatch).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| runner/internal/bundle/bundle.go | Reads metadata.json and enforces --resume integrity checks. |
| runner/internal/bundle/bundle_test.go | Tests resume validation, including bash-era manifest compatibility and refusal cases. |
| runner/internal/bundle/metadata.go | Implements metadata.json schema, deterministic marshaling, and best-effort hardware collection (IMDSv2 + local facts). |
| runner/internal/bundle/metadata_test.go | Golden/contract tests for manifest bytes and bash-era quirks; tests IMDSv2 behavior. |
| runner/internal/bundle/provenance.go | Writes binary.txt and machine-metadata.txt provenance; includes fsync probe and version capture. |
| runner/internal/bundle/provenance_test.go | Tests provenance file writing behavior and best-effort expectations. |
| runner/internal/bundle/testdata/campaign.toml | Golden-test campaign config used to drive pinned manifest output. |
| runner/internal/bundle/testdata/metadata.golden.json | Pinned metadata.json bytes (ordering and field shapes included). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c676e49 to
e99dbce
Compare
b0d88d4 to
7ba20dd
Compare
7ba20dd to
643d8b6
Compare
Writes the bundle's own record: metadata.json (crash-safe, written up front and rewritten at the end), binary.txt, and machine-metadata.txt. Resume reads metadata identity back and enforces the config-diff guard.
643d8b6 to
f1ef0dc
Compare
|
@claude[agent] review |
Reviewed the current state at f1ef0dc. The three earlier threads are resolved: the reRunID NAME capture is discarded (results dir is rebuilt by plan.Build and run.go requires an exact match), and both fact-gathering commands and binaryVersion are bounded by factTimeout. |
This PR adds
runner/internal/bundle, the package that owns the bundle root's own record. It writesmetadata.json, the cross-repo manifest the converter reads, plus the two free-text provenance files. It also holds the checks a--resumemust pass before any step of a resumed campaign runs. Layer 1 documents this manifest schema inSCHEMA.md.What is in this PR
metadata.go). The runner writesmetadata.jsontwice per campaign: up front withstatus: "running"and nofinished_at, then again at the end withfinished_atand"finished"or"failed". A killed campaign still leaves a parseable bundle.campaign.resumedappears only on resumed bundles.testdata/metadata.golden.json,testdata/campaign.toml) pins the exact manifest bytes, field order included. It covers the bash-era quirks the contract keeps:"yes"/"no"for query, the comma-string concurrency, and hardware facts that vanish when empty.CollectHardware). IMDSv2 gives the EC2 instance type and id, with a 2 s timeout so an off-EC2 machine does not stall. Every fact is best-effort.provenance.go) writebinary.txtandmachine-metadata.txt.machine-metadata.txtends with a native GoO_SYNCdisk probe.bundle.go).ValidateResumerefuses a bundle unless the campaign name, the built commit, theBENCH_ROOTpath, and the stored config all match. The config guard compares bytes and printsdiff -uon a mismatch.Review focus
converter/convert.py. Check each field againstSCHEMA.md.checkStoredConfigreadsconfig_filefrom a file that travels with the bundle. It rejects any value that is not a bundle-root basename.metadata.json, never from the directory basename, so a copied bundle cannot pass as another campaign.Verification
make runner-testruns the same gate. CI runs it as.github/workflows/runner-go.yml.Stack: part 5 of 8 · base
runner-04-execute· replaces a slice of #16