Repository navigation
feat(github): Generate the pull request Inbox rules from a decision table - #4395
Open
sentry-junior[bot] wants to merge 25 commits into
Open
sentry-junior[bot] wants to merge 25 commits into
sentry-junior[bot] wants to merge 25 commits into
Conversation
…able Add the Inbox kind generator and its check. Each design/inbox-kinds/*.yaml table gives its kind's Inputs, Outcome, Commands, and decide() code, and the rule list in its design file. inbox-kinds:check fails on drift, on a row that can never be the first match, on an unknown input that no rule names, and on a table too big to enumerate. Pilot it on github:pull_request: nextAction in pull-request-action.ts now calls the generated decide() with the requester as the viewer. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The pull request table now has review_outcome (approved, changes_requested, none) in place of a changes_requested flag, so a rule can test for an approval. Behavior does not change.
…x-kind-tables Co-Authored-By: BYK <[email protected]>
…n ask Merge the new github:pull_request rules from docs/inbox-kinds into the table: pr-merge-reviewer gives a still-requested reviewer "Ready to merge" when it is approved, GitHub can merge it, and it is not a draft. pr-review-again now tests that the requester has not approved and has not commented or reviewed since Junior asked. The source already enforces both, so the requester's next action does not change. Record that github:pull_request is now a table in the kind-table Gap. Co-Authored-By: BYK <[email protected]>
The source already applies both pr-review-again guards when it computes
asked_again, so the table states them in that input's description
instead of in two extra inputs, and the merge state drops the
requesterApproved field. pr-merge-reviewer keeps the auto-merge-off
condition. Tables can now describe an input with { values, text }.
Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
Each input value now has a phrase in its table, and the check renders each rule's sentence from its rows, their outputs, and the phrases of the commands, instead of a hand-written text field. It fails when a row names a value or a command that has no phrase. The tables now cover github:merge_conflict and the core kinds question, notice, todo, reply, and automation. Their design files embed the generated lists. Only github:pull_request names a code file, so code is optional, and the check generates only the doc when it is missing. The kind-table Gap now says that only that kind's code is generated. Co-Authored-By: BYK <[email protected]>
Main moved nextAction into pull-request-next-action.ts and added the requester's feedback, the draft review ask, and the mark-ready ask. The github:pull_request table now covers them, and nextAction in pull-request-next-action.ts is the adapter over decide(). Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
Each table now lives as a *-kind.yaml file next to the code of its owner and generates only TypeScript. The design files keep intent only, so the rule lists, their markers, and the phrases are gone. Each rule names the design rules it serves and has a sub-feature in the verification map, and the inbox-kinds check fails when either link is missing. The github:pull_request table now matches nextAction, and pr-merge and pr-merge-reviewer need a repository role that can merge. The question and notice tables give an item with no assignee, or for Everyone, to each viewer who can see it. Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
…es on Co-Authored-By: BYK <[email protected]>
BYK
added a commit
that referenced
this pull request
Nov 26, 2026
The next-action sync gave the requester a "Ready to merge" item based only on PR state: open, not a draft, auto-merge off, `mergeStateStatus` `CLEAN`, no pending review, no change request. It never checked whether the requester can merge on the repo. Two cases hit @BYK, whose role is `read` on both repos. Neither repo requires a review, so GitHub reports `CLEAN`: - getsentry/shepherd#30: @BYK had approved it, so the item said that it is approved and can merge. - getsentry/herald#8: nobody had reviewed it, so the item said to review it, then merge it. Now `nextAction` takes a `mergeAccess` input for the requester, and a requester without it gets no merge ask: - Before an approval, the PR is in limbo, so Junior asks the requester to review it on GitHub and they get "Review requested". After they approve, the item closes. A person with write access merges it. - An open merge item closes on the next sync with "Only a person with write access can merge it." When the requester has not reviewed yet, as on herald#8, the same sync asks for their review, and the item becomes "Review requested". - Junior knows a requester's access only through their linked GitHub login. With no linked login, there is no merge ask. The access comes from `GET /repos/{owner}/{repo}/collaborators/{login}/permission`. It is read with a metadata-only installation token and kept in the plugin cache for 10 minutes. This is the read that `loadRepositoryRole` already does. Both now share one cache entry that holds GitHub's base `permission` (admin, write, read, or none) and `role_name`. Write and admin can merge, and maintain and custom roles map to one of them. I did not use the requester's own token because the sync runs from webhooks and tasks that have none. The endpoint answers for the login, so the App token is enough. A sync reads the access only when the action would be merge or the saved action is merge, so most recomputes read nothing. Nothing is written to tables. The Inbox label comes from the item title, so the dashboard needs no change. `design/github.md` now states the write-access rule, in the text that @BYK confirmed. For #4395: the generated `github:pull_request` table needs a new requester input, `mergeAccess`. It gates the merge rows in the same way as `canMerge` in `pull-request-next-action.ts`. The sync gets it from the cached permission read above. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:local%3Aweb%3Aa0d5d9396e47d3c04ab85406 --> -- [View Session](https://junior-prod.sentry.dev/conversations/local%3Aweb%3Aa0d5d9396e47d3c04ab85406) [[Sentry]](https://sentry.sentry.io/explore/conversations/local%3Aweb%3Aa0d5d9396e47d3c04ab85406/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>
…unknown login as no access
Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
This comment has been minimized.
This comment has been minimized.
…e cache, and match the To-do and Automation tables to their code
Co-Authored-By: BYK <[email protected]> # Conflicts: # design/github.md # packages/junior-github/src/webhooks/installation-requests.ts # packages/junior-github/src/webhooks/pull-request-action.ts # packages/junior-github/src/webhooks/pull-request-next-action.ts # packages/junior-github/tests/pull-request-action-harness.ts # packages/junior/tests/integration/github-pull-request-ask.test.ts
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cb51a8c. Configure here.
Co-Authored-By: BYK <[email protected]> # Conflicts: # design/github.md # packages/junior-github/src/webhooks/pull-request-next-action.ts
Co-Authored-By: BYK <[email protected]>
…x-kind-tables Co-Authored-By: BYK <[email protected]>
This branch was successfully deployed
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.

design/inbox-kinds.md(#4390) now keeps only the contract for Inbox kinds. Itskind-table,table-checks, andtable-linksrules say that each kind's rules live in a decision table next to its owner's code, that the build checks each table, and that each table rule links to thedesign/rules it serves and to a verification map claim. This PR builds that, so a kind's rules can be read and checked in one place instead of being spread across hand-written code. Stacked on #4390.What changes
*-kind.yamlfile, next to the code of its owner:packages/junior-github/src/webhooks/pull-request-kind.yaml(github:pull_request)packages/junior-github/src/webhooks/merge-conflict-kind.yaml(github:merge_conflict)packages/junior/src/chat/inbox-items/question-kind.yaml,notice-kind.yaml, andreply-kind.yamlpackages/junior/src/chat/todos/todo-kind.yamlpackages/junior/src/chat/automations/automation-kind.yaml-,v,v1, v2,not(v)). An input can have adescription, which the generated code keeps as JSDoc.scripts/inbox-kinds/parses a table with YAML 1.2 and zod. For a table withcode:, it generates TypeScript:Inputs,Command/Commands, anOutcomeunion that carries the rule ID, anddecide(inputs). Onlygithub:pull_requesthascode:(pull-request-kind.generated.ts).design/gets no generated text.design/rule IDs that itserves. Each table names its verification map file (feature:), and each rule ID is a sub-feature there. The new sub-feature lines are in.agents/skills/verify-junior/features/github.mdandinbox.md.inbox-kindscheck runs inpnpm lint. It fails when:unknownand no cell names itdesign/*.mdrule hasnextActioninpull-request-next-action.tsis a small adapter overdecide(), with the requester as the viewer. The table also holds the reviewer rows for ref(inbox): Name each Inbox item by its subject kind and id #4164.design/inbox-kinds.md: thekind-tableGap now reads "Junior generates only the code ofgithub:pull_requestfrom its table. People write the code of the other kinds.", and thetable-linksGap is gone.design/github.mdget IDs, fromlinked-accounttogithub-truth, and the merged-or-closed rule splits intoended-silentandready-to-merge. The pull request table rules serve them. The question and notice tables serveeveryone-means-owner-audiencefromdesign/inbox.md.Behavior changes
pr-mergeandpr-merge-revieweruse main'smergeAccess(fix(github): Ask to merge only a requester with write access #4472) as theviewer.merge_accessinput.pr-mergeandpr-merge-reviewerneedin_merge_queueandbase_openfalse, fed from main'sinMergeQueueandbaseOpen(fix(github): Give stacked and queued PRs no merge ask #4589). The close reasons, the limbo review request, and theedited/enqueued/dequeuedsyncs stay in main's code.questionandnotice: an item with no assignee, or for Everyone, gives its output to each viewer who can see it.decide()gives what main'snextActiongives, for every value ofmergeAccess,inMergeQueue, andbaseOpen, including the requester's feedback, the draft review ask, and the mark-ready ask. That holds for every input that GitHub can produce:requestedReviewersis never set withoutreviewPending, andrequesterFeedbackis false on a draft.The
pr-review-againguards stay insideasked_again, as the code applies them today, and its description states them.Nothing breaks for callers. The question and notice tables hold no code yet, so their new rows are the intent that people implement.
via @BYK.
--
View Session [Sentry]