Repository navigation
refactor(acp): unchain the deny-notice suffix ternary - #37557
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. This is a behaviour-preserving restatement of a single expression, and it stays within the stated goal. [DESIGN-REVIEWED] 72afbf4 Description read[DESCRIPTION-READ] c3e92379746cf87e8ca455277b918e7f7bc698a9cc6cf46301e7c7eca2deb051 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: this rewrites one expression with the same output for every input, so no default, surface or behaviour moves. Inventory (1 items) — 1 justifiedIntent: make the deny-notice suffix choice in
[FIRST-PRINCIPLES-REVIEWED] 72afbf4 Description read[DESCRIPTION-READ] 8c166f12ff52c019a31005efac1203fc06286b976d134475efac3709af945984 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsPure refactor with identical semantics (Python's chained ternary is right-associative, so the original equals the new if/elif/else). No findings. [OPUS-REVIEWED] 72afbf4 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: |
Code change approver recommendation: ApproveWhy: the decider estimates a 2% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. Pure refactor in denied_command_notice: a chained ternary becomes an if/elif/else with the same order, truthiness tests and short-circuit ( 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 |
denied_command_notice picked its suffix with a chained conditional expression: a past-the-bound note, else the gate-judged mark for a conditional entry, else nothing. Spell the three cases as an if/elif/else so the precedence reads top to bottom. Same order, same short-circuit (`conditional` is read only when `past_bound` is falsy) and the same truthiness tests, so every notice string is byte-identical.
ad23e2e to
72afbf4
Compare
|
Rebased onto main (
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
I reviewed head 72afbf4 and confirmed it rewrites one chained conditional expression in denied_command_notice as an if/elif/else. Python's conditional expression is right-associative, so the new branches run in the same order with the same truthiness tests and the same short-circuit, and conditional is still read only when past_bound is falsy. A quick old-versus-new probe over mixed truthy and falsy inputs produced identical suffixes. The function's output does not change and no caller is affected, so nothing blocks.
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Reviewed the full diff. A if p else B if c else "" groups as A if p else (B if c else ""), so the new if/elif/else returns the same suffix for every input and keeps the short-circuit (conditional is read only when past_bound is falsy). Display-only; no behaviour change. PR Readiness green on this head.
Problem / Motivation
Goal: Make the session-start notice's deny-entry formatter read top to bottom, without changing any notice text it produces.
acp/kas_spec_denies.pycarries the module-simplification detector's oneacpsite:denied_command_noticepicks the suffix of adeniedCommandsnotice line with a chained conditional expression (A if p else B if c else ""), so a reader has to work out whichelsebinds to whichifto see the three cases.Why it matters
Nothing is broken today. The function decides which of three labels an operator sees next to an authored deny — past the record bound, refused by Kiro Crew's gate, or neither — and a chained ternary makes a reader work out which
elsebelongs to whichifbefore they can see which label an entry gets.Not a goal
GATE_JUDGED_MARK, the_MAX_DENIESbound, or howdenied_command_itemsclassifies an entry.acp/. Its other detector site, inkas_permissions.py(_shell_glob_pattern), turns anallowedCommandsglob into a regex for the security matcher, so this sweep leaves it as it is.apps,toplevel,security,dashboard, and the test-pinneddecisionsshadow import).What changed (motivation → approach → change)
Every notice line reads exactly as before. In
src/kiro_crew/acp/kas_spec_denies.py,denied_command_noticesetssuffixwith anif/elif/elsein place of the chained ternary: the past-the-bound note first, thenGATE_JUDGED_MARKfor a conditional entry, else nothing. The order, the truthiness tests and the short-circuit (conditionalis read only whenpast_boundis falsy) are the same.Backwards compatibility
Compatible: the function returns the same string for every input, so both of its callers,
unread_denied_commandsin the same module andsplit_deny_noticesinagent_sdk/kas_tool_view.py, see no difference.Removes nothing: no name, key, string or path goes away.
Tests
No test change: the diff changes no behaviour. An equivalence probe called
origin/main's and this head'sdenied_command_noticeover 729 combinations (nine truthy and falsy values each forpast_boundandconditional, three forwhole, three forentry) and got identical strings, including an item with noconditionalkey at all whenpast_boundis set (neither version reads it).On this head (one commit on
origin/main), on the Python 3.12 CI-parity venv: the 19 test files that namekas_spec_denies,kas_tool_view,unread_denied_commands,denied_command_noticeorspec_keys_without_carrierpass (983 passed). Static gates green: flake8, isort, mypy, the black baseline gate, subprocess encoding, comment history, brand name, harness parity,docs_lint.py --test,docs-lint.sh,check_per_file_coverage.py --test, file line cap and the vendor manifest. The repository's semgrep rules were not run locally (no semgrep binary on this host); CI's SAST job runs them. Backend-only: nothing underwebsite/,.github/orscripts/changes.Pre-push review fleet of seven, all read-only: the Opus and GPT CI review contracts extracted from
claude-review.ymlandcodex-review.yml(both served by Claude Opus 5.5, so the GPT one ran at reduced fidelity) and five lenses (AUTOSDE blocking rules, behaviour preservation, import semantics, security controls and boot path, comment and claim accuracy). None found a code defect; three reviewers ran their own old-versus-new probes and got identical strings and the same subscript reads. The comment lens raised three points about this description; an independent verifier upheld two (the caller count, and a term for thekas_permissions.pysite that only a local tool uses), which the wording here reflects, and refuted the third (the 729 count is 9 × 9 × 3 × 3).Manual verification
N/A — unit coverage sufficient: one conditional expression respelled as statements; no new path.
Screenshots / video
Why no screenshot: backend-only refactor in
src/kiro_crew/acp/; nothing renders differently.Related Issues
Part of #16523
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)