Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-16344.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- fix(automerge): route the engine status-comment create through the tagged notification primitive (#16344)
1 change: 1 addition & 0 deletions src/docs/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ without a class. Review submissions and review requests are always counted as
| `github.(*Client).PostNoteOrFold` | `status` | passthrough wrapper; attributed to its caller |
| `github.(*Client).SweepLegacyFleetReportIssues` | `status` | |
| `github.(*Client).UpsertIssueMarkerComment` | `status` | passthrough wrapper; attributed to its caller |
| `automerge.(*engineStatusForge).CreateComment` | `status` | passthrough wrapper (status-comment forge under `prstatus.Write`); attributed to its caller |
| `github.(*clientStatusForge).CreateComment` | `status` | passthrough wrapper (status-comment forge under `prstatus.Write`); attributed to its caller |
| `github.(*Client).PostIssueNote` | `status` | passthrough wrapper (issue status card, `attention_pilot`); attributed to its caller |
| `github.(*Client).closeDecomposedParent` | `status` | |
Expand Down
13 changes: 11 additions & 2 deletions src/pkg/github/automerge/automerge_stage_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -1547,8 +1547,17 @@ func (f *engineStatusForge) EditComment(ctx context.Context, id int64, body stri
}

func (f *engineStatusForge) CreateComment(ctx context.Context, body string) error {
_, _, err := f.e.gh.Issues.CreateComment(ctx, f.owner, f.repo, f.number, &gh.IssueComment{Body: gh.Ptr(body)})
return err
commenter, ok := f.e.transport.(issueCommenter)
if !ok {
return fmt.Errorf("creating hive status comment on %s/%s#%d: transport has no comment primitive", f.owner, f.repo, f.number)
}
return commenter.CreateIssueComment(ctx, f.owner+"/"+f.repo, f.number, body)
}

// issueCommenter is the tagged notification-write primitive (canary gate,
// effects journal) the production transport, *hgithub.Client, provides.
type issueCommenter interface {
CreateIssueComment(ctx context.Context, repo string, number int, body string) error
}

func (f *engineStatusForge) DeleteComment(ctx context.Context, id int64) error {
Expand Down
17 changes: 9 additions & 8 deletions src/pkg/github/notification_write_sites.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ type NotificationWriteSite struct {
// same table is documented in src/docs/notifications.md.
var notificationWriteSites = map[string]NotificationWriteSite{
// Passthrough wrappers.
"github.(*Client).CreateIssueCommentBudgeted": {Class: NotificationClassStatus, Passthrough: true},
"github.(*Client).PostNoteOrFold": {Class: NotificationClassStatus, Passthrough: true},
"github.(*Client).RequestReviewers": {Class: NotificationClassRequiredReview, Passthrough: true},
"main.(*repoForgeRouter).CreateIssueComment": {Class: NotificationClassAttention, Passthrough: true},
"main.liveTriageCommenter.CreateIssueComment": {Class: NotificationClassAttention, Passthrough: true},
"github.(*Client).UpsertIssueMarkerComment": {Class: NotificationClassStatus, Passthrough: true},
"github.(*clientStatusForge).CreateComment": {Class: NotificationClassStatus, Passthrough: true},
"github.(*Client).PostIssueNote": {Class: NotificationClassStatus, Passthrough: true},
"github.(*Client).CreateIssueCommentBudgeted": {Class: NotificationClassStatus, Passthrough: true},
"github.(*Client).PostNoteOrFold": {Class: NotificationClassStatus, Passthrough: true},
"github.(*Client).RequestReviewers": {Class: NotificationClassRequiredReview, Passthrough: true},
"main.(*repoForgeRouter).CreateIssueComment": {Class: NotificationClassAttention, Passthrough: true},
"main.liveTriageCommenter.CreateIssueComment": {Class: NotificationClassAttention, Passthrough: true},
"github.(*Client).UpsertIssueMarkerComment": {Class: NotificationClassStatus, Passthrough: true},
"github.(*clientStatusForge).CreateComment": {Class: NotificationClassStatus, Passthrough: true},
"github.(*Client).PostIssueNote": {Class: NotificationClassStatus, Passthrough: true},
"automerge.(*engineStatusForge).CreateComment": {Class: NotificationClassStatus, Passthrough: true},

// status: bookkeeping readable on demand.
"dashboard.(*ContributeWSHub).markAlreadyDoneIssue": {Class: NotificationClassStatus},
Expand Down
3 changes: 2 additions & 1 deletion src/pkg/writeback/testdata/direct-writes-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ raw pkg/github/automerge/automerge_held_runs.go 3
raw pkg/github/automerge/automerge_merge_commit.go 1
raw pkg/github/automerge/automerge_merge_forward.go 1
raw pkg/github/automerge/automerge_stage_human.go 1
raw pkg/github/automerge/automerge_stage_labels.go 5
raw pkg/github/automerge/automerge_stage_labels.go 4
raw pkg/github/automerge/automerge_sweep_queued.go 3
raw pkg/github/automerge/automerge_sweep_trusted.go 4
raw pkg/github/automerge/automerge_unauthorized.go 3
Expand Down Expand Up @@ -81,6 +81,7 @@ wrap pkg/forge/gitea_forge.go 2
wrap pkg/forge/github_forge.go 3
wrap pkg/forge/gitlab_forge.go 2
wrap pkg/gfi/gfi.go 3
wrap pkg/github/automerge/automerge_stage_labels.go 1
wrap pkg/github/claimed_by_human_migration.go 2
wrap pkg/github/claimed_by_label.go 5
wrap pkg/github/clarity_gate_resume.go 1
Expand Down
Loading