Repository navigation
test(bearings): pin snapshot against argv-size overflow with a large-backlog regression - #7392
ardydedase wants to merge 2 commits into
Conversation
|
Speaking as Kun's firstmate: thanks @ardydedase — clean regression pin for the file-backed fleet/bearings snapshot transport (#3677), with a 120-row backlog above the ~128 KiB argv cap and the expected Bearings count bump 60→61 in Contract-class: restore. Production path already file-backs via VISION.md, rule by rule: One captain (aligns — bearings keep a bounded source). Authority / restart / scripts / delegation / vendor / scope: all align for a mechanical test pin. Blocking (on you): Require no-mistakes attestation CI: approved fork runs CI |
The main snapshot path files the whole backlog and task documents past jq through temp files; when they still rode --argjson argv elements a backlog above Linux MAX_ARG_STRLEN (~128 KiB) killed the main inventory summary and left the bearings board with no bounded source. Exercise the canonical fleet snapshot and the bearings wrapper against a 120-row backlog sized above that cap, so reintroducing argv transport on this path fails loudly.
ed4a706 to
5c35199
Compare
|
Speaking as Kun's firstmate: thanks @ardydedase — the re-push through no-mistakes did it: the attestation now matches head I reviewed the new head against main Contract-class stays restore (no change to the unconfigured run; this pins the file-backed transport from #3677), and every VISION rule still aligns. Nothing is needed from you while CI runs. |
Intent
Pin the bearings/fleet-snapshot file-backed jq transports against argument-size overflow with a regression test, with no other behavior changes. Background: bin/fm-fleet-snapshot.sh's main_inventory_json once passed the full backlog and tasks JSON through jq --argjson shell arguments; with the current ~41-task backlog that overflowed the ~128 KiB Linux MAX_ARG_STRLEN cap, so the main inventory summary died with 'jq: Argument list too long' and the bearings board had no bounded source. The crash itself was already fixed upstream by PR #3677 (commit 31cba0d), which file-backs the backlog and tasks documents through temp files via --slurpfile and pipes the bearings projection through stdin; the observed reproduction came from a stale primary checkout 466 commits behind the default branch, not live default-branch code. Verified bin/fm-bearings-snapshot.sh --json completes with a valid main inventory against the real backlog on this home. This change adds a regression test in tests/fm-bearings-snapshot.test.sh sized above the observed payload: a synthetic backlog of 120 inventory rows above the 128 KiB per-argument argv cap, driving both bin/fm-fleet-snapshot.sh --json (asserting a valid main_inventory) and bin/fm-bearings-snapshot.sh --json (asserting the fm-bearings.v1 schema, gate rows present, and no (main-inventory) gate), so reintroducing argv transport on this path fails loudly. Mechanical pin only, not a redesign; the emitted JSON shape and field semantics are unchanged and no other script is touched. Acceptance: existing fm-fleet-snapshot and fm-bearings-snapshot tests keep passing under bin/fm-test-run.sh (verified locally: full bearings suite plus fm-fleet-snapshot-view and fm-home-summary-refresh, and bin/fm-lint.sh clean). Firstmate constraints: commits authored Ardy Dedase ardy.dedase@gmail.com; PR body short bullets, no emojis, noting the upstream-fix attribution (PR #3677) and the stale-checkout observation; never merge the PR.
What Changed
test_large_backlog_survives_main_inventory_transportto tests/fm-bearings-snapshot.test.sh: a synthetic 120-row backlog sized above the ~128 KiB Linux MAX_ARG_STRLEN per-argument cap drivesbin/fm-fleet-snapshot.sh --json(asserting a validmain_inventory) andbin/fm-bearings-snapshot.sh --json(asserting thefm-bearings.v1schema, gate rows present, and no(main-inventory)gate), so reintroducingjqargv transport (--argjson) on this path fails loudly. The crash itself was already fixed upstream by PR fix(bin): avoid fleet snapshot argument limits #3677 (commit 31cba0d), which file-backs the backlog and tasks documents via--slurpfileand stdin; the observed reproduction came from a stale checkout 466 commits behind the default branch, not live default-branch code.Risk Assessment
✅ Low: The change is a well-bounded regression test plus a mechanically required CI count bump; its assertions match the code's actual observable behavior, the transport fix it pins is present in base, and only two informational notes emerged.
Testing
Ran the smallest relevant suites: the full 61-test fm-bearings-snapshot suite and the fm-fleet-snapshot-view/fm-home-summary-refresh suites all pass; then demonstrated the regression test's teeth by temporarily reintroducing argv transport in bin/fm-fleet-snapshot.sh, watching the new test fail loudly with the documented 'Argument list too long' error, and restoring the shipped file-backed transport to see it pass — with both transcripts saved as evidence and the worktree left clean.
Evidence: Regression test passes on shipped file-backed transport (targeted run of test_large_backlog_survives_main_inventory_transport)
Source: Regression test passes on shipped file-backed transport (targeted run of test_large_backlog_survives_main_inventory_transport)
ok - a backlog sized above argv limits keeps a valid main inventory source DONE: argv-limit test passedEvidence: Same test fails loudly under simulated argv transport regression (main_inventory_json reverted to --argjson)
Source: Same test fails loudly under simulated argv transport regression (main_inventory_json reverted to --argjson)
bin/fm-fleet-snapshot.sh: line 943: jq: Argument list too long fm-fleet-snapshot: main inventory summary failed not ok - fleet snapshot died for a backlog above the per-argument exec limitPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
tests/fm-bearings-snapshot.test.sh:2301- The >131072-byte size guard only forces an exec failure on Linux (MAX_ARG_STRLEN = 131072); on macOS the same fixture stays comfortably under the per-argument limit, so a reintroduced argv transport would still pass under bin/fm-test-run.sh or the macos-stock-bash CI job. The Linux CI jobs are the loud guard, which matches the intent ('fails loudly' on CI), so this is an inherent platform limitation, not a defect. The test otherwise executes both public interfaces end-to-end and asserts observable JSON, satisfying the behavior-test rule..github/workflows/ci.yml:472- The intent says 'no other script is touched', and this change also bumps the workflow's expected Bearings test count from 60 to 61. I verified this is a mechanically required update of a machine-consumed count guard (the suite now emits exactly 61 'ok - ' lines), not a behavior change: no bin/ script is modified, no product JSON shape or field semantics changed. Flagging for transparency only.✅ **Test** - passed
✅ No issues found.
./bin/fm-test-run.sh tests/fm-bearings-snapshot.test.sh (full suite, exit 0; 61 ok lines including 'ok - a backlog sized above argv limits keeps a valid main inventory source', matching the CI expected-count bump from 60 to 61)./bin/fm-test-run.sh tests/fm-fleet-snapshot-view.test.sh tests/fm-home-summary-refresh.test.sh (exit 0)Controlled regression check: temporarily reverted bin/fm-fleet-snapshot.sh main_inventory_json to argv (--argjson "$(cat ...)") transport, ran a /tmp driver executing only test_large_backlog_survives_main_inventory_transport with the suite's real helpers — the test failed loudly with 'jq: Argument list too long' and 'not ok - fleet snapshot died for a backlog above the per-argument exec limit' (exit 1)Restored bin/fm-fleet-snapshot.sh via git checkout and re-ran the same targeted test — 'ok - a backlog sized above argv limits keeps a valid main inventory source' (exit 0); fixed-side failure-mode evidence also captured via the full suite (exit 1) while regressedgit status --porcelain — worktree clean, no transient test artifacts left behind✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.