Repository navigation
refactor(apps): unchain the no-manifest approved-grants ternary - #18391
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (1 items) — 1 justifiedIntent: make the approved-grants choice for a manifest-less app self-registration readable as three plain cases, without changing any grant outcome. This is neither a FIX nor an ADDITION: it is a pure refactor.
[FIRST-PRINCIPLES-REVIEWED] 4ec2901 Description read[DESCRIPTION-READ] 4bcd5fd6858c7e5a491adfcaa81f19d7ee010695a9643995343cdbf6c545ee6a That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 4ec2901 Description read[DESCRIPTION-READ] 4891eecdb47a0c83e94979602bc1de45cb750550f2cdab4b274704501cf9736b 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 |
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: |
cf0ad2a to
e7bd934
Compare
|
Rebased: main moved in src/kiro_crew/agent.py since this head went green (7044e75 -> 33b67ac); CI re-running. The overlap is import-graph only: |
|
The red
No further rerun and no override: the PR waits for the #17941 fix, then rebases onto it. |
|
Answering the First Principles check note on e7bd934 ("the
|
register_external_app picked the approved api/events set for a registration that supplies no manifest with a conditional expression nested inside another, the inner one binding on_disk with a walrus. Spell the same three cases as an if/elif/else: an app with an install record leaves its stored set untouched, one without approves what its on-disk manifest declares, and with no readable manifest either no set is written. Same branch order, same calls, same on_disk binding.
e7bd934 to
4ec2901
Compare
|
Rebased: main moved in test/conftest.py since this head went green (33b67ac -> d4c3a73); CI re-running. The overlap is import-graph only: main's change pins host free memory in The E2E red on the previous head stays attributed to #17941; its fix (#18529) has not merged yet. |
iamwhatever
left a comment
There was a problem hiding this comment.
This rewrites one nested conditional expression in register_external_app (src/kiro_crew/apps/manager.py ~L3008) as if/elif/else, and it is a pure refactor with nothing to fix at a root cause. I read the 6/-9 diff and checked equivalence by hand: the install-record case still reads the stored set, the walrus that binds on_disk still runs only when there is no install record, and the no-manifest case still yields None, so no approved-grants file is written. Every check is green, all AI lanes PASS with no findings, base is main and there are no reviews or change requests. It is a behaviour-identical refactor of one expression, so it changes no permission outcome, and I am approving it. — crew-pr-reviewer
Problem / Motivation
Goal: Make the approved-grants choice for a manifest-less app self-registration read as three plain cases, with no change to which grants an app gets.
When an app registers itself without sending a manifest,
register_external_appinsrc/kiro_crew/apps/manager.pypicks its approved api/events set with a conditional expression nested inside another one, and the inner one also bindson_diskwith a walrus. Three cases are packed into one expression, and the reader has to unwind it to see which one runs.Why it matters
Nothing is broken today. This block feeds the approved-grants file that
token_authandws_event_scopeenforce. A reader checking that gate should see its cases at a glance, not have to work out how a nested expression evaluates.Not a goal
prior_grantsfor the second_read_approved_grants(name)call. That would save one disk read, but it changes how many times the file is read, so it is not a pure rewrite.apps/, or any other module.What changed (motivation → approach → change)
No app gains or loses a grant. In
register_external_app(src/kiro_crew/apps/manager.py), the nested conditional expression that picks the approved api/events set for a self-registration without a manifest becomes anif/elif/else, with the same three cases in the same order:Each case makes the same calls and returns the same value as before.
on_diskis still bound only when there is no install record, and nothing else reads it. Theapproved_grantsannotation still comes before every assignment, so mypy's inference does not change.Backwards compatibility
Compatible: every case gives the same value, from the same calls, in the same order, so every caller sees exactly what it did before.
Removes nothing: the change only restructures one expression. No name, path, key or record goes away, and
take_away_check.pyreports no take-away shape.Tests
No new tests: behaviour does not change, so there is nothing new to pin.
existing(None, falsy, truthy, a plain object) andget_app_manifest(returnsNone, returns a falsy manifest, returns a truthy manifest, raises). The result, any exception, the full call order and whetheron_diskwas bound matched in every case.d4c3a7334d). All exit 0: flake8, isort, mypy,check_black_formatting.py,check_subprocess_encoding.py,check_comment_history.py,check_brand_name.py,check_harness_parity.py,check_feature_map.py,docs_lint.py --test,docs-lint.sh,check_per_file_coverage.py --test,verify_vendor_manifest.pyand the rest of the profile's backend gate floor. semgrep is not installed on this host, so CI's SAST job is the only run ofsemgrep/.d4c3a7334d, the 11 test files that callregister_external_appand the four test files whose host-memory pin main added beside thetest/conftest.pychange (test_chat_send_agent_model_default.py,test_crew_log_previous_latch.py,test_cron_reaper.py,test_cron_resilience.py) pass: 1548 passed, 7 skipped. No commit on main since0c20641d03touchesapps/. The related-test runner selected 482 files, on the0c20641d03base: 40621 passed, 118 skipped, 5 failed. None of the 5 importsapps/, and each one fails the same way on pristineorigin/mainon this host:test_cli.py::TestDoctorStt(the boto3-missing and amazon-transcribe-missing tests):pip_install_channel_available()is not stubbed, and this host's venv has nopipmodule, so theInstall:line never prints.test_service.py::TestAppArmorNeverFailsTheInstall(two tests): the linger probe is not stubbed, and linger is off for this account, so atest_cli_doctor.py::TestDoctorAgentAuth::test_a_stored_but_unusable_vault_identity_is_still_reported: this passes alone. It fails whentest_cli.py::TestDoctorStt::test_doctor_stt_transcribe_providerruns first on the same worker, which rebindskiro_crew.auth. That two-test sequence fails the same way on0c20641d03.scripts/scrub-lint.shis not in the checkout; that scan runs as CI'sinternal-content-scanjob. The diff touches nothing underwebsite/,.github/orscripts/, so CI reportsonly_backend=true.Pre-PR review: seven read-only reviewers looked at this before it opened. Their lenses were AUTOSDE blocking rules plus the
code-review.ymlgreps, behaviour preservation, import and binding semantics, the security keystone and boot path, comment accuracy, and local mirrors of the GPT and Claude CI lane contracts. None found a code defect.approved_grants. On the no-manifest path, only the first-registration write reads it, so the fail-closedNone-versus-{}meaning is unchanged.Manual verification
N/A — unit coverage sufficient: the rewrite gives the same value from the same calls for every input, and the tests that register apps pass.
Screenshots / video
Why no screenshot: backend-only rewrite of one Python expression; nothing renders differently.
Related Issues
Part of #16523
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)