diff --git a/AGENTS.md b/AGENTS.md index 40acf5c113..d779d8f607 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,7 +11,7 @@ These rules apply to every AI agent (hive agents, Copilot CLI, Claude Code, Code ## Working style - Keep changes surgical and PR-sized; one concern per PR. -- Sign commits (`git commit -s`); PR titles start with an emoji (`โœจ` feature, `๐Ÿ›` fix, `๐Ÿ“–` docs, `๐Ÿ“` proposal, `๐ŸŒฑ` chore, `โš ๏ธ` breaking); `๐Ÿ“` is for proposals only. +- Sign commits (`git commit -s`); PR titles start with an emoji (`โœจ` feature, `๐Ÿ›` fix, `๐Ÿ“–` docs or proposal, `๐ŸŒฑ` chore, `โš ๏ธ` breaking); `๐Ÿ“` fails the PR Type gate. - Every PR with a user-visible `src/` code change needs a `changelog.d/-.md` fragment at the repository root whose body is a single `- ` bullet. - Do not hand-edit `src/docs` file:line citations; when CI's citation guard reports drift, run `python3 src/scripts/check-docs-citations.py --fix`. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 207f708cc0..42352f1863 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -332,7 +332,7 @@ When a fix PR merges with `Closes #N`, `Fixes #N`, or `Resolves #N`, the issue c ## Pull requests - Target `v5` for all code and documentation contributions (the active development branch). `v4` is feature-frozen and accepts security and critical fixes only (see the base-branch table above). -- Start PR titles with the repository's emoji convention: `โœจ feature: ...`, `๐Ÿ› fix: ...`, `๐Ÿ“– docs: ...`, `๐Ÿ“ proposal: ...`, `โš ๏ธ` for a breaking change, `๐ŸŒฑ` for chores and everything else. `๐Ÿ“` is for proposals only โ€” a documentation PR is `๐Ÿ“– docs: ...`, and the required `PR Type` check fails the swap. +- Start PR titles with the repository's emoji convention: `โœจ feature: ...`, `๐Ÿ› fix: ...`, `๐Ÿ“– docs: ...`, `๐Ÿ“– proposal: ...`, `โš ๏ธ` for a breaking change, `๐ŸŒฑ` for chores and everything else. The required `PR Type` check accepts only `โš  โœจ ๐Ÿ› ๐Ÿ“– ๐Ÿš€ ๐ŸŒฑ`, so `๐Ÿ“` fails it; the hive rewrites a leading `๐Ÿ“` on `proposal:`/`rfc:` to `๐Ÿ“–`. - Include `Fixes #` lines for issues the PR closes. - Credit the issue's author with a `Co-authored-by:` trailer on the commit when the PR resolves somebody else's issue โ€” see [Crediting issue authors](#crediting-issue-authors). - Describe what changed, why, and how you tested it. diff --git a/changelog.d/fixed-17105.md b/changelog.d/fixed-17105.md new file mode 100644 index 0000000000..190591048c --- /dev/null +++ b/changelog.d/fixed-17105.md @@ -0,0 +1 @@ +- PR titles for proposals now use the `๐Ÿ“– proposal:` prefix, which the required `PR Type` check accepts (`๐Ÿ“` never passed it); existing `๐Ÿ“ proposal:`/`๐Ÿ“ RFC` titles are still recognised as RFC documents and are rewritten to `๐Ÿ“–` when the hive opens a PR (#17105). diff --git a/src/docs/notifications.md b/src/docs/notifications.md index ec1b219282..5fc74c537f 100644 --- a/src/docs/notifications.md +++ b/src/docs/notifications.md @@ -327,7 +327,7 @@ These keys sit next to `rfc_channel_id`. All of them default off, and with none | `rfc_include_private` | `false` | Authorizes posting RFCs from private repositories to the channel. | - **Announcer rule.** Rich mode means `rfc_format: card` or `rfc_threads: true`. A hive in rich mode without `rfc_announcer: true` posts nothing and logs `rfc notify: rich mode requires rfc_announcer; not posting` once. It keeps recording transitions, so turning on the announcer later does not backfill old ones. Set `rfc_announcer: true` on exactly one hive per channel. Line mode ignores the key. -- **RFC documents proposed as pull requests (rich mode only).** A pull request is an RFC document when its title starts with `๐Ÿ“ proposal:` or `๐Ÿ“ RFC`, or it adds or changes `docs/rfc-*.md` or `src/docs/rfc-*.md`. The announcer posts `RFC doc proposed: #N - <url> (by @author)` when one opens, titled by the document's first heading when the hive read it, and `RFC doc accepted (RFC #M): ...` when it merges, attributed to the RFC issue its body links (`Closes`/`Refs #M` or an issue URL), or `RFC doc accepted: ...` when it links none the hive tracks. PRs already open when the hive takes its baseline are not announced, and a PR closed without merging posts nothing. Each poll lists pull requests updated since the last poll, plus the changed files of those whose title does not already mark them. Line mode stays issues-only. +- **RFC documents proposed as pull requests (rich mode only).** A pull request is an RFC document when its title starts with `๐Ÿ“– proposal:` or `๐Ÿ“– RFC` (a leading `๐Ÿ“` still counts), or it adds or changes `docs/rfc-*.md` or `src/docs/rfc-*.md`. The announcer posts `RFC doc proposed: #N <title> - <url> (by @author)` when one opens, titled by the document's first heading when the hive read it, and `RFC doc accepted (RFC #M): ...` when it merges, attributed to the RFC issue its body links (`Closes`/`Refs #M` or an issue URL), or `RFC doc accepted: ...` when it links none the hive tracks. PRs already open when the hive takes its baseline are not announced, and a PR closed without merging posts nothing. Each poll lists pull requests updated since the last poll, plus the changed files of those whose title does not already mark them. Line mode stays issues-only. - **Lifecycle changes (rich mode only).** On the announcer the hive also posts one line per change to an open RFC: `RFC decisions: 2 โ†’ 1 open: ...` when the open count under *Decisions for maintainers* changes (at most one per RFC per 30 minutes; changes inside that window collapse into the next notice with the latest count), `RFC target: v5 โ†’ v6: ...` and `RFC status: <old> โ†’ <new>: ...` (values cut to 100 characters) when the RFC field table changes (a body that no longer parses is not a change), and `RFC needs a decision: ...` when `stage/045-needs-decision` or `needs-human` is added. A retitle posts nothing: with `rfc_threads` it edits the opened card in place and renames the thread. An RFC opened by the same author with the same title (lowercased, RFC prefix, leading bracketed tags such as `[v5 RFC]` or `[v6]` and emoji removed, leading/trailing punctuation stripped, whitespace collapsed) as an open RFC in the same repo opened up to an hour earlier gets no card: the hive posts `RFC duplicate filed as #M - <url>` once into the first RFC's thread, and closing the duplicate posts nothing. These lines are never cards. With `rfc_threads` they go into the RFC's thread; otherwise to the channel. The 30-minute and one-hour windows are fixed. Line mode posts none of them. - **Private rule (every mode, line mode included).** An RFC in a private or `internal` repository is not posted unless `rfc_include_private: true`. This keeps its title and link out of the channel. The hive resolves each repo's visibility once and caches it for an hour. A repo whose visibility cannot be resolved counts as private (fail closed). A withheld transition is still recorded, so it is never posted later. diff --git a/src/pkg/github/pr_request_watcher_test.go b/src/pkg/github/pr_request_watcher_test.go index 5f0e1c27b5..f133eecd53 100644 --- a/src/pkg/github/pr_request_watcher_test.go +++ b/src/pkg/github/pr_request_watcher_test.go @@ -473,7 +473,7 @@ func TestPRRequestWatcher_QuarantinesAfterMaxAge(t *testing.T) { // The hive-open-pr choke point corrects a title emoji that contradicts the // Conventional Commits type (hivecommons/hive#13131: "๐Ÿ“ docs: โ€ฆ" failed the -// repo's PR Type gate; ๐Ÿ“ is the proposal emoji, docs is ๐Ÿ“–). +// repo's PR Type gate; ๐Ÿ“ is not a prefix the gate accepts, docs is ๐Ÿ“–). func TestPRRequestWatcher_CorrectsTitleEmojiToConvention(t *testing.T) { var createdTitle string inner := newPRMockServer(t, "", nil) diff --git a/src/pkg/github/pr_title.go b/src/pkg/github/pr_title.go index 522695c721..cc54f166d3 100644 --- a/src/pkg/github/pr_title.go +++ b/src/pkg/github/pr_title.go @@ -44,13 +44,14 @@ func NormalizePRTitle(title string) string { // The PR-title emoji convention (CONTRIBUTING.md, AGENTS.md): one emoji // per change kind, checked by the repository's `PR Type` gate. ๐Ÿ“– is -// documentation and ๐Ÿ“ is a proposal โ€” hivecommons/hive#13131 opened a docs -// PR as "๐Ÿ“ docs: โ€ฆ" and failed the gate on exactly that swap. +// documentation and proposals alike (the gate accepts only the kubebuilder +// set โš  โœจ ๐Ÿ› ๐Ÿ“– ๐Ÿš€ ๐ŸŒฑ, so ๐Ÿ“ fails it, hivecommons/hive#17105); +// hivecommons/hive#13131 opened a docs PR as "๐Ÿ“ docs: โ€ฆ" and failed too. const ( PRTitleEmojiFeature = "โœจ" PRTitleEmojiFix = "๐Ÿ›" PRTitleEmojiDocs = "๐Ÿ“–" - PRTitleEmojiProposal = "๐Ÿ“" + PRTitleEmojiProposal = "๐Ÿ“–" PRTitleEmojiBreaking = "โš ๏ธ" PRTitleEmojiOther = "๐ŸŒฑ" ) diff --git a/src/pkg/github/pr_title_test.go b/src/pkg/github/pr_title_test.go index 10208ee5d1..f7d051bd1e 100644 --- a/src/pkg/github/pr_title_test.go +++ b/src/pkg/github/pr_title_test.go @@ -100,8 +100,10 @@ func TestNormalizePRTitleEmoji(t *testing.T) { // hivecommons/hive#13131: a docs PR opened as ๐Ÿ“ failed the PR Type gate. {name: "docs under proposal emoji", input: "๐Ÿ“ docs: describe Prow dco-signoff labels as coexisting with hive's dco pair", want: "๐Ÿ“– docs: describe Prow dco-signoff labels as coexisting with hive's dco pair"}, {name: "docs already right", input: "๐Ÿ“– docs: explain exit 77", want: "๐Ÿ“– docs: explain exit 77"}, - {name: "proposal keeps its emoji", input: "๐Ÿ“ proposal: central stage engine", want: "๐Ÿ“ proposal: central stage engine"}, - {name: "rfc is a proposal", input: "๐Ÿ“– rfc: opportunity lab", want: "๐Ÿ“ rfc: opportunity lab"}, + {name: "proposal keeps its emoji", input: "๐Ÿ“– proposal: central stage engine", want: "๐Ÿ“– proposal: central stage engine"}, + // hivecommons/hive#17105: ๐Ÿ“ is not in the PR Type gate's set. + {name: "legacy proposal emoji is normalised", input: "๐Ÿ“ proposal: central stage engine", want: "๐Ÿ“– proposal: central stage engine"}, + {name: "rfc is a proposal", input: "๐Ÿ“ rfc: opportunity lab", want: "๐Ÿ“– rfc: opportunity lab"}, {name: "fix under docs emoji", input: "๐Ÿ“– fix(ci): retry GHCR", want: "๐Ÿ› fix(ci): retry GHCR"}, {name: "fix under lock emoji", input: "๐Ÿ”’ fix: polkit defaults", want: "๐Ÿ› fix: polkit defaults"}, {name: "feat", input: "๐Ÿ› feat: owner-only sharing", want: "โœจ feat: owner-only sharing"}, diff --git a/src/pkg/github/review_priority.go b/src/pkg/github/review_priority.go index a6a33878b5..959ac77077 100644 --- a/src/pkg/github/review_priority.go +++ b/src/pkg/github/review_priority.go @@ -61,8 +61,10 @@ func reviewRank(c ReviewClass) int { } // Title-prefix signals, checked in this order. The emoji set follows -// CONTRIBUTING.md's PR-title convention (๐Ÿ› fix, ๐Ÿ“– docs, ๐Ÿ“ proposal, ...; -// see PRTitleEmoji* in pr_title.go โ€” a proposal triages with docs); the word +// CONTRIBUTING.md's PR-title convention (๐Ÿ› fix, ๐Ÿ“– docs or proposal, ...; +// see PRTitleEmoji* in pr_title.go โ€” a proposal triages with docs). The +// literal ๐Ÿ“ stays so pre-existing "๐Ÿ“ RFC: โ€ฆ" / "๐Ÿ“ Epic: โ€ฆ" titles, which +// have no word-prefix match, still classify by title; the word // prefixes are the conventional-commit forms agents and humans both use // ("fix:", "fix(proxy):", "refactor:", "test:") plus the "[lane]" prefix that // classify.classifyLane already treats as the most explicit routing signal. @@ -71,7 +73,7 @@ func reviewRank(c ReviewClass) int { var ( reviewFixEmojiPrefixes = []string{"๐Ÿ›", "๐Ÿ”’", "๐Ÿ›ก", "๐Ÿš‘", "๐Ÿ”ฅ"} reviewTestEmojiPrefixes = []string{"๐Ÿงช", "โœ…"} - reviewDocsEmojiPrefixes = []string{PRTitleEmojiDocs, PRTitleEmojiProposal, "๐Ÿ—", "โ™ป"} + reviewDocsEmojiPrefixes = []string{PRTitleEmojiDocs, PRTitleEmojiProposal, "๐Ÿ“", "๐Ÿ—", "โ™ป"} reviewFixWordPrefixes = []string{"fix", "hotfix", "bugfix", "security", "sec", "[scanner]", "[ci-maintainer]", "[sec-check]"} reviewTestWordPrefixes = []string{"test", "tests", "coverage", "[quality]"} diff --git a/src/pkg/github/review_priority_test.go b/src/pkg/github/review_priority_test.go index 191d992303..e6da581d47 100644 --- a/src/pkg/github/review_priority_test.go +++ b/src/pkg/github/review_priority_test.go @@ -24,6 +24,7 @@ func TestClassifyReviewClass(t *testing.T) { {"architect prefix", "[architect] refactor: drop dead snapshot dir", nil, ReviewClassRefactorDocs}, {"refactor word", "refactor: collapse duplicate status builders", nil, ReviewClassRefactorDocs}, {"docs emoji", "๐Ÿ“– docs: explain exit 77 netfilter", nil, ReviewClassRefactorDocs}, + {"legacy proposal emoji", "๐Ÿ“ RFC: agent memory tiers", nil, ReviewClassRefactorDocs}, {"docs word", "docs: explain exit 77 netfilter", nil, ReviewClassRefactorDocs}, {"docker is not docs", "docker: bump base image", nil, ReviewClassUnknown}, {"strategist prefix", "[strategist] planning: propose triage policy", nil, ReviewClassRefactorDocs}, diff --git a/src/pkg/rfcnotify/pr_test.go b/src/pkg/rfcnotify/pr_test.go index 3afa9a5f71..3b8bc7a816 100644 --- a/src/pkg/rfcnotify/pr_test.go +++ b/src/pkg/rfcnotify/pr_test.go @@ -23,7 +23,7 @@ func merged(pr Issue, at time.Time) Issue { } func TestIsRFCPR(t *testing.T) { - for _, title := range []string{"๐Ÿ“ proposal: Discord RFC cards", "๐Ÿ“ RFC: threads", "๐Ÿ“ rfc - lowercase"} { + for _, title := range []string{"๐Ÿ“ proposal: Discord RFC cards", "๐Ÿ“ RFC: threads", "๐Ÿ“ rfc - lowercase", "๐Ÿ“– proposal: Discord RFC cards", "๐Ÿ“– RFC: threads"} { if !IsRFCPR(title, nil) { t.Errorf("IsRFCPR(%q) = false, want true", title) } diff --git a/src/pkg/rfcnotify/rfcnotify.go b/src/pkg/rfcnotify/rfcnotify.go index 0575cdd5dd..f6d9fb1705 100644 --- a/src/pkg/rfcnotify/rfcnotify.go +++ b/src/pkg/rfcnotify/rfcnotify.go @@ -11,7 +11,7 @@ // conventions hivecommons/hive uses (for example #12062 and #16075). // // In rich mode an RFC document proposed as a pull request is tracked too: -// a PR is an RFC when its title starts with `๐Ÿ“ proposal:` or `๐Ÿ“ RFC`, or +// a PR is an RFC when its title starts with `๐Ÿ“`/`๐Ÿ“–` then `proposal:` or `RFC`, or // it adds or changes docs/rfc-*.md or src/docs/rfc-*.md (IsRFCPR). package rfcnotify @@ -189,12 +189,14 @@ func IsRFC(title string, labels []string) bool { } // IsRFCPR reports whether a pull request proposes an RFC document: its title -// starts with `๐Ÿ“ proposal:` or `๐Ÿ“ RFC`, or files add or change +// starts with `๐Ÿ“`/`๐Ÿ“–` then `proposal:` or `RFC`, or files add or change // docs/rfc-*.md or src/docs/rfc-*.md. func IsRFCPR(title string, files []string) bool { t := strings.ToLower(strings.TrimSpace(title)) - if strings.HasPrefix(t, "๐Ÿ“ proposal:") || strings.HasPrefix(t, "๐Ÿ“ rfc") { - return true + for _, emoji := range []string{"๐Ÿ“", "๐Ÿ“–"} { + if strings.HasPrefix(t, emoji+" proposal:") || strings.HasPrefix(t, emoji+" rfc") { + return true + } } for _, f := range files { if IsRFCDoc(f) { diff --git a/src/pkg/scheduler/gh_auth_instructions_test.go b/src/pkg/scheduler/gh_auth_instructions_test.go index 5db6aba9be..65b8a7b0e5 100644 --- a/src/pkg/scheduler/gh_auth_instructions_test.go +++ b/src/pkg/scheduler/gh_auth_instructions_test.go @@ -114,10 +114,10 @@ func TestGHAuthInstructions_DoesNotContradictItselfOnGHTOKEN(t *testing.T) { // The PR-title convention the repo's PR Type gate enforces is spelled out // where the agent reads how to open a PR, with the one swap that failed -// hivecommons/hive#13131 called out (๐Ÿ“ is proposal, docs is ๐Ÿ“–). +// hivecommons/hive#13131 called out (docs and proposals are both ๐Ÿ“–). func TestGHAuthInstructions_NamesThePRTitleEmojiConvention(t *testing.T) { block := ghAuthBlock(t) - for _, want := range []string{"โœจ feature", "๐Ÿ› fix", "๐Ÿ“– docs", "๐Ÿ“ proposal", "โš ๏ธ breaking", "๐ŸŒฑ chore", `"๐Ÿ“– docs: โ€ฆ"`, "๐Ÿ“ is for proposals only"} { + for _, want := range []string{"โœจ feature", "๐Ÿ› fix", "๐Ÿ“– docs", "๐Ÿ“– proposal", "โš ๏ธ breaking", "๐ŸŒฑ chore", `"๐Ÿ“– docs: โ€ฆ"`} { if !strings.Contains(block, want) { t.Errorf("hive-open-pr instructions lack %q", want) } diff --git a/src/pkg/scheduler/lane_messages.go b/src/pkg/scheduler/lane_messages.go index 2207065d11..4487e3d49e 100644 --- a/src/pkg/scheduler/lane_messages.go +++ b/src/pkg/scheduler/lane_messages.go @@ -226,9 +226,9 @@ func (s *Scheduler) ghAuthInstructions() string { --body "<body citing the issue>" --issues <N> --body-file <path> is accepted in place of --body, exactly as gh accepts it. Title convention (the repo's required "PR Type" check reads the first - character): โœจ feature, ๐Ÿ› fix, ๐Ÿ“– docs, ๐Ÿ“ proposal, โš ๏ธ breaking, ๐ŸŒฑ chore/other. - A docs PR is "๐Ÿ“– docs: โ€ฆ" โ€” ๐Ÿ“ is for proposals only, and the hive corrects an - emoji that contradicts the type ("๐Ÿ“ docs:" โ†’ "๐Ÿ“– docs:") when it opens the PR. + character): โœจ feature, ๐Ÿ› fix, ๐Ÿ“– docs/proposal, โš ๏ธ breaking, ๐ŸŒฑ chore/other. + A docs PR is "๐Ÿ“– docs: โ€ฆ" and a proposal is "๐Ÿ“– proposal: โ€ฆ"; the hive corrects + an emoji that contradicts the type ("๐Ÿ“ proposal:" โ†’ "๐Ÿ“– proposal:") when it opens the PR. Pass --issues <N> naming the issue this PR is for whenever the work started from an issue: the hive verifies the body actually references that issue and refuses the request otherwise, and it always refuses an empty body.