Repository navigation
refactor(dashboard): build five files' slot 404s with slot_not_found - #21670
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 25f7f34 Description read[DESCRIPTION-READ] 65e5bdfc731538dd9ecec587d4240b624f6ea0f5c0757dd6c0475277500c1ec8 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 to check. What this change shipsInventory (3 items) — 3 justifiedIntent: keep every dashboard "no such slot" 404 built by one function so that a change to the helper can't let an app tell one refusal from another. This is a FIX (behaviour-preserving dedup).
[FIRST-PRINCIPLES-REVIEWED] 25f7f34 Description read[DESCRIPTION-READ] 751dcf3f06e3aef9e662a49c3f775011694285a21968a4accff47acf5aec4077 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: |
|
Nine branches in five dashboard files hand-built the uniform per-slot 404 body that slot_ownership.slot_not_found() returns. Each now calls the helper, so these branches answer with the same definition of the indistinguishable 404 that deny_app_slot_access answers with, instead of each carrying a copy of it. The response bytes, status and every decision, audit row and their order are unchanged. The owner's dashboard-card read was the one changed branch no test reached; test_missing_slot_uniform_404.py now pins its 404 to the helper's.
762528c to
25f7f34
Compare
|
Rebased onto The previous head's only red, |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: refactor (6 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: code-move only; six inline slot 404 responses are replaced by the shared slot_not_found() helper, which returns the same body and status, and a test pins the dashboard-card path to that shape.
Problem / Motivation
Goal: Make nine more dashboard branches that hand-build the uniform
slot_not_found404, in five files that do not call the helper today, callslot_not_found()instead, with no change in what the client receives.slot_ownership.slot_not_found()is documented as "the one 404 an app gets for a slot it may not act on, or that does not exist". #21555 routed the hand-built copies in files that already called it; its Not a goal listed ten more copies in six files that did not, plus one spelled through a constant. This PR takes nine of those ten, in five of the six files.#16523's in-scope list does not name this kind: it is code re-implementing an existing helper, so this PR keeps to the issue's behaviour-preserving, one-module-per-PR rule. The mechanical scan for the issue's two mechanically decidable kinds (shadowing in-function imports, chained ternaries) found no actionable site in
dashboard/.Why it matters
Nothing is broken today. These nine branches spell out the helper's body by hand, so a change to
slot_not_found()would leave them answering the old body while every branch that calls the helper answers the new one. One of them hand-builds that body only so it matches the helper: the threads routes' feature-off answer, whose comment says it has "the same shape the app-isolation refusal answers with". Those routes refuse an app's foreign slot throughdeny_app_slot_access, which calls the helper, so after such a change an app could tell "threads are off" from "not your slot".Not a goal
chat_fork.py's copy. Routing it means extending the file'sslot_ownershipimport, and two open PRs (feat(chat): merge a fork back into its parent chat #15957, feat(chat): backend to merge a fork back into its parent chat #17165) insert an import directly above that line, so the edit would hand both a merge conflict.handlers/prompts_caller_gates.py's copy, which spells the code through_CODE_SLOT_NOT_FOUND, a namehandlers/prompts.pyexports. Routing it would leave that published name unread; that is a separate call.chat_pins.py's_authorize_app_slot, one expression that takes the code as a parameter: four of its five call sites get the helper's body and one (api_chat_pins_delete) getspin_not_found, so routing it means splitting that expression."slot not found"inmessaging_api/run_control.pyandhandlers/redaction.py,"no such slot"inhandlers/appearances.py, the texts inask_question.pyandmember_dashboard.py): routing it would change the response.slot_not_found(), any refusal decision or audit row, or what any branch returns.What changed (motivation → approach → change)
Each branch below returned a hand-built copy of the helper's response; each now calls the helper, so these branches build that 404 from the same function as the branches that already call it;
chat_fork.py,handlers/prompts_caller_gates.pyandchat_pins.py's_authorize_app_slotstill build theirs (see Not a goal).chat_todo.pyfrom kiro_crew.dashboard.slot_ownership import slot_not_foundchat_threads.py_feature_off,_resolve_slotlookup missslot_ownershipimportchat_api/source_links.pyTYPE_CHECKINGlistroutes/chat.pyapi_dashboard_cardlookup missslot_ownershipimporthandlers/members.pych.slot_not_found()through thechat_handlersmodule the handler already importschat_api/source_links.pyis an owner of thechat_handlersfacade: its functions run with the facade's globals, which bindslot_not_found, the same way the file already reachesselanddeny_app_slot_access.routes/chat.pyis on the boot path; its new import loads nothing new, becausechat_threads, which the file imports at line 14, importsslot_ownershipat module scope. Inapi_chat_slot_todoonly the returned expressions change; the app refusal's audit row and the order of every check stay as they were.The test file #21555 added gains one case for the dashboard-card read, the one changed branch no existing test reached.
Backwards compatibility
Compatible: every changed branch returns the same status, JSON body and content type as before.
Removes nothing: no handler, route, response field or name is removed; only the expression that builds an unchanged response changes.
Tests
test_the_owner_card_read_gets_the_shared_not_foundintest/test_missing_slot_uniform_404.pysends the owner's request for an unknown slot toapi_dashboard_cardand asserts status, body and content type equalslot_not_found()'s. It passes withmain'sroutes/chat.pyand fails when that branch returns a different body. D12: 20 runs at-n0, 10 at-n 4besidetest_chat_slot_muted.pyandtest_dynamic_dashboard_cards_activation.py, and a shuffled order (seed 21687), all green.source_links.py) hasslot_not_foundbound to the helper (ch.slot_not_foundformembers.py), and the helper's response equals the old literal's.slot_not_found(133 files): 6907 passed, 42 skipped, 0 failed.--testself-tests (no coverage measured locally), the vendor manifest and the flake-pattern ratchet._feature_offcomment's "is not enumerable" overstates (a malformed request gets a 400 only with threads on); left, out of goal.scripts/scrub-lint.shis not in the checkout; that scan is CI'sinternal-content-scanjob. semgrep is not installed here, so CI's SAST job is the only run ofsemgrep/. The frontend did not run: the diff touches nothing underwebsite/,.github/orscripts/.Manual verification
N/A — unit coverage sufficient: each change swaps an expression for a call that returns an equal response, and the probe above checks each call resolves to the helper.
Screenshots / video
Why no screenshot: backend-only refactor; nothing renders differently.
Related Issues
Part of #16523
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.