Repository navigation
feat(bin): carry a linked issue into the no-mistakes PR body - #8532
Closed
tiago-peixoto wants to merge 1 commit into
Closed
tiago-peixoto wants to merge 1 commit into
tiago-peixoto wants to merge 1 commit into
Conversation
Ship briefs had no field for the issue a task closes, so the pipeline's PR body only mentioned it and GitHub never linked it. fm-brief.sh now takes an opt-in --closes <issue>. A no-mistakes brief passes `--closes <issue>` on every run that starts, and a pr=manual brief, whose run skips the pr step, asks for a plain `Closes #<issue>` line in the hand-written body. Without the flag every brief is unchanged. Fixes kunchenguid#8504
Contributor
Author
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.
Fixes #8504.
Intent
Fixes
#8504Ship workers never pass
--closes, so a pipeline-written PR body leaves the linked issue unlinked (it only gets a backticked mention, which GitHub does not treat as a closing reference).Upstream issue: #8504, labelled ready-for-pr.
Maintainer triage (#8504 (comment)), checked on main 427056c: nothing in the repo passes
--closes; the drive block inbin/fm-dod-lib.shstarts and reattaches the run with plainno-mistakes axi run, and the ship brief has no field that carries a linked issue to that call. Seen on PRs 5341 and 4893.The maintainer's notes for the fix:
--closes <n>only when that field is set, on everyno-mistakes axi runthat starts a run, so a later run keeps the reference. A worker should never infer an issue link it wasn't given.--skip pr,ci, where the worker writes the body itself) should put the same field into a plainCloses #<n>line.What Changed
bin/fm-brief.shaccepts a new ship-only--closes <issue>option and passes it tofm_dod_block. It is refused on scout and secondmate briefs, and an empty value is an error.bin/fm-dod-lib.shaddsfm_closes_issue_valid, which accepts only a plain issue number with no leading zero, and only formode=no-mistakeswithout Gerrit. When the issue is set, the no-mistakes Definition of done tells the worker to pass--closes <n>on everyno-mistakes axi runthat starts a run. Under--pr manualit asks for a plainCloses #<n>line in the PR body the worker writes instead. Without--closes, the brief text is unchanged.tests/fm-brief.test.shcovers the generated brief with the issue set and unset, for both the pipeline-written and the manual PR body paths.Risk Assessment
✅ Low: The change is an opt-in flag that only changes generated brief text when it is set, it reuses the existing validate-then-render pattern of --base-branch, and the test checks the generated brief for both the set and the unset case.
Testing
I ran the real fm-brief.sh CLI in a throwaway FM_HOME for the issue-set, issue-unset and pr=manual cases. Unset briefs match base 427056c byte for byte once temp paths are normalized. Setting the issue adds exactly one Definition-of-done line in each case. All 11 invalid or unsupported inputs exit 1 with a reason and leave no brief. I read the installed no-mistakes v1.106.1 binary's strings:
--closesexists and is refused with--skip pr, which justifies the manual-PR wording. The five test files in the verification plan pass, including the new test_closes_issue_is_rendered_only_when_set. I did not run fm-lint.sh or fm-doc-audience-check.sh because lint is out of scope for this step. I did not start a real no-mistakes run because the gate forbids invokingaxi run, so the end-to-end PR body is not proven here. The output is a text brief, not a UI, so the generated briefs are the evidence instead of screenshots.--closes 8504on every run start--skip pr,ci) with --closes 8504; the brief asks for a plainCloses #8504line and does not pass --closesCloses #8504into the PR body it opensno-mistakes axi run, and a real run would need a forge PR. That behavior belongs to no-mistakes, not this change. To prove it, run a disposable lab ship with --closes…Evidence: No-mistakes brief generated with --closes 8504
Source: No-mistakes brief generated with --closes 8504
Evidence: pr=manual brief generated with --closes 8504
Source: pr=manual brief generated with --closes 8504
Evidence: Set vs unset brief diffs (one added line each)
Source: Set vs unset brief diffs (one added line each)
Evidence: Unset briefs byte-identical to base 427056c
Source: Unset briefs byte-identical to base 427056c4
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-promote.sh:349- bin/fm-promote.sh:349 still calls fm_dod_block with seven arguments and has no --closes option, and a scout brief refuses --closes (bin/fm-brief.sh:362). So a scout promoted to a no-mistakes ship has no way to carry a linked issue, and its runs start without --closes. The intent names the ship brief or a task field and does not mention promotion, so this change does not violate it. Recorded only so the gap is a deliberate choice.✅ **Test** - passed
✅ No issues found.
--closes 8504on every run start--skip pr,ci) with --closes 8504; the brief asks for a plainCloses #8504line and does not pass --closesCloses #8504into the PR body it opensno-mistakes axi run, and a real run would need a forge PR. That behavior belongs to no-mistakes, not this change. To prove it, run a disposable lab ship with --closes…FM_HOME=<tmp> bin/fm-brief.sh nm-set some-proj --mode no-mistakes --closes 8504(and--closes=8504)FM_HOME=<tmp> bin/fm-brief.sh man-set some-proj --mode no-mistakes --pr manual --closes 8504Unset briefs from this change vs.git archive 427056c4 binbriefs, diffed with temp paths normalized11 invalid--closesinvocations (direct-PR, local-only, gerrit, scout, #12, 012, 0, -5, owner/repo#12, empty, missing value)stringson the installed no-mistakes v1.106.1 binary to confirm--closesexists and is refused with--skip prbash tests/fm-brief.test.shbash tests/fm-dod-lib.test.shbash tests/fm-task-delivery.test.shbash tests/fm-self-repo-role.test.shbash tests/fm-spawn-manual-pr-text.test.shAGENTS.md:197-bin/fm-brief.sh --closes <issue>is documented only in the script header. AGENTS.md tells firstmate when to pass--base-branchat intake (line 197), but nothing tells firstmate to pass--closeswhen a task is explicitly linked to an issue. Without that guidance, briefs may never carry the flag, and Ship workers never pass--closes, so pipeline-written PR bodies leave the linked issue unlinked #8504 would stay unfixed in practice. AGENTS.md content is a human decision, so this phase did not add the line. Decide whether to add one sentence next to the--base-branchguidance.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.