PYR0D-351: Pass the contribution-input backlog to jq as files, not arguments #40

Merged
john merged 2 commits from fm/fm-snapshot-argv-limit into main 2026-10-01 01:19:18 +00:00
Owner

Story: PYR0D-351 - Firstmate: session-start fleet snapshot fails with "Argument list too long" on a large backlog

What was wrong

bin/fm-fleet-snapshot.sh --contribution-input handed the whole backlog JSON to jq as a command-line argument (jq -n --argjson backlog "$BACKLOG_JSON" ...). On this home's backlog that one argument is far past the kernel's 128 KiB single-argument limit, so jq never ran: line 1994: /usr/bin/jq: Argument list too long. The error printed at the top of every session-start summary since the upgrade, and the contribution check got no input.

What changed

  • The contribution-input branch now writes the backlog and task JSON to files in the script's existing temporary transport directory and reads them with --slurpfile, the same pattern the full snapshot path already uses a few lines below. The existing EXIT trap removes the directory.
  • The task list moves the same way, since it grows with the fleet.
  • New regression test test_contribution_input_survives_oversized_backlog in tests/fm-contributions.test.sh builds an 800-record synthetic backlog whose JSON exceeds 128 KiB, and checks every record and the task list survive. It fails against the old code.

Evidence

  • no-mistakes pipeline: review, test, document and lint passed; push done. Its PR step does not support this Forgejo remote, so this PR was opened by hand.
  • On this home's real backlog, the fixed script exits 0 with 830,156 bytes of JSON; main still fails with the error above. No temporary directory is left behind.
  • bin/fm-lint.sh (ShellCheck, actionlint) clean; all 45 contribution tests pass.

Out of scope

No other snapshot or startup behaviour changes.

**Story:** PYR0D-351 - Firstmate: session-start fleet snapshot fails with "Argument list too long" on a large backlog ## What was wrong `bin/fm-fleet-snapshot.sh --contribution-input` handed the whole backlog JSON to jq as a command-line argument (`jq -n --argjson backlog "$BACKLOG_JSON" ...`). On this home's backlog that one argument is far past the kernel's 128 KiB single-argument limit, so jq never ran: `line 1994: /usr/bin/jq: Argument list too long`. The error printed at the top of every session-start summary since the upgrade, and the contribution check got no input. ## What changed - The contribution-input branch now writes the backlog and task JSON to files in the script's existing temporary transport directory and reads them with `--slurpfile`, the same pattern the full snapshot path already uses a few lines below. The existing EXIT trap removes the directory. - The task list moves the same way, since it grows with the fleet. - New regression test `test_contribution_input_survives_oversized_backlog` in `tests/fm-contributions.test.sh` builds an 800-record synthetic backlog whose JSON exceeds 128 KiB, and checks every record and the task list survive. It fails against the old code. ## Evidence - no-mistakes pipeline: review, test, document and lint passed; push done. Its PR step does not support this Forgejo remote, so this PR was opened by hand. - On this home's real backlog, the fixed script exits 0 with 830,156 bytes of JSON; main still fails with the error above. No temporary directory is left behind. - `bin/fm-lint.sh` (ShellCheck, actionlint) clean; all 45 contribution tests pass. ## Out of scope No other snapshot or startup behaviour changes.
PYR0D-351: Pass the contribution-input backlog to jq as files, not arguments
Some checks failed
CI / Test coverage guard (pull_request) Has been cancelled
CI / Behavior portable parallel 1 (pull_request) Has been cancelled
CI / Behavior portable parallel 2 (pull_request) Has been cancelled
CI / Behavior portable serial 1 (pull_request) Has been cancelled
CI / Behavior portable serial 2 (pull_request) Has been cancelled
CI / Behavior portable serial 3 (pull_request) Has been cancelled
CI / Behavior portable serial 4 (pull_request) Has been cancelled
CI / Behavior portable serial 5 (pull_request) Has been cancelled
CI / Behavior portable serial 6 (pull_request) Has been cancelled
CI / Behavior portable serial 7 (pull_request) Has been cancelled
CI / Behavior portable serial 8 (pull_request) Has been cancelled
CI / Behavior portable serial 9 (pull_request) Has been cancelled
CI / Behavior tests (Herdr) (pull_request) Has been cancelled
CI / Repo invariants (pull_request) Has been cancelled
CI / Lint 1 (pull_request) Has been cancelled
CI / Lint 2 (pull_request) Has been cancelled
58c5f7d99b
PYR0D-351: Fail the contribution input loudly when jq assembly fails
All checks were successful
CI / Test coverage guard (pull_request) Successful in 30s
CI / Lint 2 (pull_request) Successful in 23m47s
CI / Lint 1 (pull_request) Successful in 26m17s
CI / Behavior portable parallel 2 (pull_request) Successful in 15m24s
CI / Behavior portable parallel 1 (pull_request) Successful in 17m26s
CI / Behavior portable serial 2 (pull_request) Successful in 15m49s
CI / Behavior portable serial 3 (pull_request) Successful in 16m53s
CI / Behavior portable serial 6 (pull_request) Successful in 15m52s
CI / Behavior portable serial 7 (pull_request) Successful in 16m19s
CI / Repo invariants (pull_request) Successful in 7s
CI / Behavior portable serial 4 (pull_request) Successful in 14m23s
CI / Behavior portable serial 1 (pull_request) Successful in 20m16s
CI / Behavior portable serial 8 (pull_request) Successful in 16m4s
CI / Behavior portable serial 5 (pull_request) Successful in 26m26s
CI / Behavior tests (Herdr) (pull_request) Successful in 13m3s
CI / Behavior portable serial 9 (pull_request) Successful in 24m1s
c109d2ecf3
john merged commit a98c865717 into main 2026-10-01 01:19:18 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
john/firstmate!40
No description provided.