Skip to content

fix: prevent large contribution snapshots from exceeding argument limits - #23

Merged
peterOC26 merged 2 commits into
mainfrom
fm/fm-snapshot-contrib-argmax-c1
Sep 25, 2026
Merged

peterOC26 merged 2 commits into
mainfrom
fm/fm-snapshot-contrib-argmax-c1

Conversation

@peterOC26

@peterOC26 peterOC26 commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Intent

At session start Firstmate printed bin/fm-fleet-snapshot.sh: line 1986: /usr/bin/jq: Argument list too long. That is the same class of bug as commit c1969a1 ("route large snapshot JSON to jq via stdin instead of exec arguments"): Linux caps one exec argument at 128 KB, and a real backlog passed with --argjson aborts jq. c1969a1 fixed the other large call sites but missed this one. The ask is a small fix for that missed spot so the snapshot stops crashing.

What Changed

  • Pass backlog and task JSON to jq through stdin in --contribution-input mode, preventing large snapshots from exceeding the exec argument size limit.
  • Add regression coverage for a backlog exceeding 128 KiB, verifying all 500 records and the task ownership output are preserved.

Risk Assessment

✅ Low: A two-line change that reroutes one remaining large-JSON jq call through stdin using the exact pattern already established by c1969a1, preserves the output shape, adds no new components, and is covered by a behavioral regression test that would abort before the fix on Linux.

Testing

Reproduced the exact base-version error, then verified the fixed CLI preserves a 357 KB backlog and ownership data. Empty and ordinary inputs passed. Saved CLI output and transcript; temporary files were removed.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Snapshot a backlog exceeding 128 KiB and preserve every record and task ownership ✅ pass live transcript.txt: before-large and large; large.json
Snapshot ordinary backlog and PR ownership with unchanged JSON semantics ✅ pass live transcript.txt: small and before-small
Snapshot an empty home and receive valid empty backlog and tasks ✅ pass live transcript.txt: empty
Evidence: CLI reproduction and validation transcript

Source: CLI reproduction and validation transcript

empty: bash bin/fm-fleet-snapshot.sh --contribution-input; exit=0; stdout_bytes=207; stderr=''
small: bash bin/fm-fleet-snapshot.sh --contribution-input; exit=0; stdout_bytes=2594; stderr=''
before-small: bash bin/.snapshot-before-live.sh --contribution-input; exit=0; stdout_bytes=2594; stderr=''
before-large: bash bin/.snapshot-before-live.sh --contribution-input; exit=0; stdout_bytes=0; stderr='~/.no-mistakes/worktrees/7f0ec18181b6/01M3AW9WA03WFB8Z3P57KX132C/bin/.snapshot-before-live.sh: line 1986: /usr/bin/jq: Argument list too long'
large: bash bin/fm-fleet-snapshot.sh --contribution-input; exit=0; stdout_bytes=550870; stderr=''
Large snapshot: backlog JSON 357111 bytes (>131072); all 500 ordered records and PR ownership preserved.
Empty snapshot contract and small snapshot semantic equality with base verified; oversized backlog reproduces base error and succeeds on target.
Evidence: Large backlog snapshot output

Source: Large backlog snapshot output

{
  "backlog": {
    "path": "~/.no-mistakes/worktrees/7f0ec18181b6/01M3AW9WA03WFB8Z3P57KX132C/.snapshot-live-qp483pjo/data/backlog.md",
    "present": true,
    "records": [
      {
        "order": 1,
        "state": "queued",
        "structured": true,
        "id": "queued-1",
        "checked": false,
        "title": "Queued contribution 1",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-1 - Queued contribution 1 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 2,
        "state": "queued",
        "structured": true,
        "id": "queued-2",
        "checked": false,
        "title": "Queued contribution 2",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-2 - Queued contribution 2 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 3,
        "state": "queued",
        "structured": true,
        "id": "queued-3",
        "checked": false,
        "title": "Queued contribution 3",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-3 - Queued contribution 3 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 4,
        "state": "queued",
        "structured": true,
        "id": "queued-4",
        "checked": false,
        "title": "Queued contribution 4",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-4 - Queued contribution 4 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 5,
        "state": "queued",
        "structured": true,
        "id": "queued-5",
        "checked": false,
        "title": "Queued contribution 5",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-5 - Queued contribution 5 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 6,
        "state": "queued",
        "structured": true,
        "id": "queued-6",
        "checked": false,
        "title": "Queued contribution 6",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-6 - Queued contribution 6 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 7,
        "state": "queued",
        "structured": true,
        "id": "queued-7",
        "checked": false,
        "title": "Queued contribution 7",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-7 - Queued contribution 7 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 8,
        "state": "queued",
        "structured": true,
        "id": "queued-8",
        "checked": false,
        "title": "Queued contribution 8",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
 

... [534486 bytes truncated] ...

],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 494,
        "state": "queued",
        "structured": true,
        "id": "queued-494",
        "checked": false,
        "title": "Queued contribution 494",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-494 - Queued contribution 494 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 495,
        "state": "queued",
        "structured": true,
        "id": "queued-495",
        "checked": false,
        "title": "Queued contribution 495",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-495 - Queued contribution 495 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 496,
        "state": "queued",
        "structured": true,
        "id": "queued-496",
        "checked": false,
        "title": "Queued contribution 496",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-496 - Queued contribution 496 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 497,
        "state": "queued",
        "structured": true,
        "id": "queued-497",
        "checked": false,
        "title": "Queued contribution 497",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-497 - Queued contribution 497 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 498,
        "state": "queued",
        "structured": true,
        "id": "queued-498",
        "checked": false,
        "title": "Queued contribution 498",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-498 - Queued contribution 498 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 499,
        "state": "queued",
        "structured": true,
        "id": "queued-499",
        "checked": false,
        "title": "Queued contribution 499",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-499 - Queued contribution 499 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      },
      {
        "order": 500,
        "state": "queued",
        "structured": true,
        "id": "queued-500",
        "checked": false,
        "title": "Queued contribution 500",
        "repo": "sample",
        "kind": "ship",
        "priority": null,
        "hold_reason": null,
        "hold_kind": null,
        "hold_until": null,
        "hold_set": null,
        "blocked_by": null,
        "blocked_by_ids": [],
        "blocked_reason": null,
        "since": null,
        "merged": null,
        "reported": null,
        "done": null,
        "completion": {
          "verb": null,
          "date": null
        },
        "links": [],
        "pr_url": null,
        "report_path": null,
        "local_note": null,
        "raw": "- [ ] queued-500 - Queued contribution 500 (repo: sample) (kind: ship)",
        "body_lines": [],
        "body_excerpt": null,
        "unresolved_blocker_ids": [],
        "current_role": "queued",
        "requires_child_metadata": false,
        "hold_age_days": null,
        "hold_bucket": null,
        "captain_actionable": false
      }
    ]
  },
  "tasks": [
    {
      "id": "owned",
      "kind": "ship",
      "pr": {
        "url": "https://github.com/example/repo/pull/42",
        "head": "abc123"
      },
      "merge_authority": "attended"
    }
  ]
}

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Snapshot a backlog exceeding 128 KiB and preserve every record and task ownership ✅ pass live transcript.txt: before-large and large; large.json
Snapshot ordinary backlog and PR ownership with unchanged JSON semantics ✅ pass live transcript.txt: small and before-small
Snapshot an empty home and receive valid empty backlog and tasks ✅ pass live transcript.txt: empty
  • python3 ~/.no-mistakes/evidence/01M3AW9WA03WFB8Z3P57KX132C/drive.py — executes base and target snapshot commands in an isolated home
  • bash bin/fm-fleet-snapshot.sh --contribution-input — empty, ordinary, and 500-record backlog scenarios
  • git status --short — clean after cleanup
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

peterOC26 added 2 commits September 25, 2026 01:33
…c from 71 to 72 in .github/workflows/ci.yml. The corrected workflow block passed locally with all 72 tests; git diff --check passed. Local verification used Bash 5.2; the supplied macOS log confirms all 72 tests passed under Bash 3.2
@peterOC26
peterOC26 merged commit 0fd6aef into main Sep 25, 2026
19 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.

1 participant