Repository navigation
fix(bin): report a Lavish source armed only after its listener is running - #5566
Merged
kunchenguid merged 6 commits intoSep 24, 2026
Merged
kunchenguid merged 6 commits into
kunchenguid merged 6 commits into
Conversation
…ning Registration alone was treated as ready, so arm could succeed before anything was collecting from the board.
… report live prior listener
…till-live prior listener
The result is stored before the runner exits, so a re-arm in that gap was meeting a live claim.
…ixed with test-only edits. Lint 2 (ShellCheck SC2034): this branch removed the only use of `reply_id` (a `start "$reply_id"` call) from tests/fm-procevent.test.sh, which left the assignment at line 1450 unused. I deleted that assignment. It was the only `reply_id` in the file. ShellCheck is now clean on both test files. Behavior portable serial 4: the failing test was tests/fm-bearings-board.test.sh, in the check "registration consumed its answer before the any-origin binding existed". I reproduced it locally: the hold was still `state: queued` when the test checked it. - What must hold: the test's check that the hold is closed must run after the listener has captured the answer. - Why it broke: the test used a stand-in adapter that ran `fm-procevent.sh start` in the foreground after `arm`, so capture finished before build returned. On this branch, `arm` starts the listener itself in the background, so the real listener captures the answer and closes the hold a moment after build returns. - Fix: removed the now-redundant stand-in adapter, the copied runtime directory, and its extra environment variables. The test now runs the real build through the existing `run_board` helper and waits up to about 10s for the hold to reach `state: done`. The checks that follow are unchanged: `Resolution mode: answered` and the any-origin binding. - Other tests: this was the only test in the file that stood in for the adapter this way. The shard's other pure-contract-unit test (tests/fm-trace-context-lib.test.sh) passed unchanged. Verification: - tests/fm-bearings-board.test.sh passed 3 times in a row via bin/fm-test-run.sh, all 18 checks, about 53s per run. - tests/fm-procevent.test.sh was not rerun, because the lint fix only removed an unused assignment
Owner
|
Speaking as Kun's firstmate: this is merged. Thank you @tiago-peixoto — really appreciate you taking the time on this. |
mituso89
pushed a commit
to mituso89/firstmate
that referenced
this pull request
Sep 26, 2026
…ning (kunchenguid#5566) * fix(bin): report a Lavish source armed only after its listener is running Registration alone was treated as ready, so arm could succeed before anything was collecting from the board. * no-mistakes(review): Guard Lavish arm launches, keep retire refusals, report live prior listener * no-mistakes(review): Keep polling through window before reporting a still-live prior listener * test: wait for a capture's claim to drop before the next arm The result is stored before the runner exits, so a re-arm in that gap was meeting a live claim. * no-mistakes(document): Record Lavish arm readiness evidence in verification doc * no-mistakes(ci): Both failures were caused by this PR, and both are fixed with test-only edits. Lint 2 (ShellCheck SC2034): this branch removed the only use of `reply_id` (a `start "$reply_id"` call) from tests/fm-procevent.test.sh, which left the assignment at line 1450 unused. I deleted that assignment. It was the only `reply_id` in the file. ShellCheck is now clean on both test files. Behavior portable serial 4: the failing test was tests/fm-bearings-board.test.sh, in the check "registration consumed its answer before the any-origin binding existed". I reproduced it locally: the hold was still `state: queued` when the test checked it. - What must hold: the test's check that the hold is closed must run after the listener has captured the answer. - Why it broke: the test used a stand-in adapter that ran `fm-procevent.sh start` in the foreground after `arm`, so capture finished before build returned. On this branch, `arm` starts the listener itself in the background, so the real listener captures the answer and closes the hold a moment after build returns. - Fix: removed the now-redundant stand-in adapter, the copied runtime directory, and its extra environment variables. The test now runs the real build through the existing `run_board` helper and waits up to about 10s for the hold to reach `state: done`. The checks that follow are unchanged: `Resolution mode: answered` and the any-origin binding. - Other tests: this was the only test in the file that stood in for the adapter this way. The shard's other pure-contract-unit test (tests/fm-trace-context-lib.test.sh) passed unchanged. Verification: - tests/fm-bearings-board.test.sh passed 3 times in a row via bin/fm-test-run.sh, all 18 checks, about 53s per run. - tests/fm-procevent.test.sh was not rerun, because the lint fix only removed an unused assignment
mehulbhagwani
pushed a commit
to mehulbhagwani/firstmate
that referenced
this pull request
Sep 26, 2026
…ning (kunchenguid#5566) * fix(bin): report a Lavish source armed only after its listener is running Registration alone was treated as ready, so arm could succeed before anything was collecting from the board. * no-mistakes(review): Guard Lavish arm launches, keep retire refusals, report live prior listener * no-mistakes(review): Keep polling through window before reporting a still-live prior listener * test: wait for a capture's claim to drop before the next arm The result is stored before the runner exits, so a re-arm in that gap was meeting a live claim. * no-mistakes(document): Record Lavish arm readiness evidence in verification doc * no-mistakes(ci): Both failures were caused by this PR, and both are fixed with test-only edits. Lint 2 (ShellCheck SC2034): this branch removed the only use of `reply_id` (a `start "$reply_id"` call) from tests/fm-procevent.test.sh, which left the assignment at line 1450 unused. I deleted that assignment. It was the only `reply_id` in the file. ShellCheck is now clean on both test files. Behavior portable serial 4: the failing test was tests/fm-bearings-board.test.sh, in the check "registration consumed its answer before the any-origin binding existed". I reproduced it locally: the hold was still `state: queued` when the test checked it. - What must hold: the test's check that the hold is closed must run after the listener has captured the answer. - Why it broke: the test used a stand-in adapter that ran `fm-procevent.sh start` in the foreground after `arm`, so capture finished before build returned. On this branch, `arm` starts the listener itself in the background, so the real listener captures the answer and closes the hold a moment after build returns. - Fix: removed the now-redundant stand-in adapter, the copied runtime directory, and its extra environment variables. The test now runs the real build through the existing `run_board` helper and waits up to about 10s for the hold to reach `state: done`. The checks that follow are unchanged: `Resolution mode: answered` and the any-origin binding. - Other tests: this was the only test in the file that stood in for the adapter this way. The shard's other pure-contract-unit test (tests/fm-trace-context-lib.test.sh) passed unchanged. Verification: - tests/fm-bearings-board.test.sh passed 3 times in a row via bin/fm-test-run.sh, all 18 checks, about 53s per run. - tests/fm-procevent.test.sh was not rerun, because the lint fix only removed an unused assignment
mehulbhagwani
pushed a commit
to mehulbhagwani/firstmate
that referenced
this pull request
Sep 26, 2026
…ning (kunchenguid#5566) * fix(bin): report a Lavish source armed only after its listener is running Registration alone was treated as ready, so arm could succeed before anything was collecting from the board. * no-mistakes(review): Guard Lavish arm launches, keep retire refusals, report live prior listener * no-mistakes(review): Keep polling through window before reporting a still-live prior listener * test: wait for a capture's claim to drop before the next arm The result is stored before the runner exits, so a re-arm in that gap was meeting a live claim. * no-mistakes(document): Record Lavish arm readiness evidence in verification doc * no-mistakes(ci): Both failures were caused by this PR, and both are fixed with test-only edits. Lint 2 (ShellCheck SC2034): this branch removed the only use of `reply_id` (a `start "$reply_id"` call) from tests/fm-procevent.test.sh, which left the assignment at line 1450 unused. I deleted that assignment. It was the only `reply_id` in the file. ShellCheck is now clean on both test files. Behavior portable serial 4: the failing test was tests/fm-bearings-board.test.sh, in the check "registration consumed its answer before the any-origin binding existed". I reproduced it locally: the hold was still `state: queued` when the test checked it. - What must hold: the test's check that the hold is closed must run after the listener has captured the answer. - Why it broke: the test used a stand-in adapter that ran `fm-procevent.sh start` in the foreground after `arm`, so capture finished before build returned. On this branch, `arm` starts the listener itself in the background, so the real listener captures the answer and closes the hold a moment after build returns. - Fix: removed the now-redundant stand-in adapter, the copied runtime directory, and its extra environment variables. The test now runs the real build through the existing `run_board` helper and waits up to about 10s for the hold to reach `state: done`. The checks that follow are unchanged: `Resolution mode: answered` and the any-origin binding. - Other tests: this was the only test in the file that stood in for the adapter this way. The shard's other pure-contract-unit test (tests/fm-trace-context-lib.test.sh) passed unchanged. Verification: - tests/fm-bearings-board.test.sh passed 3 times in a row via bin/fm-test-run.sh, all 18 checks, about 53s per run. - tests/fm-procevent.test.sh was not rerun, because the lint fix only removed an unused assignment
ashkonmousavi
added a commit
to ashkonmousavi/firstmate
that referenced
this pull request
Sep 26, 2026
Fixes #2756.
What Changed
fm-procevent.sh ensure-listening <source-id>. It starts a runner for the current registration when no claim blocks a launch, then waits up to the reconcile confirm window (FM_PROCEVENT_LAUNCH_CONFIRM_SECONDS) for this registration's live claim or launch stamp. It exits 0 once that evidence appears, 3 if a listener from an earlier registration still holds the source when the window ends, and 1 otherwise.fm-procevent-lavish.sh armnow callsensure-listeningafter it registers the source. It printsarmedonly when the listener is confirmed running. If the earlier listener is still live, it printsstill-listeningand exits zero. If confirmation fails, it exits non-zero and retires the source, unlesslistshows that something may still own the source.docs/configuration.mdand the verification doc to describe the new arm contract. Addedtests/fm-procevent.test.shcases for: a claim delayed by a held source lock, a runner that never claims, a re-arm over a still-live earlier listener, a re-arm whose earlier claim is released inside the window, and a stale claim whose process group is still alive.Risk Assessment
✅ Low: The new ensure-listening step reuses reconcile's existing evidence: a live claim bound to this registration or an advanced launch stamp. Its launch rule matches reconcile's, including the undisplaceable guard, and _start still refuses a task-owned source with an open round. The Lavish retire-on-miss path keeps list-based refusals for live, orphaned and task-owned states. The only remaining edge cases found are ones the user already declined in earlier rounds.
Testing
I drove
armlive against the reallavish-axiand the real process-event runner in an isolated home. Fresh arm, re-arm while the earlier listener is live, retire then re-arm, and a listener that can never claim all behaved as intended. The armed listener also really polled the board: it captured the round when I ended the Lavish session. The draining-release, undisplaceable-claim and delayed-start cases were covered only by the new behaviour tests, not live, so they are marked untested. Those tests passed in a full run of tests/fm-procevent.test.sh, using a temporary copy that accepted this host's systemd --user subreaper. An earlier run of that copy exited silently in an unchanged home-sweep section. I tried one extra adversarial setup (a read-only claim root) and dropped it: the existingregisterstep never returned, before any new code ran. The lab directory and the temporary test copy were removed and the worktree is clean. Overall: go.armedonly once its listener is running, and that listener really polls the boardlistshowslive, the reallavish-axi pollprocess is running, andlavish-axi endproduced a captured .1.resultstill-listeningand neverarmed, no error, no second pollerliststilllive, exactly 1lavish-axi pollprocessarmedwith a live listenerarmed, and keeps the registrationretirerefuses to removearmedregisterstep, which this branch did not change, beforeensure-listeningran. Driving this live needs a way to mak…Evidence: Live arm transcript against real lavish-axi
Source: Live arm transcript against real lavish-axi
Evidence: Full procevent test run (subreaper-tolerant copy), all passed
Source: Full procevent test run (subreaper-tolerant copy), all passed
Evidence: Unmodified procevent test run stopping at the host-dependent PPID assertion
Source: Unmodified procevent test run stopping at the host-dependent PPID assertion
Evidence: Subreaper-tolerant run 1 that exited silently in the unchanged home-sweep section
Source: Subreaper-tolerant run 1 that exited silently in the unchanged home-sweep section
Evidence: Re-arm over a live earlier listener (live)
Pipeline
Updates from git push no-mistakes
⏭️ **intent** - skipped
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
tests/fm-procevent.test.sh:3777- An older assertion (commit b84e0e3, not from this branch) expects an orphaned listener's PPID to be 1. On this host,systemd --user(PID 5856) is a child subreaper, so orphans are reparented to it. The unmodified test file therefore fails at this point and never reaches the tests added by this branch. Separate from this change; it should become its own issue or PR that accepts any subreaper as the new parent.tests/fm-procevent.test.sh:2642- One full run of the file (subreaper-tolerant copy) exited with rc=1 and no 'not ok' line inside the unchanged 'home sweep refuses safely until runner identity is readable' section. The identical rerun passed. This is a flaky test that predates this branch and should be tracked separately.armedonly once its listener is running, and that listener really polls the boardlistshowslive, the reallavish-axi pollprocess is running, andlavish-axi endproduced a captured .1.resultstill-listeningand neverarmed, no error, no second pollerliststilllive, exactly 1lavish-axi pollprocessarmedwith a live listenerarmed, and keeps the registrationretirerefuses to removearmedregisterstep, which this branch did not change, beforeensure-listeningran. Driving this live needs a way to mak…bin/fm-procevent-lavish.sh arm board.htmlon a board opened with the reallavish-axi, withLAVISH_AXI_STATE_DIR,FM_PROCEVENT_CLAIM_ROOTandFM_HOMEisolated under /tmpFM_PROCEVENT_LAUNCH_CONFIRM_SECONDS=2 bin/fm-procevent-lavish.sh arm board.htmlwhile the first listener was live, thenbin/fm-procevent.sh listand a count oflavish-axi pollprocesseslavish-axi end board.html, then checking that the armed listener captured the ended round into procevent-inboxbin/fm-procevent-lavish.sh retire board.htmlthenarm board.html(the documented way to adopt the retry policy)armwith the claim path made a directory so the listener can never claim (confirm window 2s)bash tests/fm-procevent.test.sh(unmodified): stopped at an older reparent-to-PID-1 assertion because of the host's systemd --user subreaperTemporary copy of tests/fm-procevent.test.sh accepting the subreaper PPID: run 1 exited silently in an unchanged home-sweep section; run 2 passed everything (131 ok), including all 5 new arm tests; copy deleted✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.