Repository navigation
refactor(project): read a checkout's pull request in one place - #938
Merged
Merged
Conversation
The cards' badges asked gh themselves, once a minute per open pull request of the shown project, while the merge watch read the same pull requests in the backend. The pull request watch (internal/project, branchpr.go) is now the one reader: it reads every checkout a live agent runs in and every one last read with an open pull request each minute, and any other when a window asks with project.RecheckPullRequest; every read goes out as branch-pull-request, which the badges listen to, and a merge it sees after an open read is announced through relay.AnnounceMerge as before. project.PullRequest is gone: the window was its only caller. The badge still follows the shell's cwd.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
internal/project/branchpr.go) is the one reader of a checkout's branch pull request. Each minute it reads every checkout a live agent runs in (relay.AgentCheckouts) and every checkout whose last read found an open pull request; any other is read when a window asks with the newproject.RecheckPullRequest. One read per path at a time, and a recheck asked during a read reads again after it.branch-pull-request(api.BranchPullRequestEvent). The cards' badges listen to it instead of calling gh: the window keeps its triggers (branch or head moved, turn end, focus, account change, PR writes, Refresh) as rechecks, and its own one-minute cadence is gone. A failed read now keeps the badge instead of hiding it.relay.AnnounceMerge, which still announces a merge once. The relay's own watcher shrinks toAgentCheckouts.project.PullRequestis removed (the window was its only caller);api.PullRequestcarries title and head/base refs. Contract golden updated.docs/ceilings.mdmerge bullet updated to the new watch.Test plan
internal/project/branchpr_test.go: every read reported; open then merged announced once; first read merged or after a close not announced; a failed read keeps the last one; the watch follows agents and open PRs; a gone checkout is dropped; a recheck during a read reads again; the read runs as the project's gh account.internal/relay:AgentCheckoutslists live agents' checkouts only;AnnounceMergetells a merge once.gofmt,go vet ./...andgo test ./...in the root and innative/; project, relay and window suites with-race.