Skip to content

test(bearings): pin snapshot against argv-size overflow with a large-backlog regression - #7392

Open
ardydedase wants to merge 2 commits into
kunchenguid:mainfrom
ardydedase:ardy/fm-bearings-snapshot-argmax
Open

ardydedase wants to merge 2 commits into
kunchenguid:mainfrom
ardydedase:ardy/fm-bearings-snapshot-argmax

Conversation

@ardydedase

@ardydedase ardydedase commented Oct 16, 2026 •

Copy link
Copy Markdown

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

  • Added test_large_backlog_survives_main_inventory_transport to tests/fm-bearings-snapshot.test.sh: a synthetic 120-row backlog sized above the ~128 KiB Linux MAX_ARG_STRLEN per-argument cap drives 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 jq argv 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 --slurpfile and stdin; the observed reproduction came from a stale checkout 466 commits behind the default branch, not live default-branch code.
  • Bumped the expected Bearings test count from 60 to 61 in .github/workflows/ci.yml to match the new regression test.
  • No other scripts touched: the emitted JSON shape and field semantics are unchanged, so this is a mechanical pin against regression rather than a behavior change.

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 passed

ok - a backlog sized above argv limits keeps a valid main inventory source
DONE: argv-limit test passed
Evidence: 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 limit

/home/ardydedase/.no-mistakes/worktrees/f93ad173517b/01M528N4KTEE9SB8CY7FKHD2Z3/bin/fm-fleet-snapshot.sh: line 943: /home/ardydedase/.local/bin/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 limit

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 infos
  • ℹ️ 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 regressed
  • git 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.

Copy link
Copy Markdown
Owner

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 .github/workflows/ci.yml.

Contract-class: restore. Production path already file-backs via --slurpfile; this only pins that the large-backlog inventory stays valid and fails loudly if argv transport returns. No new bearings surface.

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 head_sha is 83efb2ae, but the PR tip is ed4a7065 (MISMATCH). Please re-push through git push no-mistakes so the attestation binds the current head, then we can auto-merge as restore once CI is green.

CI: approved fork runs CI 38865946002 + Require no-mistakes 38865946054 (expect no-mistakes to fail until the attestation matches). Outcome: waiting-author.

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.
@ardydedase
ardydedase force-pushed the ardy/fm-bearings-snapshot-argmax branch from ed4a706 to 5c35199 Compare October 16, 2026 12:01
@ardydedase ardydedase changed the title test: pin bearings snapshot against backlogs above argv limits test(bearings): pin snapshot against argv-size overflow with a large-backlog regression Oct 16, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @ardydedase — the re-push through no-mistakes did it: the attestation now matches head 5c351997.

I reviewed the new head against main 5f2b81bc. It is still the test-only pin: the 120-row backlog regression test in tests/fm-bearings-snapshot.test.sh above the argv limit, plus the expected Bearings count bump from 60 to 61 in .github/workflows/ci.yml. No production script changed. Since nothing risky is in it, I approved the pending first-time-fork runs (CI 38897679661, Require no-mistakes 38897679830 and 38897716782).

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.

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.

2 participants