Skip to content

fix: prevent duplicate portable serial shard assignments - #50

Merged
MrGTV-love merged 2 commits into
mainfrom
fm/fm-test-run-shard-guard-dup
Oct 8, 2026
Merged

MrGTV-love merged 2 commits into
mainfrom
fm/fm-test-run-shard-guard-dup

Conversation

@MrGTV-love

Copy link
Copy Markdown
Owner

Intent

Red CI: diagnose and fix. Never waive or merge around red; is the code bad or the test bad? Fix it.
Timeouts and harness issues get a root cause and a root fix, assessed as a system: fix without breaking, fix once.

Context: firstmate pull request 22 adds 6 test scripts and now fails the test runner's coverage guard (bin/fm-test-run.sh --check-coverage) with 'portable serial shards share scripts', so CI's portable lane would fail. That pull request is not the cause: origin/main plus 5 dummy test scripts fails the same way, and removing any one of that pull request's 6 scripts makes it pass. Standalone shard lists show 0 duplicates, but inside the guard 11 scripts land in shard 9 twice. The finding is that the guard's shard assignment double-assigns scripts at some script counts.

What Changed

  • Replace per-script process-substitution reads with whole-line membership checks and an awk-based assignment pipeline to avoid Bash 3.2 corruption while preserving deterministic, duration-weighted serial sharding.
  • Propagate assignment-generation failures and reject failed shard selection before publishing partial script lists.
  • Add regressions for five, six, and twenty extra scripts, successful coverage checks, producer failures, and genuine duplicate rejection; document the complete-output guarantee.

Risk Assessment

✅ Low: The change removes per-script process-substitution membership and weight lookups while preserving exact membership, deterministic shard packing, and existing coverage refusals, with executable-interface regression coverage for larger inventories and genuine duplicates.

Testing

Exercised the real runner CLI, five focused contracts, adversarial producer and duplicate faults, execution receipts, timing JSON, concurrency admission, and scheduling. All nine live scenarios passed. Initial broader/stress attempts hit local driver bounds; focused contracts and deadline-corrected replays completed successfully without changing product limits or guards. CLI and persisted-state evidence was saved, and all worktree fixtures were removed.

  • Live validation: ✅ go - 9 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Inspect the current inventory and obtain complete, disjoint lane coverage ✅ pass live runner-baseline.txt: coverage guard exited 0; the complete lane union covered all 257 scripts and nine serial shards covered exactly 215 scripts.
Add five, six, or twenty tests and obtain deterministic serial shards without duplicates or omissions ✅ pass live runner-boundary-replay.json: two complete partitions per boundary covered exactly 220, 221, and 235 serial scripts with identical assignments between repetitions.
Accept valid shard coverage while preserving the measured-duration hint guard ✅ pass live runner-boundary-replay.json: fixtures within the hint budget passed with five and six added scripts; full inventories above the existing 15% budget refused specifically for missing hints, not shard du…
Fail assignment generation without publishing or executing a partial shard ✅ pass live runner-cli-evidence.log: injected inventory-sort and assignment-sort failures made both listing and execution exit 2 with empty stdout and the complete-assignment refusal.
Reject a genuine duplicate lane assignment and identify the offending script ✅ pass live runner-cli-evidence.log: duplicate membership injected into a disposable lane inventory caused exit 1 and named tests/fm-pr-merge.test.sh.
Execute every selected serial-shard script exactly once and report a consumer failure ✅ pass live runner-cli-evidence.log and serial-shard-timing.json: 26 execution receipts matched the selected shard exactly; an injected script exit 7 produced a failed summary while the remaining scripts still ra…
Refuse invalid shard coordinates and concurrent execution inside a serial shard ✅ pass live runner-cli-evidence.log: 0of9, 10of9, 1of8, and --jobs 2 on a serial shard all exited 2 before execution.
Admit exact proven concurrency members without granting concurrency to unknown or colliding external scripts ✅ pass live runner-cli-evidence.log: persisted traces showed both admitted scripts starting before either finished; unknown and external-name-colliding scripts were refused, while the unknown script ran successfu…
Preserve weighted scheduled-list ordering and deterministic path ties ✅ pass live runner-cli-evidence.log: explicit script scheduling matched the existing weighted order, and proven-isolated scheduling matched the path-sorted member list.
Evidence: Real CLI outputs, execution traces, refusals, and final guard results

Source: Real CLI outputs, execution traces, refusals, and final guard results

Real CLI evidence for fault injection, serial execution, and concurrency admission.
Disposable test payloads exercise the actual runner; no live fleet/harness lifecycle was invoked.
Earlier boundary checks reached a driver-only deadline; their final replay is recorded separately in runner-boundary-replay.json.

$ /bin/bash ~/.no-mistakes/worktrees/32d18ed9638d/01M4D9CQYPTA4EJQH814DXT6AT/.fm-runner-live-vbd8ner6/duplicate-guard/bin/fm-test-run.sh --check-coverage
exit=1

stderr:
fm-test-run: coverage guard: portable parallel shards share scripts:
tests/fm-pr-merge.test.sh

$ /bin/bash ~/.no-mistakes/worktrees/32d18ed9638d/01M4D9CQYPTA4EJQH814DXT6AT/.fm-runner-live-vbd8ner6/boundaries/bin/fm-test-run.sh --check-coverage
exit=1

stderr:
fm-test-run: coverage guard: 36 of 220 portable serial scripts have no measured duration hint (max 15%)
fm-test-run: refresh the hints from a green run's timing artifacts: docs/fm-test-portable-shards.md
tests/fm-calm-pi-queue-retention-live-e2e.test.sh
tests/fm-claude-titled-composer-live-e2e.test.sh
tests/fm-devin-harness.test.sh
tests/fm-devin-signals-live-e2e.test.sh
tests/fm-fleet-ledger.test.sh
tests/fm-fork-free-helpers.test.sh
tests/fm-git-strip-ai-trailers.test.sh
tests/fm-host-mirror-live-e2e.test.sh
tests/fm-host-mirror.test.sh
tests/fm-inbox.test.sh
tests/fm-jev-guardrail-home.test.sh
tests/fm-jev-guardrail.test.sh
tests/fm-launch-prompt-signals-live-e2e.test.sh
tests/fm-mem-guard.test.sh
tests/fm-model-index-live-e2e.test.sh
tests/fm-model-index.test.sh
tests/fm-omp-composer-box-live-e2e.test.sh
tests/fm-omp-jev-pipeline.test.sh
tests/fm-remote-secondmate-relaunch.test.sh
tests/fm-session-end-relaunch.test.sh
tests/fm-skill-suggest.test.sh
tests/fm-spawn-acquisition-cleanup.test.sh
tests/fm-spawn-claude-api-key-guard.test.sh
tests/fm-spawn-compact-adviser-disable-remote.test.sh
tests/fm-spawn-compact-adviser-disable.test.sh
tests/fm-spawn-orca-worktree.test.sh
tests/fm-supervision-host-attended-live-e2e.test.sh
tests/fm-teamclaude-launch-live-e2e.test.sh
tests/fm-teamclaude-launch.test.sh
tests/fm-worker-account-live-e2e.test.sh
tests/fm-worker-account.test.sh
tests/zz-shard-dummy-1.test.sh
tests/zz-shard-dummy-2.test.sh
tests/zz-shard-dummy-3.test.sh
tests/zz-shard-dummy-4.test.sh
tests/zz-shard-dummy-5.test.sh

$ /bin/bash ~/.no-mistakes/worktrees/32d18ed9638d/01M4D9CQYPTA4EJQH814DXT6AT/.fm-runner-live-vbd8ner6/boundaries/bin/fm-test-run.sh --check-coverage
exit=1

stderr:
fm-test-run: coverage guard: 36 of 220 portable serial scripts have no measured duration hint (max 15%)
fm-test-run: refresh the hints from a green run's timing artifacts: docs/fm-test-portable-shards.md
tests/fm-calm-pi-queue-retention-live-e2e.test.sh
tests/fm-claude-titled-composer-live-e2e.test.sh
tests/fm-devin-harness.test.sh
tests/fm-devin-signals-live-e2e.test.sh
tests/fm-fleet-ledger.test.sh
tests/fm-fork-free-helpers.test.sh
tests/fm-git-strip-ai-trailers.test.sh
tests/fm-host-mirror-live-e2e.test.sh
tests/fm-host-mirror.test.sh
tests/fm-inbox.test.sh
tests/fm-jev-guardrail-home.test.sh
tests/fm-jev-guardrail.test.sh
tests/fm-launch-prompt-signals-live-e2e.test.sh
tests/fm-mem-guard.test.sh
tests/fm-model-index-live-e2e.test.sh
tests/fm-model-index.test.sh
tests/fm-omp-composer-box-live-e2e.test.sh
tests/fm-omp-jev-pipeline.test.sh
tests/fm-remote-secondmate-relaunch.test.sh
tests/fm-session-end-relaunch.test.sh
tests/fm-skill-suggest.test.sh
tests/fm-spawn-acquisition-cleanup.test.sh
tests/fm-spawn-claude-api-key-guard.test.sh
tests/fm-spawn-compact-adviser-disable-remote.test.sh
tests/fm-spawn-compact-adviser-disable.test.sh
tests/fm-spawn-orca-worktree.test.sh
tests/fm-supervision-host-attended-live-e2e.test.sh
tests/fm-teamclaude-launch-live-e2e.test.sh
tests/fm-teamclaude-launch.test.sh
tests/fm-worker-account-live-e2e.test.sh
tests/fm-worker-account.test.sh
tests/zz-shard-dummy-1.test.sh
tests/zz-shard-dummy-2.test.sh
tests/zz-shard-dummy-3.test.sh
tests/zz-shard-dummy-4.test.sh
tests/zz-shard-dummy-5.test.sh

$ /bin/bash ~/.no-mistakes/worktrees/32d18ed9638d/01M4D9CQYPTA4EJQH814DXT6AT/.fm-runner-live-vbd8ner6/producer-failure/bin/fm-test-run.sh --list --lane portable-serial-1of9
exit=2

stderr:
fm-test-run: could not generate complete portable serial shard assignments

$ /bin/bash ~/.no-mistakes/worktrees/32d18ed9638d/01M4D9CQYPTA4EJQH814DXT6AT/.fm-runner-live-vbd8ner6/producer-failure/bin/fm-test-run.sh --lane portable-serial-1of9
exit=2

stderr:
fm-test-run: could not generate complete portable serial shard assignments

$ /bin/bash ~/.no-mistakes/worktrees/32d18ed9638d/01M4D9CQYPTA4EJQH814DXT6AT/.fm-runner-live-vbd8ner6/producer-failure/bin/fm-test-run.sh --list --lane portable-serial-1of9
exit=2

stderr:
fm-test-run: could not generate complete portable serial shard assignments

$ /bin/bash ~/.no-mistakes/worktrees/32d18ed9638d/01M4D9CQYPTA4EJQH814DXT6AT/.fm-runner-live-vbd8ner6/producer-failure/bin/fm-test-run.sh --lane portable-serial-1of9
exit=2

stderr:
fm-test-run: could not generate complete portable serial shard assignments

$ /bin/bash ~/.no-mistakes/worktrees/32d18ed9638d/01M4D9CQYPTA4EJQH814DXT6AT/.fm-runner-live-vbd8ner6/serial-execution/bin/fm-test-run.sh --lane portable-serial-3of9 --json ~/.no-mistakes/evidence/01M4D9CQYPTA4EJQH814DXT6AT/serial-shard-timing.json
exit=0
FM_TEST_BEGIN 2026-10-08T09:26:07Z tests/fm-session-launch-policy.test.sh family=backend-dispatch expected_gate_skip=none
ok - executed tests/fm-session-launch-policy.test.sh
FM_TEST_END 2026-10-08T09:26:07Z tests/fm-session-launch-policy.test.sh exit=0 duration_ms=264 gate_skip=false
FM_TEST_BEGIN 2026-10-08T09:26:08Z tests/fm-watcher-lock.test.sh family=watcher-wake-lock expected_gate_skip=none
ok - executed tests/fm-watcher-lock.test.sh
FM_TEST_END 2026-10-08T09:26:11Z tests/fm-watcher-lock.test.sh exit=0 duration_ms=2800 gate_skip=false
FM_TEST_BEGIN 2026-10-08T09:26:13Z tests/fm-remote-transport-lanes.test.sh family=secondmate expected_gate_skip=none
ok - executed tests/fm-remote-transport-lanes.test.sh
FM_TEST_END 2026-10-08T09:26:16Z tests/fm-remote-transport-lanes.test.sh exit=0 duration_ms=1441 gate_skip=false
FM_TEST_BEGIN 2026-10-08T09:26:17Z tests/fm-secondmate-sync.test.sh family=secondmate expected_gate_skip=none
ok - executed tests/fm-secondmate-sync.test.sh
FM_TEST_END 2026-10-08T09:26:18Z tests/fm-secondmate-sync.test.sh exit=0 duration_ms=256 gate_skip=false
FM_TEST_BEGIN 2026-10-08T09:26:19Z tests/fm-agy-harness.test.sh family=pure-contract-unit expected_gate_skip=none
ok - executed tests/fm-agy-harness.test.sh
FM_TEST_END 2026-10-08T09:26:21Z tests/fm-agy-harness.test.sh exit=0 duration_ms=935 gate_skip=false
FM_TEST_BEGIN 2026-10-08T09:26:22Z tests/fm-supervision-host.test.sh family=afk expected_gate_skip=none
ok - executed tests/fm-supervision-host.test.sh
FM_TEST_END 2026-10-08T09:26:23Z tests/fm-supervision-host.test.sh exit=0 duration_ms=766 gate_skip=false
FM_TEST_BEGIN 2026-10-08T09:26:24Z tests/fm-remote-secondmate-parent-binding.test.sh family=standalone expected_gate_skip=none
ok - executed tests/fm-remote-secondmate-parent-binding.test.sh
FM_TEST_END 2026-10-08T09:26:25Z tests/fm-remote-secondmate-parent-binding.test.sh exit=0 duration_ms=365 gate_skip=false
FM_TEST_BEGIN 2026-10-08T09:26:26Z tests/fm-cursor-harness.test.sh family=standalone expected_gate_skip=none
ok - executed tests/fm-cursor-harness.test.sh
FM_TEST_END 2026-10-08T09:26:27Z tests/fm-cursor-harness.test.sh exit=0 duration_ms=1144 gate_skip=false
FM_TEST_BEGIN 2026-10-08T09:26:28Z tests/fm-host-mirror.test.sh family=afk expected_gate_skip=none
ok - executed tests/fm-host-mirror.test.sh
FM_TEST_END 2026-10-08T09:26:31Z tests/fm-host-mirror.test.sh exit=0 duration_ms=2794 gate_skip=false
FM_TEST_BEGIN 2026-10-08T09:26:32Z tests/fm-omp-composer-box-live-e2e.test.sh family=live-harness-optin expected_gate_skip=live-capability
ok - executed tests/fm-omp-composer-box-live-e2e.test.sh
FM_TEST_END 2026-10-08T09:26:36Z tests/fm-omp-composer-box-live-e2

... [29954 bytes truncated] ...

tests/fm-mem-guard.test.sh
tests/fm-model-index-live-e2e.test.sh
tests/fm-model-index.test.sh
tests/fm-omp-composer-box-live-e2e.test.sh
tests/fm-omp-jev-pipeline.test.sh
tests/fm-remote-secondmate-relaunch.test.sh
tests/fm-session-end-relaunch.test.sh
tests/fm-skill-suggest.test.sh
tests/fm-spawn-acquisition-cleanup.test.sh
tests/fm-spawn-claude-api-key-guard.test.sh
tests/fm-spawn-compact-adviser-disable-remote.test.sh
tests/fm-spawn-compact-adviser-disable.test.sh
tests/fm-spawn-orca-worktree.test.sh
tests/fm-supervision-host-attended-live-e2e.test.sh
tests/fm-teamclaude-launch-live-e2e.test.sh
tests/fm-teamclaude-launch.test.sh
tests/fm-worker-account-live-e2e.test.sh
tests/fm-worker-account.test.sh
tests/zz-shard-dummy-1.test.sh
tests/zz-shard-dummy-2.test.sh
tests/zz-shard-dummy-3.test.sh
tests/zz-shard-dummy-4.test.sh
tests/zz-shard-dummy-5.test.sh

$ /bin/bash ~/.no-mistakes/worktrees/32d18ed9638d/01M4D9CQYPTA4EJQH814DXT6AT/.fm-runner-live-vbd8ner6/healthy-deadline-replay/bin/fm-test-run.sh --check-coverage
exit=0
duration_seconds=42.543
FM_TEST_COVERAGE ok total=231 parallel=24 parallel_max_ms=417163 parallel_imbalance_ms=2894 parallel_unhinted=0 serial=189 serial_shards=9 serial_unhinted=5 herdr=18


$ /bin/bash ~/.no-mistakes/worktrees/32d18ed9638d/01M4D9CQYPTA4EJQH814DXT6AT/.fm-runner-live-vbd8ner6/healthy-deadline-replay/bin/fm-test-run.sh --check-coverage
exit=0
duration_seconds=14.533
FM_TEST_COVERAGE ok total=232 parallel=24 parallel_max_ms=417163 parallel_imbalance_ms=2894 parallel_unhinted=0 serial=190 serial_shards=9 serial_unhinted=6 herdr=18


{"name": "Add five, six, or twenty tests and obtain complete deterministic disjoint serial shards", "result": "pass", "detail": [{"added": 5, "serial_count": 220, "full_partitions_checked": 2, "shard_sizes": {"1": 16, "2": 26, "3": 25, "4": 26, "5": 25, "6": 25, "7": 25, "8": 26, "9": 26}, "guard_exit": 1, "guard_output": "fm-test-run: coverage guard: 36 of 220 portable serial scripts have no measured duration hint (max 15%)\nfm-test-run: refresh the hints from a green run's timing artifacts: docs/fm-test-portable-shards.md\ntests/fm-calm-pi-queue-retention-live-e2e.test.sh\ntests/fm-claude-titled-composer-live-e2e.test.sh\ntests/fm-devin-harness.test.sh\ntests/fm-devin-signals-live-e2e.test.sh\ntests/fm-fleet-ledger.test.sh\ntests/fm-fork-free-helpers.test.sh\ntests/fm-git-strip-ai-trailers.test.sh\ntests/fm-host-mirror-live-e2e.test.sh\ntests/fm-host-mirror.test.sh\ntests/fm-inbox.test.sh\ntests/fm-jev-guardrail-home.test.sh\ntests/fm-jev-guardrail.test.sh\ntests/fm-launch-prompt-signals-live-e2e.test.sh\ntests/fm-mem-guard.test.sh\ntests/fm-model-index-live-e2e.test.sh\ntests/fm-model-index.test.sh\ntests/fm-omp-composer-box-live-e2e.test.sh\ntests/fm-omp-jev-pipeline.test.sh\ntests/fm-remote-secondmate-relaunch.test.sh\ntests/fm-session-end-relaunch.test.sh\ntests/fm-skill-suggest.test.sh\ntests/fm-spawn-acquisition-cleanup.test.sh\ntests/fm-spawn-claude-api-key-guard.test.sh\ntests/fm-spawn-compact-adviser-disable-remote.test.sh\ntests/fm-spawn-compact-adviser-disable.test.sh\ntests/fm-spawn-orca-worktree.test.sh\ntests/fm-supervision-host-attended-live-e2e.test.sh\ntests/fm-teamclaude-launch-live-e2e.test.sh\ntests/fm-teamclaude-launch.test.sh\ntests/fm-worker-account-live-e2e.test.sh\ntests/fm-worker-account.test.sh\ntests/zz-shard-dummy-1.test.sh\ntests/zz-shard-dummy-2.test.sh\ntests/zz-shard-dummy-3.test.sh\ntests/zz-shard-dummy-4.test.sh\ntests/zz-shard-dummy-5.test.sh\n"}, {"added": 6, "serial_count": 221, "full_partitions_checked": 2, "shard_sizes": {"1": 14, "2": 26, "3": 26, "4": 26, "5": 25, "6": 27, "7": 25, "8": 26, "9": 26}, "guard_exit": 1, "guard_output": "fm-test-run: coverage guard: 37 of 221 portable serial scripts have no measured duration hint (max 15%)\nfm-test-run: refresh the hints from a green run's timing artifacts: docs/fm-test-portable-shards.md\ntests/fm-calm-pi-queue-retention-live-e2e.test.sh\ntests/fm-claude-titled-composer-live-e2e.test.sh\ntests/fm-devin-harness.test.sh\ntests/fm-devin-signals-live-e2e.test.sh\ntests/fm-fleet-ledger.test.sh\ntests/fm-fork-free-helpers.test.sh\ntests/fm-git-strip-ai-trailers.test.sh\ntests/fm-host-mirror-live-e2e.test.sh\ntests/fm-host-mirror.test.sh\ntests/fm-inbox.test.sh\ntests/fm-jev-guardrail-home.test.sh\ntests/fm-jev-guardrail.test.sh\ntests/fm-launch-prompt-signals-live-e2e.test.sh\ntests/fm-mem-guard.test.sh\ntests/fm-model-index-live-e2e.test.sh\ntests/fm-model-index.test.sh\ntests/fm-omp-composer-box-live-e2e.test.sh\ntests/fm-omp-jev-pipeline.test.sh\ntests/fm-remote-secondmate-relaunch.test.sh\ntests/fm-session-end-relaunch.test.sh\ntests/fm-skill-suggest.test.sh\ntests/fm-spawn-acquisition-cleanup.test.sh\ntests/fm-spawn-claude-api-key-guard.test.sh\ntests/fm-spawn-compact-adviser-disable-remote.test.sh\ntests/fm-spawn-compact-adviser-disable.test.sh\ntests/fm-spawn-orca-worktree.test.sh\ntests/fm-supervision-host-attended-live-e2e.test.sh\ntests/fm-teamclaude-launch-live-e2e.test.sh\ntests/fm-teamclaude-launch.test.sh\ntests/fm-worker-account-live-e2e.test.sh\ntests/fm-worker-account.test.sh\ntests/zz-shard-dummy-1.test.sh\ntests/zz-shard-dummy-2.test.sh\ntests/zz-shard-dummy-3.test.sh\ntests/zz-shard-dummy-4.test.sh\ntests/zz-shard-dummy-5.test.sh\ntests/zz-shard-dummy-6.test.sh\n"}, {"added": 20, "serial_count": 235, "full_partitions_checked": 2, "shard_sizes": {"1": 17, "2": 27, "3": 27, "4": 27, "5": 28, "6": 27, "7": 27, "8": 28, "9": 27}, "guard_exit": 1, "guard_output": "fm-test-run: coverage guard: 51 of 235 portable serial scripts have no measured duration hint (max 15%)\nfm-test-run: refresh the hints from a green run's timing artifacts: docs/fm-test-portable-shards.md\ntests/fm-calm-pi-queue-retention-live-e2e.test.sh\ntests/fm-claude-titled-composer-live-e2e.test.sh\ntests/fm-devin-harness.test.sh\ntests/fm-devin-signals-live-e2e.test.sh\ntests/fm-fleet-ledger.test.sh\ntests/fm-fork-free-helpers.test.sh\ntests/fm-git-strip-ai-trailers.test.sh\ntests/fm-host-mirror-live-e2e.test.sh\ntests/fm-host-mirror.test.sh\ntests/fm-inbox.test.sh\ntests/fm-jev-guardrail-home.test.sh\ntests/fm-jev-guardrail.test.sh\ntests/fm-launch-prompt-signals-live-e2e.test.sh\ntests/fm-mem-guard.test.sh\ntests/fm-model-index-live-e2e.test.sh\ntests/fm-model-index.test.sh\ntests/fm-omp-composer-box-live-e2e.test.sh\ntests/fm-omp-jev-pipeline.test.sh\ntests/fm-remote-secondmate-relaunch.test.sh\ntests/fm-session-end-relaunch.test.sh\ntests/fm-skill-suggest.test.sh\ntests/fm-spawn-acquisition-cleanup.test.sh\ntests/fm-spawn-claude-api-key-guard.test.sh\ntests/fm-spawn-compact-adviser-disable-remote.test.sh\ntests/fm-spawn-compact-adviser-disable.test.sh\ntests/fm-spawn-orca-worktree.test.sh\ntests/fm-supervision-host-attended-live-e2e.test.sh\ntests/fm-teamclaude-launch-live-e2e.test.sh\ntests/fm-teamclaude-launch.test.sh\ntests/fm-worker-account-live-e2e.test.sh\ntests/fm-worker-account.test.sh\ntests/zz-shard-dummy-1.test.sh\ntests/zz-shard-dummy-10.test.sh\ntests/zz-shard-dummy-11.test.sh\ntests/zz-shard-dummy-12.test.sh\ntests/zz-shard-dummy-13.test.sh\ntests/zz-shard-dummy-14.test.sh\ntests/zz-shard-dummy-15.test.sh\ntests/zz-shard-dummy-16.test.sh\ntests/zz-shard-dummy-17.test.sh\ntests/zz-shard-dummy-18.test.sh\ntests/zz-shard-dummy-19.test.sh\ntests/zz-shard-dummy-2.test.sh\ntests/zz-shard-dummy-20.test.sh\ntests/zz-shard-dummy-3.test.sh\ntests/zz-shard-dummy-4.test.sh\ntests/zz-shard-dummy-5.test.sh\ntests/zz-shard-dummy-6.test.sh\ntests/zz-shard-dummy-7.test.sh\ntests/zz-shard-dummy-8.test.sh\ntests/zz-shard-dummy-9.test.sh\n"}]}
{"name": "Coverage guard succeeds with five and six new tests within the existing hint budget", "result": "pass", "detail": [{"added": 5, "output": "FM_TEST_COVERAGE ok total=231 parallel=24 parallel_max_ms=417163 parallel_imbalance_ms=2894 parallel_unhinted=0 serial=189 serial_shards=9 serial_unhinted=5 herdr=18\n", "exit": 0}, {"added": 6, "output": "FM_TEST_COVERAGE ok total=232 parallel=24 parallel_max_ms=417163 parallel_imbalance_ms=2894 parallel_unhinted=0 serial=190 serial_shards=9 serial_unhinted=6 herdr=18\n", "exit": 0}]}
Evidence: Timing artifact generated by actual serial shard execution

Source: Timing artifact generated by actual serial shard execution

{
  "families": [
    {
      "count": 3,
      "duration_ms": 3807,
      "failed": 0,
      "name": "afk"
    },
    {
      "count": 3,
      "duration_ms": 974,
      "failed": 0,
      "name": "backend-dispatch"
    },
    {
      "count": 1,
      "duration_ms": 223,
      "failed": 0,
      "name": "cmux"
    },
    {
      "count": 5,
      "duration_ms": 1896,
      "failed": 0,
      "name": "live-harness-optin"
    },
    {
      "count": 3,
      "duration_ms": 1478,
      "failed": 0,
      "name": "pure-contract-unit"
    },
    {
      "count": 3,
      "duration_ms": 2292,
      "failed": 0,
      "name": "secondmate"
    },
    {
      "count": 1,
      "duration_ms": 185,
      "failed": 0,
      "name": "session-bootstrap"
    },
    {
      "count": 4,
      "duration_ms": 4112,
      "failed": 0,
      "name": "standalone"
    },
    {
      "count": 2,
      "duration_ms": 864,
      "failed": 0,
      "name": "unclassified"
    },
    {
      "count": 1,
      "duration_ms": 2800,
      "failed": 0,
      "name": "watcher-wake-lock"
    }
  ],
  "finished_at": "2026-10-08T09:26:48Z",
  "run_id": "fm-test-run-1791451540353-68152",
  "scripts": [
    {
      "duration_ms": 264,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "backend-dispatch",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-session-launch-policy.test.sh"
    },
    {
      "duration_ms": 2800,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "watcher-wake-lock",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-watcher-lock.test.sh"
    },
    {
      "duration_ms": 1441,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "secondmate",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-remote-transport-lanes.test.sh"
    },
    {
      "duration_ms": 256,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "secondmate",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-secondmate-sync.test.sh"
    },
    {
      "duration_ms": 935,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "pure-contract-unit",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-agy-harness.test.sh"
    },
    {
      "duration_ms": 766,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "afk",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-supervision-host.test.sh"
    },
    {
      "duration_ms": 365,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "standalone",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-remote-secondmate-parent-binding.test.sh"
    },
    {
      "duration_ms": 1144,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "standalone",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-cursor-harness.test.sh"
    },
    {
      "duration_ms": 2794,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "afk",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-host-mirror.test.sh"
    },
    {
      "duration_ms": 568,
      "exit": 0,
      "expected_gate_skip": "live-capability",
      "family": "live-harness-optin",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-omp-composer-box-live-e2e.test.sh"
    },
    {
      "duration_ms": 228,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "backend-dispatch",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-spawn-compact-adviser-disable.test.sh"
    },
    {
      "duration_ms": 619,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "unclassified",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/zz-shard-dummy-2.test.sh"
    },
    {
      "duration_ms": 247,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "afk",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-afk-return.test.sh"
    },
    {
      "duration_ms": 304,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "pure-contract-unit",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-kimi-harness.test.sh"
    },
    {
      "duration_ms": 185,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "session-bootstrap",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-update.test.sh"
    },
    {
      "duration_ms": 482,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "backend-dispatch",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-spawn-worktree-settle.test.sh"
    },
    {
      "duration_ms": 595,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "secondmate",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-send-secondmate-marker.test.sh"
    },
    {
      "duration_ms": 223,
      "exit": 0,
      "expected_gate_skip": "optional-binary",
      "family": "cmux",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-backend-cmux.test.sh"
    },
    {
      "duration_ms": 245,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "unclassified",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-ci-workflow.test.sh"
    },
    {
      "duration_ms": 1994,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "standalone",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-quota-choose.test.sh"
    },
    {
      "duration_ms": 609,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "standalone",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-no-mistakes-required.test.sh"
    },
    {
      "duration_ms": 239,
      "exit": 0,
      "expected_gate_skip": "none",
      "family": "pure-contract-unit",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-forge-detect.test.sh"
    },
    {
      "duration_ms": 284,
      "exit": 0,
      "expected_gate_skip": "live-capability",
      "family": "live-harness-optin",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-cursor-primary-live-e2e.test.sh"
    },
    {
      "duration_ms": 722,
      "exit": 0,
      "expected_gate_skip": "live-capability",
      "family": "live-harness-optin",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-agy-signals-live-e2e.test.sh"
    },
    {
      "duration_ms": 181,
      "exit": 0,
      "expected_gate_skip": "live-capability",
      "family": "live-harness-optin",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-composer-matrix-live-e2e.test.sh"
    },
    {
      "duration_ms": 141,
      "exit": 0,
      "expected_gate_skip": "live-capability",
      "family": "live-harness-optin",
      "gate_skip": false,
      "gate_skip_reason": "",
      "path": "tests/fm-sessionstart-instruction-refresh-live-e2e.test.sh"
    }
  ],
  "selection": "lane=portable-serial-3of9",
  "started_at": "2026-10-08T09:25:39Z",
  "summary": {
    "duration_ms": 68285,
    "failed": 0,
    "skipped_gate": 0,
    "total": 26
  }
}
Evidence: Completed change-specific shard and coverage contracts

Source: Completed change-specific shard and coverage contracts

ok - serial shards stay a disjoint cover of the serial lane with 5, 6, and 20 extra scripts
ok - serial shard generation failures refuse rather than publish partial coverage
ok - coverage guard passes with five extra scripts and no script in two shards
ok - coverage guard still refuses a script that sits in two shards
ok - portable serial shard lanes refuse mismatched, out-of-range, and countless names
Evidence: Observed current-inventory coverage and partition baseline

Source: Observed current-inventory coverage and partition baseline

Observed initial live CLI command: env -i PATH="$PATH" HOME=<workspace fixture home> TMPDIR=<workspace fixture tmp> /bin/bash bin/fm-test-run.sh --check-coverage
Exit: 0
FM_TEST_COVERAGE ok total=257 parallel=24 parallel_max_ms=417163 parallel_imbalance_ms=2894 parallel_unhinted=0 serial=215 serial_shards=9 serial_unhinted=31 herdr=18

The live driver verified all nine standalone serial shards exactly and disjointly cover 215 serial scripts; shard sizes were 15,25,25,25,25,25,24,25,26. Parallel-1 + parallel-2 + serial + real-herdr-gated exactly covered --list --all (257 scripts). real-herdr-gated was listed only, never executed.

The initial stress driver exceeded its self-imposed 900-second overall deadline before finishing all scenarios; no final pass was inferred. The replay persists each real CLI result and uses two full partitions and two guards per added-script count.
Evidence: Initial broader contract attempt — interrupted, not a passing result

Source: Initial broader contract attempt — interrupted, not a passing result

ok - exact suite coverage: --all lists every tests/*.test.sh once
ok - family selection returns a proper subset of the suite
ok - single-script selection lists exactly that path
ok - changed-file selection stays conservative (never silent full suite)
ok - a task marker refuses execution in the primary checkout and leaves worktrees and inspection alone
ok - runner and its documentation surfaces select their curated family, not just their contract owners
ok - shell line-ending policy selects runner coverage
fm-test-run: no tests selected for changes vs HEAD (map is conservative; use --all for the complete suite)
fm-test-run: no tests selected for changes vs HEAD (map is conservative; use --all for the complete suite)
ok - changed selection covers dependents, fails closed for live unmapped source, and accepts retired unconsumed source
ok - all six status and UTC owner-only changes select consuming families and exact additional consumers
ok - a bin reference selects the referencing scripts, and consumers still select their curated families
ok - changed defaults to bounded automatic scheduling with serial override
ok - Windows emulation exempts only synthetic POSIX modes
ok - a plain script list defaults to bounded automatic concurrency without an automatic timeout
ok - family proofs run concurrently only within separate family phases
ok - empty changed selection emits deterministic text and JSON summaries
ok - timing markers and JSON artifact are valid
- Outcome: 🔧 2 issues found → auto-fixed ✅ across 2 runs (1h24m56s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

🔧 **Test** - 2 issues found → auto-fixed ✅
  • 🚨 bin/fm-test-run.sh:934 - Serial shard generation can still lose scripts while returning success on macOS Bash 3.2. With the unchanged target runner and the repository inventory plus five scripts, --list --lane portable-serial-3of9 exited 0 but printed only one script and reported printf: write error: Interrupted system call. The combined nine-shard lists consequently omitted 24 of 220 serial scripts. Three identical-command replays each returned the expected 25 scripts, establishing an intermittent failure. This occurred while the focused runner contract was running concurrently. Eliminate the interrupted-generation failure and ensure a partial assignment stream cannot be accepted as successful; extend regression coverage to check the standalone shard union at the five- and six-script boundaries, not only at twenty. Evidence: runner-truncation.txt and runner-live-transcript.json.
  • 🚨 live validation verdict: no-go (7 of 7 scenarios were driven live against the product); failed: Add five, six, or twenty test scripts and obtain complete, disjoint serial shard lists
  • Live validation: ❌ no-go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Run the current checkout's coverage guard and receive a complete coverage success ✅ pass live bin/fm-test-run.sh --check-coverage returned FM_TEST_COVERAGE ok with total=257, serial=215, serial_shards=9.
Add five, six, or twenty test scripts and obtain complete, disjoint serial shard lists ❌ fail live runner-truncation.txt, runner-live-transcript.txt, and shard-boundary-results.json: the five-script inventory omitted 24 scripts despite shard 3 exiting successfully; six- and twenty-script inventorie…
Add five scripts within the hint-policy bound and pass the entire coverage guard without weakening the unmeasured-share refusal ✅ pass live runner-scenario-results.json: the policy-compliant fixture returned FM_TEST_COVERAGE ok with serial_unhinted=5; larger unmeasured inventories were refused for exceeding the existing 15% bound rather t…
Introduce a genuine serial or parallel shard overlap and receive a refusal naming the duplicated script ✅ pass live runner-live-transcript.txt: injected parallel overlap named tests/fm-lint.test.sh; injected serial overlap named tests/fm-watch-triage.test.sh; both guards exited 1.
Execute all nine serial shards after adding six scripts and run every serial input exactly once ✅ pass live shard-execution-results.json and per-shard timing artifacts: all shard commands exited 0; persisted records covered all 221 serial inputs with no duplicates or omissions.
Use a stale CI shard count and receive an explicit configuration refusal ✅ pass live runner-live-transcript.txt: portable-serial-1of8 exited 2 and reported that the runner is configured for nine shards.
Run proven scripts concurrently while rejecting unproven scripts, external name collisions, and excessive family concurrency ✅ pass live runner-live-transcript.txt and family-concurrency-complete.json: proven selections completed; unproven and external inputs exited 2; five workers exceeded the recorded four-worker family cap and were…
  • /bin/bash --version and bin/fm-test-run.sh --check-coverage: Bash 3.2.57; the current checkout's coverage guard passed.
  • Executed base-commit and target runners against identical disposable inventories containing the repository test names plus five scripts, using subprocess environments containing only PATH, workspace-local HOME, and workspace-local TMPDIR.
  • Executed --check-coverage, --list-lanes, the complete serial lane listing, and all nine serial shard listings for inventories with 0, 5, 6, and 20 extra scripts; compared generated outputs for duplicates, omissions, and deterministic membership.
  • Replayed the failing five-script --list --lane portable-serial-3of9 command three times and compared its recovered output with the 24 omitted scripts.
  • Executed the complete coverage guard with five new scripts within the measured-hint policy; injected genuine parallel and serial shard overlaps into disposable runner copies and verified rejection; verified rejection of portable-serial-1of8.
  • Executed all nine real runner shards with six added script inputs using --lane portable-serial-&lt;k&gt;of9 --jobs 1 --json &lt;evidence-path&gt;; checked persisted execution records for exactly-once coverage of all 221 serial inputs.
  • env HOME=&#34;$PWD/.runner-live-ltzsh8j8/home&#34; TMPDIR=&#34;$PWD/.runner-live-ltzsh8j8/tmp&#34; bin/fm-test-run.sh --jobs 1 --json &lt;evidence-path&gt; tests/fm-test-run.test.sh: all three added regression cases completed successfully, but the overall focused contract invocation exceeded its 1200-second command deadline and is not reported as passing.
  • Executed bin/fm-test-run.sh --jobs 2 --per-script-timeout-secs 120 tests/fm-supervision-events.test.sh tests/fm-session-lock-ancestry.test.sh; ancestry exceeded the imposed cap. Re-executed the selection with a 600-second cap and JSON evidence; both scripts completed successfully, with ancestry taking approximately 163 seconds.
  • Exercised concurrency admission through the real runner: proven scripts were admitted; new unproven scripts and an external basename collision were refused; the watcher family's four-worker cap remained enforced.
  • Removed all disposable inventories, local homes, temporary roots, and generated execution data from the worktree after validation.

🔧 Fix applied.
✅ Re-checked - no issues remain.

  • Live validation: ✅ go - 9 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Inspect the current inventory and obtain complete, disjoint lane coverage ✅ pass live runner-baseline.txt: coverage guard exited 0; the complete lane union covered all 257 scripts and nine serial shards covered exactly 215 scripts.
Add five, six, or twenty tests and obtain deterministic serial shards without duplicates or omissions ✅ pass live runner-boundary-replay.json: two complete partitions per boundary covered exactly 220, 221, and 235 serial scripts with identical assignments between repetitions.
Accept valid shard coverage while preserving the measured-duration hint guard ✅ pass live runner-boundary-replay.json: fixtures within the hint budget passed with five and six added scripts; full inventories above the existing 15% budget refused specifically for missing hints, not shard du…
Fail assignment generation without publishing or executing a partial shard ✅ pass live runner-cli-evidence.log: injected inventory-sort and assignment-sort failures made both listing and execution exit 2 with empty stdout and the complete-assignment refusal.
Reject a genuine duplicate lane assignment and identify the offending script ✅ pass live runner-cli-evidence.log: duplicate membership injected into a disposable lane inventory caused exit 1 and named tests/fm-pr-merge.test.sh.
Execute every selected serial-shard script exactly once and report a consumer failure ✅ pass live runner-cli-evidence.log and serial-shard-timing.json: 26 execution receipts matched the selected shard exactly; an injected script exit 7 produced a failed summary while the remaining scripts still ra…
Refuse invalid shard coordinates and concurrent execution inside a serial shard ✅ pass live runner-cli-evidence.log: 0of9, 10of9, 1of8, and --jobs 2 on a serial shard all exited 2 before execution.
Admit exact proven concurrency members without granting concurrency to unknown or colliding external scripts ✅ pass live runner-cli-evidence.log: persisted traces showed both admitted scripts starting before either finished; unknown and external-name-colliding scripts were refused, while the unknown script ran successfu…
Preserve weighted scheduled-list ordering and deterministic path ties ✅ pass live runner-cli-evidence.log: explicit script scheduling matched the existing weighted order, and proven-isolated scheduling matched the path-sorted member list.
  • /bin/bash bin/fm-test-run.sh --check-coverage: current inventory passed with 257 scripts and nine serial shards.
  • Compared --list --all with the complete lane union and compared all nine standalone serial shard lists with --list --lane portable-serial.
  • /bin/bash tests/fm-test-run.test.sh: initial broader contract attempt exceeded the 600-second wait bound and was stopped; it is not reported as passing.
  • Executed unchanged contract functions through a disposable copy: test_serial_shard_guard_holds_at_every_lane_size, test_serial_shard_generation_failure_is_not_a_partial_success, test_coverage_guard_passes_with_extra_scripts, test_coverage_guard_still_refuses_a_true_duplicate, and test_portable_serial_shard_lane_refusals; all passed.
  • python3 .fm-runner-live-vbd8ner6/live_check.py: exercised producer faults, serial execution, failure propagation, and lane refusals. Initial stress and guard attempts reached driver-only deadlines.
  • python3 .fm-runner-live-vbd8ner6/guard_replay.py: completed two full nine-shard partitions at each added-script count of 5, 6, and 20, checked determinism and exact coverage, and exercised guard refusal and acceptance with a corrected driver-only deadline.
  • python3 .fm-runner-live-vbd8ner6/concurrency_check.py: verified actual concurrent execution for proven scripts and repository family members, serial execution for an unknown script, and refusal of unknown, external-name-colliding, and over-cap selections.
  • Ran --check-coverage against a disposable runner with one script inserted into both parallel lane inventories; it refused and named the duplicate.
  • Exercised --list-scheduled with six explicit script paths and with --proven-isolated; observed the expected weighted ordering and path-ordered ties.
  • Verified serial execution receipts and the generated timing JSON, checked that no fixture processes remained, and removed all disposable drivers, inventories, homes, and generated data.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…bash 3.2

The guard computes every serial shard list, and the whole lane list, inside
one shell. Each list ran a per-script process substitution to test
proven-isolated membership and to look up a duration hint. macOS /bin/bash
3.2 loses lines from later reads once one long-lived shell has run enough of
them, so past a lane size the last shard picked up scripts that belonged to
earlier shards and the guard refused with "portable serial shards share
scripts" while every standalone --list was correct.

Membership now uses a case match on a list captured once, and the hint join
is one awk pass, so a shard selection costs a fixed number of processes
whatever the lane size. Shard contents are unchanged.

Tests build a fixture runner with extra scripts and require the guard and the
shard lists to stay a disjoint cover, run under a scrubbed environment because
the harness's exported variables hide the corruption, and keep a true
duplicate refused.
@MrGTV-love
MrGTV-love merged commit cb7205a into main Oct 8, 2026
21 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