Repository navigation
feat(apps): declare code-review-sage's pull-request read and writes - #36343
Conversation
kirodotdev/KiroCrew#36343 declares /api/source/pull-request in the built-in's manifest, so this copy declares the same list and adoption is no widening. The fixture records the built-in's new list, and PORTING.md turns gaps 2 and 3 into the page work the grant now allows. Co-authored-by: Bolin Chen <bolichen@amazon.com>
Code change approver recommendation: ApproveWhy: the decider estimates an 8% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. This PR adds one bare
The new parity test pins:
An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
1b624dd to
6b6f35e
Compare
|
Rebased onto |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this adds one manifest grant for calls the built-in page already makes. It takes nothing away, and the owner gate on the handlers still refuses the app's own backend token. Notes
[DESIGN-REVIEWED] 31a1b60 Description read[DESCRIPTION-READ] ec9689a2c3e5c5348ea6d8eef6074b47807ce25a8c8da9c1a82bf4e9552eb42f That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The one manifest entry follows the recorded owner ruling on #26967 and uses the existing declaration form ( What this change shipsInventory (4 items) — 4 justifiedIntent: let Code Review Sage move to its own repository and keep its pull-request view and publish bar, without existing users having to re-approve a wider grant. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 31a1b60 Description read[DESCRIPTION-READ] e89c1ec017ced620d5a167aebbc295340dcd31e48b526594b621619e72f74376 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
6b6f35e to
460980f
Compare
460980f to
4a8844a
Compare
Owner ruling on #26967 (comment 6841699202): an app gets what its built-in already uses, declared in the wheel copy first so adoption is not a widening. Code Review Sage's built-in page reads a pull request and acts on it through the /api/source/pull-request family: the SDK PullRequestPanel's read, checks, status, ready, auto-merge, reply, comment, resolve and unresolve, and the publish bar's pending-review and submit-review. An adopted bundle reaches them only through the scoped client, which refuses an undeclared path. The wheel copy now declares the one bare entry that covers them, which a built-in approves at every start, so the repository copy's identical list adopts with permission_refusal None. The handlers refuse an app token, so the backend gains no reach.
4a8844a to
31a1b60
Compare
|
Rebased onto |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
I approved this PR on head 31a1b60. The diff adds one entry, /api/source/pull-request, to the permissions.api list in Code Review Sage's app.json. It also adds a § 18g spec paragraph and a new 7-test parity file. I checked that dashboard/routes/chat.py:88-99 registers exactly 12 routes under that prefix and nothing else. The matcher stops at a slash boundary, so /api/source/pull-requestx is not admitted. Every one of those handlers goes through _authorize_owner_request or _owner_mutation_response. PR Readiness is green on this head.
Security: the scope layer now lets this app's token reach the pull-request family, but every handler in that family still refuses a request that carries an app claim (app_token_not_allowed). So the app's backend token gains no reach. The real new reach is the adopted page's calls on the owner's own session. That follows the owner ruling recorded on #26967, and the spec paragraph states it.
Done well: the parity test reads PULL_REQUEST_PANEL_PATHS from the SDK source instead of copying it. It runs the real register_builtin_apps and permission_refusal, and it pins both sides: the identical list adopts, and one extra host path is still refused as a widening.
Optional:
test/test_code_review_sage_permission_parity.py:40says PAGE_CALLS is every host path the page calls.ReviewChat.tsx:155also posts to/api/chat/slots, which the body scopes out. You could narrow the comment to the pull-request family, or note that/api/chat/slotsis left undeclared on purpose so the/api/chatdeny reads as intended.- App-token refusal is pinned for read, checks, resolve, reply, comment, unresolve and auto-merge. It is not pinned for submit-review, pending-review, ready, status or status/refresh. One parametrized 403 test over PAGE_CALLS would tie the "no reach" claim to every endpoint this grant opens.
- The
_shipped,registeredand_repository_manifesthelpers are also copied in #36342 and #36344. A shared helper, or deleting each copy when its app leaves core, would keep that in one place.
…9.4 (#4) * feat: bring back the pull-request tab and the publish bar The built-in's detail pane has a "Pull request" tab (the dashboard's PullRequestPanel: description, checks, review threads, the file diff, commits), header chips drawn from the same payload, and a publish bar that releases the draft review as Submit as comment, Request changes or Approve. This copy had dropped all three because the endpoints were outside its grant. kirodotdev/KiroCrew#36343 declares /api/source/pull-request in the built-in's own manifest under the owner ruling on kirodotdev/KiroCrew#26967, and this app.json declares the same list, so they come back unchanged: - the tab renders the App SDK's PullRequestPanel (kirodotdev/KiroCrew#32665, seam level 2), feature-detected in hostSdk.ts; on a host without it the pane shows the review alone, as before; - the payload, the pending review and the submit go through the host's scoped client (sourceApi in api.ts) with the dashboard client's bodies; every path is the declared entry or a child of it; - the publish bar is the built-in's, with every guard it had (delivery evidence, superseded draft, redacted content, stale head, Approve withheld under auto-merge or kept stale approvals) and the two-click confirm bound to the content digest. The built-in's tests for the bar, the payload and the tab are ported over sourceApi; a stand-in for the SDK panel pins that it gets the one pull request and shares the payload's query entry. PORTING.md marks gaps 2 and 3 closed; gap 1 (opening a new follow-up chat) remains. Part of kirodotdev/KiroCrew#26967. * chore: release 0.9.4 Bump the version once for the release that carries the wheel fixes (#3) and the pull-request tab and publish bar, so Kiro Crew can pin this commit: a first-adoption pin's version equals the wheel built-in's, which the pin release moves to 0.9.4. The built-in manifest fixture is the current wheel manifest at that version. The README shows the new Pull request tab, captured with capture.py on an isolated Kiro Crew main gateway running this repository's copy. The capture's gh stand-in now answers the dashboard's own pull-request read (the pr view fields and the two GraphQL reads), and KIROCREW_GH_BIN points that read at it. Part of kirodotdev/KiroCrew#26967. * fix: ship .kiro so adoption can replace a reviewed install's folder A built-in Code Review Sage that ran a review has .kiro/settings/cli.json in its record's folder: the review worker's Kiro CLI workspace settings, which the review pool writes into the worker's working directory, the app's folder. Kiro Crew's adoption refuses to swap a record whose folder holds an entry beside app.json that nothing rebuilds and the pinned tree does not ship, so every user who had ever run a review would have stayed on the built-in ("Adoption of code-review-sage skipped: the swap would delete .kiro beside app.json"), as the adoption smoke showed. The tree now ships .kiro/ (a README saying what is written there), so the swap replaces the folder as an update does, and the next review writes the settings again. .kiro/settings/ is ignored so a dev clone never commits them. tests/test_adoptable_root.py runs Kiro Crew's own check against a record a review left behind: it passes with this tree and fails without the folder. Part of kirodotdev/KiroCrew#26967. --------- Co-authored-by: Bolin Chen <bolichen@amazon.com>
Problem / Motivation
Goal: Code Review Sage can move to its own repository without losing the pull-request view and the publish bar its built-in page has, because the grant those need is already approved for every existing user.
Code Review Sage's built-in page reads a pull request and acts on it through the dashboard's
/api/source/pull-requestfamily: the SDKPullRequestPanel's read,checks,status,ready,auto-merge,reply,comment,resolveandunresolve, and the publish bar'spending-reviewandsubmit-review(website/src/apps/code-review-sage/components/PrSourcePanel.tsx,DraftReviewActions.tsx,PrReviewDetail.tsx). The compiled built-in reaches them as dashboard code. The app repository's bundle could reach them only through the scoped client, which refuses an undeclared path, and declaring the path there was a widening adoption refuses (E9), so that copy dropped the pull-request tab and the publish bar (its PORTING.md gaps 2 and 3).Owner ruling on #26967, comment 6841699202 (2026-11-13): decide directly, users' normal use must not be affected, grant what is needed. Its decision 1 names code-review-sage
/api/source/pull-request(the read and write calls it already makes), declared in the wheel copy first so adoption is not a widening.Why it matters
Without this the repository copy either keeps a reduced page (no pull-request view, publishing moved to GitHub) or adds the grant later as a widening every user would be asked to approve again; the built-in's users would see a regression either way.
Not a goal
/api/chat/slots, the repository copy's gap 1), which the ruling routes to a generic chat-slot seam.What changed (motivation → approach → change)
apps/builtins/code_review_sage/app.jsonadds/api/source/pull-request. One bare entry is the narrowest the matcher allows for the family: every endpoint the panel and the publish bar call is a child of the read, which is also what the SDK panel checks before it builds a client. It also coversstatus/refresh, a read of the same cached statuses, and nothing else is registered below it. The handlers refuse an app token (source_providers._authorize_owner_request), so the app's backend token gains no reach; the page's requests carry the owner's session, as every scoped request does.register_builtin_apps), so the release carrying this grants the entry to every existing record before any pin, and the repository copy's identical list adopts withpermission_refusal(...) == None.app-kit-platform.md§ 18g records the declaration and why it is the one entry.The trust prompt lists this entry once #36342 (the generic host-path box) lands; no merge order is required.
App repo: KiroCrewCaptain/kirocrew-app-code-review-sage@12e0f75 (declares the same list in
app.json, records it in the built-in fixture its parity test compares, and rewrites gaps 2 and 3 in PORTING.md as page work that the grant now allows).Backwards compatibility
Compatible: the wheel manifest only adds a grant; the compiled built-in page keeps the dashboard client and never read its own
permissions.api.Removes nothing: the change adds one declaration.
Tests
test/test_code_review_sage_permission_parity.py: the wheel copy declares exactly its own paths plus the family; every path the built-in page calls matches; the SDK panel's endpoint table (read fromPullRequestPanel.tsx) is inside that list; a registered built-in's approved set is the wheel's;permission_refusalisNonefor the repository's list andpermission_wideningwith one more path (/api/source/issues); the app token matches the family and is refused at/api/source/pull-requestx,/api/source/issue,/api/source/issues,/api/chat,/api/apps. Five of the seven fail with the manifest change reverted (checked locally).test_builtin_discovery,test_builtin_app_optional_enable, and everytest/*.pynaming the app (2,337 passed).Proof: not provable -- other: a feat PR; the manifest hunk was reverted by hand and 5 of the 7 new tests went red
Determinism: the new tests read files and in-memory state only.
Real repository manifest, against this branch with the built-in registered in a scratch data home:
Manual verification
N/A: a manifest declaration with no rendered change; the parity tests register the real wheel copy.
Related Issues
Part of #26967
Checklist
Contribution License Agreement
Contributed under the project's Apache-2.0 license.