fix(bin): require a real PR reference for the CI-ready done note - #6234
karotkriss wants to merge 1 commit into
Conversation
A "checks green" note counted as the CI-ready ship report whenever any uppercase PR appeared, so words such as PROD or PROPERTIES matched. Require a word-bounded PR #N, a /pull/N URL, or a /merge_requests/N URL. Fixes kunchenguid#6200
|
| # `/pull/N` URL, or a GitLab `/merge_requests/N` URL - so an uppercase "PR" | ||
| # inside a word such as PROD or PROPERTIES never counts. | ||
| fm_dod_note_reports_ci_ready() { # <note> | ||
| local re='(^|[^[:alnum:]_])PR #[0-9]+|/pull/[0-9]+|/merge_requests/[0-9]+' |
There was a problem hiding this comment.
Bare paths count as PRs A note such as
done: checks green; see /pull/12 passes this matcher even though /pull/12 is not a PR URL. If the run is still monitoring CI and the worker’s head is reachable outside its worktree, crew-state can report the task as done instead of working. Require the URL alternatives to match an actual PR URL, and add a negative test for bare paths.
|
Speaking as Kun's firstmate: whole thread read (body + Greptile P1). Diff reviewed vs main HEAD contract-class: VISION.md (each rule):
Outcome: |
Intent
Fixes #6200
fm_dod_note_reports_ci_readyinbin/fm-dod-lib.shdecides whether a status note is the CI-ready ship report with the substring glob*PR*"checks green"*|*"checks green"*PR*, so any uppercasePRinside a word matches: a note such aspaused: PROD deploy watch, checks green on TESTorwaiting: PROPERTIES table migration, checks greenis classified as a CI-ready done report, turning a task that is still monitoring into a completed one.A note should count as the CI-ready report only when it says "checks green" and carries a real PR reference (
PR #N, a/pull/NURL, or a/merge_requests/NURL).What Changed
fm_dod_note_reports_ci_readyinbin/fm-dod-lib.shstill requires "checks green", but it now also requires a real PR reference: a word-boundedPR #N, a/pull/NURL, or a/merge_requests/NURL. The old check used a*PR*substring glob, so an uppercase "PR" inside a word such asPRODorPROPERTIEScould make a still-monitoring note count as a CI-ready done report.test_ci_ready_needs_a_real_pr_referencetotests/fm-dod-lib.test.sh. It checks thatPROD ...,PROPERTIES ..., andchecks green, PR pendingare rejected, and thatPR #12, GitHub pull URLs, and GitLab merge request URLs are accepted.Fixes #6200
Risk Assessment
✅ Low: The change narrows a single shared classifier to exactly the three PR-reference forms the intent requires (word-bounded
PR #N,/pull/N,/merge_requests/N). Both consumers (fm_dod_should_gate_ship_done and fm-crew-state's log_reports_ci_ready) go through that one function, so they stay consistent. The new behavioral test fails on the old glob and passes on the new regex.Testing
I ran the real fm-crew-state.sh on base and on HEAD against disposable task fixtures. A fake no-mistakes reported a run still in its ci step. On base, all three notes without a real PR reference (PROD, PROPERTIES, and a note that says PR but gives no number) read as done. On HEAD they read as working. The three notes with real PR references read as done on both base and HEAD. The targeted fm-dod-lib and fm-crew-state test files both passed. Probing the matcher directly showsPR#12(no space) is no longer counted as CI-ready. The ship brief and fm-pr-check always use thePR <url>form, so that does not affect real reports. There is no UI to screenshot: these are CLI helpers, so the evidence is a before/after transcript.Evidence: fm-crew-state before/after transcript
Source: fm-crew-state before/after transcript
Evidence: Driver script for the crew-state scenarios
Source: Driver script for the crew-state scenarios
Evidence: CI-ready matcher edge cases
Source: CI-ready matcher edge cases
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
bin/fm-dod-lib.sh:467- The new pattern needs a space inPR #N, soPR#12 checks greenis no longer counted as CI-ready (the old substring glob accepted it). The generated brief and fm-pr-check.sh always writePR <url> checks green, so real reports are unaffected. The issue's suggested pattern (PR[[:space:]]*#) would also accept the no-space form if that matters.bash drive-crew-state.sh <base-tree>andbash drive-crew-state.sh <worktree>: runs the real bin/fm-crew-state.sh from base eb77f02 (extracted withgit archive) and from HEAD 4cb0813. Each run uses a disposable ship task with mode=no-mistakes whose no-mistakes run is still monitoring CI. The status notes cover PROD, PROPERTIES, a note that says PR but gives no number, /pull/N, /merge_requests/N and PR #N.bash tests/fm-dod-lib.test.sh(includes the new test_ci_ready_needs_a_real_pr_reference): all passedbash tests/fm-crew-state.test.sh: all passedCalled fm_dod_note_reports_ci_ready directly with edge-case notes: PR#12 (no space), (PR #12), SPR #12, a trailing /pull/N URL, a /pulls path, /pull/abc, and a note without 'checks green'✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.