Repository navigation
feat(attention): open comment-author settings from GitHub watches #1827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
johnmatthewtennant
wants to merge
36
commits into
main
Choose a base branch
from
jtennant/poppy/attention-source-presentation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+269
−45
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
52c3077
feat(github): limit whose PR feedback wakes agents
johnmatthewtennant e11d459
fix(github): keep membership lookups from holding feedback forever
johnmatthewtennant 2186cee
test(settings): expect the GitHub comment authors card
johnmatthewtennant 1fad9fe
feat(github): decide PR feedback by ordered allow and deny rules
johnmatthewtennant 3f1e0ef
refactor(github): drop converting saved author lists to rules
johnmatthewtennant bce98da
fix(github): judge waiting feedback by current rules and fresh member…
johnmatthewtennant 0a1f62c
style(github): lay out the comment author rules as a Settings form
johnmatthewtennant 067d37b
fix(github): hold waiting feedback whose author it cannot check
johnmatthewtennant ecb5490
feat(github): choose what feedback no rule matches gets
johnmatthewtennant 4beed20
test(github): cover rules saved in Settings changing a running watch
johnmatthewtennant 31cdefb
docs(github): say body rules see what a wake quotes
johnmatthewtennant a604e11
fix(github): recheck new feedback against rules saved during a lookup
johnmatthewtennant e0d5bef
fix(github): match body rules against the text a wake quotes
johnmatthewtennant 4ce1145
fix(github): leave feedback admission to the final recheck
johnmatthewtennant b7bbac8
fix(github): stop membership fallback when a watch stops
johnmatthewtennant 50aa164
fix(github): count failed membership reads once a poll
johnmatthewtennant e5ba22c
fix(github): match rule patterns in linear time
johnmatthewtennant 6490dfc
fix(github): show why rules are not rules on the Rules field
johnmatthewtennant 460f75b
docs(github): allow Copilot by its exact bot login
johnmatthewtennant d570324
fix(github): match an escaped surrogate pair as one character
johnmatthewtennant 88d72e4
fix(github): reject rules naming more organizations than a read can ask
johnmatthewtennant 9b1965e
fix(github): hold feedback while GitHub answers no membership read
johnmatthewtennant 1829b5f
fix(github): match a legacy octal escape as one character
johnmatthewtennant 5bad688
fix(github): hold feedback while saved rules no longer parse
johnmatthewtennant 69ffeb4
fix(github): read new feedback before rereading what is held
johnmatthewtennant 434b647
Refuse pattern escapes that mean something else alone
johnmatthewtennant 069617e
Keep held feedback held across limited reads
johnmatthewtennant 99676a2
Count membership retries from the requests sent
johnmatthewtennant d91520d
feat(attention): let sources present their own watches
johnmatthewtennant 98458bb
Merge main: decide watch feedback from the pull request store
johnmatthewtennant 56e11f8
Merge 1746: watches decide from the pull request store
johnmatthewtennant 0bffb49
fix(github): read memberships apart from deciding a watch
johnmatthewtennant ee226db
fix(github): let a watch's first read learn feedback held elsewhere
johnmatthewtennant a69d59c
Merge 1746: read memberships apart from deciding
johnmatthewtennant 411e14e
Merge main into attention-source-presentation
johnmatthewtennant f4bab99
test(github): cover the PR source presenter registration
johnmatthewtennant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // @vitest-environment jsdom | ||
| import { cleanup, render, screen } from "@testing-library/react"; | ||
| import userEvent from "@testing-library/user-event"; | ||
| import { afterEach, expect, it, vi } from "vitest"; | ||
| import { GitPullRequestIcon } from "../../shared/design-system/icons"; | ||
| import { presentPull } from "./attention"; | ||
|
|
||
| afterEach(cleanup); | ||
|
|
||
| const watch = (pr: unknown) => ({ | ||
| type: "source" as const, | ||
| interest_id: "release", | ||
| enabled: true, | ||
| provider: "attention/github-pr", | ||
| config: { pr }, | ||
| }); | ||
|
|
||
| it("names the pull request and opens whose feedback wakes agents", async () => { | ||
| const open = vi.fn(); | ||
| const shown = presentPull({ open })( | ||
| watch("https://github.com/block/buzz-app/pull/1578"), | ||
| "buzz-app#1578 Release checks", | ||
| ); | ||
| expect(shown).toMatchObject({ | ||
| type: "GitHub PR", | ||
| icon: GitPullRequestIcon, | ||
| target: "buzz-app#1578", | ||
| subtitle: "Release checks", | ||
| link: { | ||
| href: "https://github.com/block/buzz-app/pull/1578", | ||
| title: "Open on GitHub", | ||
| }, | ||
| }); | ||
| const Details = shown.details as NonNullable<typeof shown.details>; | ||
| render(<Details />); | ||
| await userEvent.click( | ||
| screen.getByRole("button", { name: "Choose who can wake agents" }), | ||
| ); | ||
| expect(open).toHaveBeenCalledWith({ | ||
| version: 1, | ||
| kind: "settings", | ||
| section: "buzz.github/authors", | ||
| }); | ||
| }); | ||
|
|
||
| it("leaves a watch without a pull request URL to its name", () => { | ||
| expect(presentPull({ open: vi.fn() })(watch(42), "Release")).toEqual({ | ||
| type: "GitHub PR", | ||
| icon: GitPullRequestIcon, | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // How a pull request watch looks in Agent Attention. | ||
| import { GitPullRequestIcon } from "../../shared/design-system/icons"; | ||
| import { Button } from "../../shared/design-system/ui/Button"; | ||
| import type { AttentionSource } from "../../features/agents/attention-sources"; | ||
| import type { Navigation } from "../../features/navigation/controller"; | ||
| import { pullOf } from "./watch"; | ||
|
|
||
| /** Names the pull request a watch follows, and opens the settings for whose | ||
| * feedback wakes agents. */ | ||
| export function presentPull( | ||
| navigation: Pick<Navigation, "open">, | ||
| ): NonNullable<AttentionSource["present"]> { | ||
| const Authors = () => ( | ||
| <Button | ||
| variant="link" | ||
| size="inline" | ||
| type="button" | ||
| onClick={() => | ||
| void navigation.open({ | ||
| version: 1, | ||
| kind: "settings", | ||
| section: "buzz.github/authors", | ||
| }) | ||
| } | ||
| > | ||
| Choose who can wake agents | ||
| </Button> | ||
| ); | ||
| return (watch, title) => { | ||
| const pull = | ||
| typeof watch.config.pr === "string" ? pullOf(watch.config.pr) : undefined; | ||
| if (!pull) return { type: "GitHub PR", icon: GitPullRequestIcon }; | ||
| return { | ||
| type: "GitHub PR", | ||
| icon: GitPullRequestIcon, | ||
| target: `${pull.name}#${pull.number}`, | ||
| subtitle: title.replace(/^(?:PR\s+\d+:?\s*|[^ ]*#\d+\s*)/i, ""), | ||
| link: { href: pull.url, title: "Open on GitHub" }, | ||
| details: Authors, | ||
| }; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.