Repository navigation
✨ feat: render RFC notices as summary-card embeds when rfc_format: card - #15973
thatguywob wants to merge 6 commits into
Conversation
Render an RFC event as a Discord summary card (embed) when rfc_format: card is configured on the designated announcer. Line mode is unchanged. - Add Body to github.IssueSnapshot and map it in rfcnotify.Issue. - Parse RFC target, status, scrubbed summary, and decisions count in rfcnotify.ParseRFC. - Render Discord embed with state-based color in rfcnotify.Card. - Fall back to plain Format when the RFC body is malformed. - Support SendEmbedTo and bounded 429 retries in pkg/discord. - Adapt Sweeper to Publisher interface. Hive-Run: hivecommons#15927 Hive-Plan: summary-card-embeds Hive-Spec: rfc-publishing#summary-cards Signed-off-by: thatguywob <thatguywob@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 |
|
@thatguywob this PR is back in your court ( Failing checks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Your relay session received this as a |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
CI triage — every red check is this PR's own diff (FIX_DIFF); the Three distinct causes:
Once 1–3 land, the remaining red ( 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Correctness review (head 5ecab6e8)
1. pkg/rfcnotify tests do not compile — src.since assigned a []Issue (blocker)
src/pkg/rfcnotify/card_test.go:328 and :399 do src.since = []Issue{...}, but fakeSource.since is []time.Time (rfcnotify_test.go:300); the scripted listing field is updated. The whole test package fails to build, which is why build-and-test, golangci-lint (cannot use []Issue{…} as []time.Time value in assignment) and every test (…) shard are red on this head. Both new sweeper tests (TestSweeperCardFormat_PostsCardAndFallsBackOnMalformed, TestSweeperCardFormat_PostCardFailureRollsBack) are therefore unexercised.
src.updated = []Issue{
(apply at both lines 328 and 399)
2. Card mode loses the transition itself
sweeper.go card branch calls pub.PostCard("", card) and Card() (card.go:277-333) emits only #N title, author, Target/Status/Decisions/Related and a colour. The information line mode carries — RFC opened / RFC closed (completed|not_planned) / RFC ready to implement (hold removed) / RFC doc accepted (RFC #N) (rfcnotify.go:235-257) — is gone, and colour alone is ambiguous: CardColor returns ColorCompleted for both a closed-completed issue and KindDocAccepted, and ColorReady for both KindReady and an already-actionable open RFC (card.go:250-271). A reader of the channel sees the same card for "opened" and "closed". LinkedRFC for doc-accepted events is also dropped. Suggest surfacing the event as the embed footer (or as content):
--- a/src/pkg/rfcnotify/card.go
+++ b/src/pkg/rfcnotify/card.go
@@ func Card(e Event, meta RFCMeta, includeRepo bool) Embed {
return Embed{
Title: cardTitle,
URL: strings.TrimSpace(e.Issue.URL),
Author: author,
Description: truncateRunes(meta.Summary, MaxDescriptionRunes),
Color: CardColor(e),
Fields: fields,
+ Footer: &discord.EmbedFooter{Text: eventLabel(e)},
}
}
+
+// eventLabel names the transition the card announces, mirroring Format.
+func eventLabel(e Event) string {
+ switch e.Kind {
+ case KindOpened:
+ if e.Issue.IsPR {
+ return "RFC doc proposed"
+ }
+ return "RFC opened"
+ case KindClosed:
+ return fmt.Sprintf("RFC closed (%s)", ClosedReason(e.Issue.StateReason))
+ case KindReady:
+ return "RFC ready to implement (hold removed)"
+ case KindDocAccepted:
+ if e.LinkedRFC > 0 {
+ return fmt.Sprintf("RFC doc accepted (RFC #%d)", e.LinkedRFC)
+ }
+ return "RFC doc accepted"
+ }
+ return "RFC " + string(e.Kind)
+}Advisory
Sweeper.Run(ctx, src, post any)(sweeper.go:176) erases the parameter type; a caller passing an unexpected func type now gets a runtime"source and poster are required"error instead of a compile error. Making the parameterPublisher(and having the wire passs.pub) keeps the check static —Posteralready satisfies it via the new methods.rfcnotify_wire.go:105-108still buildsnewPoster = discordRFCPoster(logger)but the result is never used after the newensurebranches; dead code.
— hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read the diff against v5 at merge-base 1. 2. Notes:
Body vs diff: everything the summary lists is present; Review findings from Read the diff against the v5 tree at merge-base Verified
Notes (low)
Review findings from Style review (head
Advisory: the Review findings from intent-alignment (delta re-review, head Previous findings: card_test.go compile error ( One new in-scope item from this delta: Unrelated test change bundled in (low) — - unwritable := filepath.Join(t.TempDir(), "missing")
- config.RuntimeConfigFile, config.DashboardOverlayFile = filepath.Join(unwritable, "runtime"), filepath.Join(unwritable, "overlay")
+ config.RuntimeConfigFile, config.DashboardOverlayFile = t.TempDir(), t.TempDir()Advisory (not this perspective's call): golangci-lint still fails at this head on code outside the delta — |
… persistence test - Assign updated instead of since on fakeSource in card_test.go - Guard redirectTransport against nil httptest.Server in newTestBot - Provide statePath in TestRFCNotifyWire_CardFormatPostsEmbed to persist state across forcePoll - Point trigger persistence test storage paths to uncreatable locations Hive-Fix-Attempt: 1/6 Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
Apply logscrub.ScrubString to embed field values extracted from contributor-controlled RFC tables and add TestCard_FieldScrubbing. Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
|
Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. |
|
@thatguywob this PR is back in your court ( Failing checks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Your relay session received this as a |
There was a problem hiding this comment.
Correctness re-review @ c23c087 (delta from 5ecab6e)
Previous findings: card_test.go compile error (src.since) — fixed (card_test.go:350, 421). Unscrubbed Target/Status/Related fields — fixed (card.go:299, 306, 320 + TestCard_FieldScrubbing). Poster.PostCard title-only fallback (sweeper.go:50-55) — still present, but production wiring uses botPublisher (rfcnotify_wire.go:132-134), so it only affects callers injecting a bare Poster; low.
New (in-scope, blocks CI): golangci-lint fails at this head on two lines of PR-added code.
src/pkg/rfcnotify/sweeper.go:64— staticcheck SA4020:case Poster:is unreachable becausePosterimplementsPublisherand thecase Publisher:at :62 always matches first. Drop the dead clause:
switch p := post.(type) {
case Publisher:
return p
case func(content string) error:
return Poster(p)
default:
return nil
}
src/cmd/hive/rfcnotify_wire.go:105-108— ineffassign: the localnewPosteris assigned (falling back todiscordRFCPoster(logger)) and never read;ensurelater branches ons.newPosterdirectly (:127). Delete the block (production correctly lands onbotPublisherat :132-134 for the card path):
- newPoster := s.newPoster
- if newPoster == nil {
- newPoster = discordRFCPoster(logger)
- }
gates := rfcNotifyGatesFor(cfg, repos)(If discordRFCPoster then has no remaining callers, remove it too or the next lint pass flags unused.)
Advisory: src/pkg/dashboard/api_event_triggers_test.go:177-178 is an unrelated test change riding along in this PR.
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
- Remove ineffectual newPoster assignment and unused discordRFCPoster in cmd/hive/rfcnotify_wire.go - Remove unreachable Poster case in rfcnotify.toPublisher type switch Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
There was a problem hiding this comment.
Correctness re-review at ecb7b1c (delta from c23c087: src/cmd/hive/rfcnotify_wire.go, src/pkg/rfcnotify/sweeper.go).
- Fixed: unreachable
case PosterintoPublisherremoved (Posteralready satisfiesPublisherviasweeper.go:44-55, socase Publishercovers it). DeadnewPosterlocal anddiscordRFCPosterremoved fromrfcnotify_wire.go; no remaining references.go build ./cmd/hive/ ./pkg/rfcnotify/passes at head. - Still present (advisory, non-blocking):
Sweeper.Run(ctx, src, post any)atsrc/pkg/rfcnotify/sweeper.go:176. The only production caller passes aPublisher(rfcnotify_wire.go:356); a wrong type is caught by the nil guard at runtime (sweeper.go:178-180) instead of compile time. If you want to tighten it, takePublisherand wrap the func literals in tests withrfcnotify.Poster(post):
func (s *Sweeper) Run(ctx context.Context, src Source, pub Publisher) (Result, error) {
var res Result
if src == nil || pub == nil {
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@thatguywob this PR is back in your court ( Review asks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Queued in your relay fix queue (1 waiting): fixes are handed out before new work as soon as you have capacity. |
Send the formatted lifecycle event alongside cards so Discord and plain-poster fallbacks retain the transition, URL and linked RFC. Exclude checked numbered decisions, require Publisher at compile time, and cover lifecycle transitions in both publishing paths. Drop the unrelated dashboard persistence test change as requested in review. Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
CI at 146f530 fails TestEventTriggersRejectInvalidAndUnpersistedRules in both dashboard 2/4 and dashboard shuffle 2/3. Save removes the empty directory used as RuntimeConfigFile and retries successfully, returning HTTP 200 instead of the expected failure. Use paths beneath a missing parent so persistence still fails after the remove-and-retry recovery. Keep this base-test repair separate from RFC card changes for review and bisectability. Related: hivecommons#15978. Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
There was a problem hiding this comment.
Delta re-review at d53f1a9 (vs ecb7b1c): every finding tracked on this PR is now addressed; looks correct to me. CI for this head is still running, so a maintainer should wait for it to go green before merging.
What I verified in the delta:
- Transition text restored in card mode —
src/pkg/rfcnotify/sweeper.go:220-229buildsmsg := Format(ev, …)once and passes it ascontenttopub.PostCard(msg, card), so the "RFC opened / ready / closed (…) / doc accepted" lead and the<URL>ride alongside the embed.Poster.PostCard(sweeper.go:49-54) now postscontentwhen non-empty, so the plain-func fallback no longer collapses to the bare#N title. Covered byTestSweeperCardFormat_PreservesTransitionsfor both publisher kinds. Changelog fragment andsrc/docs/notifications.md:213updated to say so. - Numbered checked decisions —
card.go:51addsnumberedCheckboxRE(1. [x],1) [x],(1) [x]) andisCheckedCheckbox(card.go:208) consults it before the numbered-item fallback, so4. [x] Completed …is no longer counted as open. Test rows added atcard_test.go. Sweeper.Runsignature —sweeper.go:160takespub Publisheragain;toPublisherand the runtime type switch are gone. The production callersrc/cmd/hive/rfcnotify_wire.go:356passesstate.pubunchanged, and the tests wrap bare funcs asPoster(post)(pr_test.go:156-172).
One note, not blocking: src/pkg/dashboard/api_event_triggers_test.go:177-180 (the unwritable-path fix, now with an explanatory comment) is the same change #15977 also carries. Whichever lands second will see a trivial conflict or no-op there; it is tracked separately as #15978.
I have not approved or closed anything.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@thatguywob this PR is back in your court ( Review asks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Your relay could not take this as a |
|
Pushed new head
🐝 Hive Agent: |
Summary
Render an RFC event as a Discord summary card (embed) alongside its transition line when
rfc_format: cardis configured on the designated announcer. Card mode retains the lifecycle transition text and linked RFC alongside the embed. Line mode remains unchanged.Body stringtogithub.IssueSnapshotand mapped torfcnotify.Issueincmd/hive/rfcnotify_wire.go.rfcnotify.ParseRFCextracting Target, Status, scrubbed summary (≤300 runes), and open decisions count, excluding checked bullet and numbered items.rfcnotify.Cardbuilding Discord embeds with state-based color (held grey, needs-decision amber, ready green, closed completed blue, closed not-planned dark).Formatwhen an RFC body cannot be parsed (no table and no summary).pkg/discordwithEmbedtypes andSendEmbedTo. The shared HTTP path retries HTTP 429 once with a delay capped at 5 seconds; this also applies to ordinary command-bot messages.Sweeperto the typedPublisherinterface supporting bothPostandPostCard; plain posters retain the complete transition line, including linked RFC references.changelog.d/added-rfc-notify-cards.mdand documentation insrc/docs/notifications.md.Related issues
Closes #15927
Part of #15869
cc @hanthor
Testing
gofmt -lclean across modified Go files;git diff --checkclean.146f530e1failedTestEventTriggersRejectInvalidAndUnpersistedRulesin both dashboard 2/4 and dashboard shuffle 2/3. The empty runtime-path directory is removed by Save's recovery retry, making the save succeed. Paths under a missing parent keep the intended failure deterministic. Related: [reviewer] Review backlog (style): Unrelated dashboard test change bundled into RFC card feature PR #15978.— hive: backend=agy
🐝 Hive Agent:
contributor| SHA:5ecab6e84