Repository navigation
🌱 chore(stageengine): share decision-cause prose between automerge and goldens test - #15385
Conversation
…d goldens The goldens test re-declared decisionCauseFor's prose string-for-string, so rewording had to be applied twice or the goldens drifted. The prose now lives once in pkg/stageengine/prstage, which both packages already import. Rendered bytes are unchanged; goldens untouched. Closes #15384 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Generated by changelog-fragment-guard from the PR title (#5675). Edit the wording freely, or replace this file with the no-changelog label if the change is not user-visible. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Looks correct to me. Verified against the v5 tree at 5a490c7:
- Bytes unchanged, confirmed mechanically. All 10 prose literals removed from
src/pkg/stageengine/stage_goldens_test.go(decisionCause, old lines 1083–1106) are byte-identical to the constants/functions now insrc/pkg/stageengine/prstage/causes.go; the two extra entries there (WorkflowApprovalCommand,CauseWorkflowPathAwaitingApproval) match the literals removed fromautomerge_stage_human.go:367-369andautomerge_held_runs.go:87("/ok-to-test"). - No import cycle.
pkg/oktotestimports nothing from the module, andprstagealready sits below bothstageengineandautomerge, so the newprstage → oktotestedge is safe.go build ./pkg/stageengine/... ./pkg/github/automerge/is clean on the PR head. TestDecisionCauseUsesSharedProse(automerge_decision_cause_test.go:11) is the right ratchet: it fails if either side reverts to a local string.
One non-blocking suggestion: workflowApprovalCommand at src/pkg/github/automerge/automerge_held_runs.go:87 is still its own "/ok-to-test" literal, and it is what the sweep actually posts (automerge_held_runs.go:400,435,449). Aliasing it (workflowApprovalCommand = prstage.WorkflowApprovalCommand) would close the last place where the posted command and the prose describing it can drift. Fine as a follow-up.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Looks correct to me — verified against the v5 tree at merge-base 930dcb4, not just the diff.
- Rendered bytes unchanged: every constant/func in
src/pkg/stageengine/prstage/causes.gois the exact literal it replaces inautomerge_stage_human.go:366-413andstage_goldens_test.go:1083-1106.prstage.WorkflowApprovalCommand(/ok-to-test) matches automerge's ownworkflowApprovalCommandatautomerge_held_runs.go:87, which stays in use there. - No import cycle:
prstageimportsoktotest(imports nothing from hive),authorkind,reviewtext,stagelabels— none depend onstageengineorautomerge; automerge already importedprstagein 16 files.go build ./pkg/stageengine/... ./pkg/github/automerge/is clean on the head. - Extraction is complete for its scope: the only remaining literal copies of this prose are fixtures in
pkg/stagelabels/human_test.go:191,268(stagelabelscannot importprstagewithout a cycle). The three causes still spelled out in automerge (unauthorizedReasonPrefix, the twoautoMergeReasonMergeRefused*, lines 401-409) are not mirrored by the goldens copy on v5 or v6, so no drift there. TestDecisionCauseUsesSharedProsepinsdecisionCauseto the shared prose; it would not compile without the extraction, which is the right failure mode for #15384.
Note for the forward-merge: #15382 (the PR this issue was blocked on) landed on v6, this fix targets v5; nothing conflicts, just worth knowing when it is carried forward.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Reviewed (intent-alignment) — diff matches #15384: the cause prose now lives once in src/pkg/stageengine/prstage/causes.go and both automerge_stage_human.go:368-413 and stage_goldens_test.go:1083-1106 consume it; wording is byte-identical to the merge-base literals, no import cycle (pkg/oktotest imports no hive packages).
Advisory, non-blocking: prstage.WorkflowApprovalCommand (causes.go:7) is a second copy of the /ok-to-test literal that automerge_held_runs.go:87 still defines locally and uses to post the actual comment. If one is edited without the other, the rendered cause would name a command the hive no longer posts — the same drift class this PR removes. automerge_held_runs.go:60 already aliases prstage.WorkflowApprovalRequiredPrefix; workflowApprovalCommand = prstage.WorkflowApprovalCommand would close it.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Reviewed (correctness) — no blocking findings; one advisory.
src/pkg/stageengine/prstage/causes.go:7introducesWorkflowApprovalCommand = "/ok-to-test", while the command automerge actually posts is still the separate literalworkflowApprovalCommand = "/ok-to-test"atsrc/pkg/github/automerge/automerge_held_runs.go:87. The two agree today, so rendered bytes are unchanged as the PR body states, but the 085 prose and the posted comment can now drift independently — the same shape of duplication #15384 set out to remove. SuggestworkflowApprovalCommand = prstage.WorkflowApprovalCommandinautomerge_held_runs.go, matching how that file already aliasesworkflowApprovalRequiredPrefix = prstage.WorkflowApprovalRequiredPrefix(line 60).
Verified: every literal in causes.go matches the base goldens/automerge strings byte-for-byte; prstage → oktotest adds no import cycle (oktotest imports no hive packages); automerge_stage_human.go:473-476 still uses oktotest, and no other stageengine test referenced the removed workflowApprovalCommand/oktotest import.
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
The goldens test re-declared decisionCauseFor's prose string-for-string, so any rewording had to land twice or the goldens drifted. The prose now lives once in pkg/stageengine/prstage, which both packages already import. Rendered bytes are unchanged; goldens untouched.
Closes #15384
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88