refactor(bin): give fm-crew-state one owner of the CI-ready verdict - #2896
Open
harmeet-1337 wants to merge 1 commit into
Open
refactor(bin): give fm-crew-state one owner of the CI-ready verdict#2896harmeet-1337 wants to merge 1 commit into
harmeet-1337 wants to merge 1 commit into
Conversation
fm-crew-state.sh derived the CI-readiness verdict twice. The second block (after the first `case "$status"` derivation) re-ran nm_effective_ci_step_status and a three-way if/elif that can never change CI_LOG_STATE on the full path: RUN_STATE=working there is produced only by that case, which already ran the first derivation, so CI_LOG_STATE is final by then; on the coarse path the block exited at its first emit before reaching it. Reduce the second block to its one live decision - a crew's own "checks green" status-log beats a run still monitoring the PR unless the ci log is not-ready - so a single place decides CI readiness. Output line format, states, sources, and detail strings are unchanged. Add two tests covering the surviving emit path: status=running with no ci step row (CI_LOG_STATE empty) and status=ci with no green marker (CI_LOG_STATE unknown), each with a done-checks-green log, both reporting done/status-log.
Confidence Score: 5/5The PR appears safe to merge because the simplified guard preserves behavior across every reachable CI and run-source state. The first derivation always finalizes fixing and running CI states before the changed guard, while the coarse-path short-circuit preserves the former immediate emit. Reviews (1): Last reviewed commit: "refactor(bin): give fm-crew-state one ow..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements accepted simplification-audit finding F-S07-2 (P0):
bin/fm-crew-state.shderived the CI-readiness verdict twice, and the second derivation was dead code that created a second owner of a safety-relevant rule.The second block re-ran
nm_effective_ci_step_statusand a three-wayif/elifthat can never changeCI_LOG_STATEon the full path:RUN_STATE=workingreaches that block only from thecase "$status"block, which already ran the first derivation (soCI_LOG_STATEis final by then); on the coarse path the block exits at its firstemitbefore reaching it. This reduces the second block to its single live decision — a crew's owndone: ... checks greenstatus-log beats a run still monitoring the PR, unless the ci log readsnot-ready.The single-producer invariant was re-verified at HEAD before the change: the outcome branch never yields
working, the gate branch yieldsparked, and no newworkingproducer has appeared.Behavior is unchanged: output line format, states, sources, and emitted detail strings are identical; no caller edits.
Tests
Adds two colocated cases to
tests/fm-crew-state.test.shcovering the surviving emit path:runningwith no ci step row (soCI_LOG_STATEis empty) + a done-checks-green log → reportsdone/status-log.ciwith the green marker absent (CI_LOG_STATEunknown) + a done log → reportsdone/status-log.All existing CI and coarse cases pass unchanged.
bin/fm-lint.shis green (pinned shellcheck 0.11.0, actionlint 1.7.12).Note on the validated run
The no-mistakes validation run for this branch passed every step (review, test, document, lint). Its lint step auto-added one extra commit — an environment-induced PATH fallback for the pinned lint tools (
bin/fm-lint.sh,bin/fm-lint-workflows.sh) — that only appeared because the gate environment lacked shellcheck/actionlint on PATH. That commit is unrelated to this finding and has been excluded from this PR for scope; this PR contains only the F-S07-2 change.