Skip to content

🐛 fix(automerge): route engine status-comment creates through the notification primitive - #16351

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
scanner/fix-16344
Nov 3, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
scanner/fix-16344

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

The automerge engine's status-comment create called the raw go-github client, bypassing the canary gate and effects journal of CreateIssueComment and hiding from TestNotificationWriteSitesInventory. It now goes through the transport's tagged CreateIssueComment, is inventoried as a status passthrough, and the raw-write baseline for automerge_stage_labels.go is lowered from 5 to 4.

Closes #16344

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 3, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nicholasjackson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#16386 ✨ feat(attention): status-card Attention section, per-repo tracking issue and 24h reminder policy same files src/docs/notifications.md
src/pkg/github/notification_write_sites.go
#16366 🐛 fix(prstatus): only treat this hive's own App login as the status-comment owner same files src/pkg/github/automerge/automerge_stage_labels.go
#16385 ✨ feat(notifications): refs sweep defers to the hive:status card; document Actions comment deduplication same files src/docs/notifications.md

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 3, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

hive/awaiting-ci: rebased onto v5; CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 11852a95a

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Review findings from reviewer (folded here because this head already carries its hive review):

Looks correct to me; read against the tree at 206a6a2.

What I verified

  • src/pkg/github/automerge/automerge_stage_labels.go:1549-1561 — the forge now asserts f.e.transport to a local issueCommenter interface and calls CreateIssueComment(ctx, owner+"/"+repo, number, body). That signature matches github.(*Client).CreateIssueComment at src/pkg/github/client.go:2941, so the production transport satisfies it; the comment then gets the canary gate, logscrub, the effects journal and recordNotificationWrite (client.go:2945-2979). This is the same shape the client-side adapter already uses at src/pkg/github/pr_status_comment.go:66.
  • Every production automerge.New(...) caller passes *hgithub.Client (cmd/hive/main.go:2274,2281, cmd/hive/main_sweeps.go:1449, cmd/hive/merge_eligibility.go:420, cmd/hive/review_preparation.go:32), and the stage tests build the engine on a real hgithub.NewClient against a fake server (automerge_stage_labels_test.go:264-268), so TestQuietNotificationsStageNotesFoldIntoOneEditedComment (automerge_quiet_notifications_test.go:28-50, asserts exactly one created comment) now exercises the new path rather than a fake that would miss the type assertion.
  • Inventory key automerge.(*engineStatusForge).CreateComment is derived from the package clause (notification_write_sites_test.go:62), so it is the right spelling even though the package lives under pkg/github/. Docs table, direct-writes-baseline.txt (raw 5→4, wrap +1) and changelog fragment all move together.
  • Scope matches [reviewer] Review backlog (correctness): engineStatusForge.CreateComment is a raw notifying create outside the inventory gate #16344 exactly: the issue names only engineStatusForge.CreateComment. The non-quiet create at automerge_stage_labels.go:1493 (c.gh.Issues.CreateComment directly) stays raw and is still counted in the baseline — not in this issue's scope, just noting it for whoever picks up the next one.

Suggestion (not a defect): there is no test asserting the engine forge is actually canary-gated (a body containing a canary → create refused). The ratchets fail without this diff, which covers the routing, but a one-case test on the quiet path would pin the property the issue asked for.

Hive filed review findings that do not block this PR as backlog items:

Cap: 10 backlog item(s) per PR per day.

Evidence bundle `#1635141813bb` sha256:394c27eb4767fa757cbb80a1582b5a4b640383b09e48ae93e5070929346d6c18 — download from the dashboard or `hivectl review evidence #16351`.

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 3, 2026
@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
@kubestellar-prow kubestellar-prow Bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 3, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 3, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conclusion: the routing change is right, but CI is red for a reason this diff owns, and the fix is one baseline line.

What I verified (tree at ccb61bb):

  • engineStatusForge.CreateComment (src/pkg/github/automerge/automerge_stage_labels.go:1533-1539) now type-asserts f.e.transport to issueCommenter and calls CreateIssueComment(ctx, "owner/repo", number, body). The production transport *github.Client has exactly that method (src/pkg/github/client.go:2938), so the canary gate / effects journal are now on this path as intended. The only caller is writeStatusSection (automerge_stage_labels.go:1492-1499) via prstatus.Write, which keeps Created semantics unchanged.
  • notification_write_sites.go + src/docs/notifications.md add the passthrough row, so TestNotificationWriteSitesInventory is satisfied.

Finding — TestDirectWriteRatchet fails (high, blocks merge):
src/pkg/writeback/ratchet_test.go:33 classifies any .CreateIssueComment( call as a tier-2 wrap write, and ratchet_test.go:73-74 records it per file. The new call at automerge_stage_labels.go:1538 therefore adds wrap pkg/github/automerge/automerge_stage_labels.go 1, but src/pkg/writeback/testdata/direct-writes-baseline.txt only has the raw … 5 → 4 edit. CI job test (rest 2/4) reports exactly this: wrap pkg/github/automerge/automerge_stage_labels.go: 1 direct write call(s) in a file not in the baseline. The coverage and test failures are downstream of the same package failing.

Fix: add wrap pkg/github/automerge/automerge_stage_labels.go 1 to the baseline, following the precedent at line 110 (wrap pkg/github/pr_status_comment.go 2) set when clientStatusForge made the same move.

Also: mergeable=CONFLICTING — the conflict is confined to src/docs/notifications.md (the passthrough table; a neighbouring row landed on v5). A rebase resolves it; the Go side auto-merges cleanly.

No other defects found; the issueCommenter interface declaration itself does not match the ratchet regex (no leading .), so the count after the fix is exactly 1.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read at 206a6a2 against v5. Looks correct to me.

  • automerge_stage_labels.go:1549-1554: engineStatusForge.CreateComment now routes through transport.(issueCommenter).CreateIssueComment, which is hgithub.(*Client).CreateIssueComment (pkg/github/client.go:2941) — the canary scan, logscrub, and effects.ExecuteReconciling journal all apply to the forge's create now. The type assertion fails closed with an error rather than falling back to the raw client.
  • Test coverage holds: newStageEngine (automerge_stage_labels_test.go:264) wires a real hgithub.NewClient at the httptest URL, so TestQuietNotificationsStageNotesFoldIntoOneEditedComment exercises the new path end-to-end against api.comments.
  • Baseline bookkeeping is consistent: automerge_stage_labels.go raw 5→4 and wrap +1; the remaining raw Issues.CreateComment at :1493 (non-quiet path) is intentionally out of scope for #16344.

Minor open question, not a defect: the issueCommenter interface is declared in automerge rather than next to the existing optional transport hooks (reviewEvidenceStarter, alreadyLandedCloserTransport) — same pattern, so fine as-is.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 3, 2026
@hivecommons-hive hivecommons-hive Bot removed the stage/050-review-pending Review swarm requested; awaiting a verdict for the current head label Nov 3, 2026
@hivecommons-hive hivecommons-hive Bot added the stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it label Nov 3, 2026
…ification primitive

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 3, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the tree at 11852a9, not just the diff. This looks correct to me.

  • src/pkg/github/automerge/automerge_stage_labels.go:1549-1554 now mirrors clientStatusForge.CreateComment (pkg/github/pr_status_comment.go:66) exactly: same owner/repo join, same CreateIssueComment primitive, so the canary gate, logscrub, the effects journal and recordNotificationWrite (client.go:2945-2979) all apply to the engine's status-comment create.
  • The type assertion on f.e.transport cannot fail in production (*hgithub.Client is the transport) and the quiet-notification tests already drive this path through a real hgithub.NewClient against httptest (automerge_stage_labels_test.go:264, automerge_quiet_notifications_test.go:29-60), so the "created once, then edited" assertion exercises the new code rather than a fake.
  • Baseline arithmetic checks out: one raw → wrap in direct-writes-baseline.txt; inventory and notifications.md rows added with the same class/passthrough as the client-side forge.

Info only, not a defect and out of #16344's scope: the non-quiet branch of the same writer (automerge_stage_labels.go:1493) still calls c.gh.Issues.CreateComment directly and is one of the 4 remaining raw writes in the baseline. Same follow-up shape if someone wants the engine fully inventoried.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit ae2d9d5 into v5 Nov 3, 2026
78 of 79 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-16344 branch November 3, 2026 05:38
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[reviewer] Review backlog (correctness): engineStatusForge.CreateComment is a raw notifying create outside the inventory gate

0 participants