Repository navigation
refactor: make core independent of the design-critique app - #28021
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. This refactor adds or changes no user-visible control or string. Every [UX-REVIEWED] b36e4cd Description read[DESCRIPTION-READ] 73c819beb65ad5cfd7ed6dc4ffb02a8e9d1b9187855891e9a3e1e68e2fb88c98 That sha256 names everything this verdict read: the PR description, plus the 3 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level blocker: the allowlist reads the same before and after, the seam fits the existing Notes
[DESIGN-REVIEWED] b36e4cd Description read[DESCRIPTION-READ] d104934181a0d19515020f679331c1527e68df3bc7d93c97eb59bea8f55560dd 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 seam replaces a hard-coded literal with no change in behaviour. Its only registrant is the app that is about to leave. Notes
What this change shipsInventory (6 items) — 5 justifiedIntent: let Design Critique leave the repository without a core edit. This is an ADDITION, a decoupling refactor.
[FIRST-PRINCIPLES-REVIEWED] b36e4cd Description read[DESCRIPTION-READ] dad8af20126998d37b42761d5fd2b5c772bf5118de1bbbd17af074412c915316 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: |
7f91b24 to
66fdfd0
Compare
|
self-added: yes
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved on behalf of the watch holder (bolichen). Lanes pass on 66fdfd0, no conflict, no open change request.
66fdfd0 to
3c20138
Compare
|
Rebased: main moved in
The Captain's approval on 66fdfd0 was dismissed by this push; the new head 3c20138 needs a fresh approval. |
3c20138 to
6753d52
Compare
|
Rebased onto main 1dd2be3 (head 3c20138 -> 6753d52), no code change. The 7 failing checks on 3c20138 were one main break, not this diff:
Cause: #27933 and #27940 landed together and left the conductor tests and spec-bytes goldens stale on main; #28301 (now on main) fixed them. This PR touches neither file. Locally the 12 node ids fail on 3c20138 and pass on the rebased head; the related set (270 tests) is green, and black / isort / flake8 / mypy / comment-history / brand / line-cap gates pass. CI is re-running. |
6753d52 to
2955fe2
Compare
|
Conflict re-sync onto
|
2955fe2 to
015e5bd
Compare
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
The chat create paths hard-coded Design Critique's worker slot mode in chat_handlers._CREATABLE_MODES, so the app could not leave the repository without a core edit. The mode is now one more seam in apps/seams.py, empty by default: a built-in's seams.py calls register_worker_slot_mode(app_id), so the mode is always the app's own id and never a core mode, and chat_handlers reads worker_slot_modes() at import. The accepted set is unchanged: "" and "design-critique". The app's tests that lived in core move into its own directories: the three test/test_design_critique_* files, its row of the shared DENIED_ROOT_PARTS pin and of the app API typed-error and composer-upload tests, and the twelve website/src/test/DesignCritique* files. New guards keep core from importing or naming the app again (test_core_design_critique_decoupling.py, on the shared test/core_app_independence.py scans) and keep its UI reachable only through the builtin registry (designCritiqueBoundary.test.ts). Part of #26967
015e5bd to
b36e4cd
Compare
|
Rebased: main moved in docs/system-specs/modules/app-kit-platform.md, src/kiro_crew/apps/seams.py since this head went green (deb619a -> e54cda5); CI re-running. Conflicts came from #28338 (auto-research's |
buluoray
left a comment
There was a problem hiding this comment.
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:
Verdict: approve.
What it does for users: nothing visible changes. Design Critique's throwaway dc-* worker slots are still created under their own mode, so they stay off the chat sidebar. The difference is that the core no longer spells the app's name, so the app can later leave the repository without a core edit. This follows the same pattern as #28355 (Design Tweak) and #27435.
Evidence
- Behaviour equivalence, checked by import.
chat_handlers._CREATABLE_MODESis('', 'design-critique')on this head, which matches the literal on main (chat_handlers.py:703). I read it after importingchat_handlers,kiro_crew.dashboard,dashboard.server,dashboard.routes.system,dashboard.state,kiro_crew.cli, the auto-research package and the design-critique package first. Every order gave the same tuple, logged no seam-load warning, and left thestopped_loop_tombstoneandcrew_runtimeproviders registered. - One loader.
worker_slot_modes()(apps/seams.py, added near line 192) goes through the existing_load_builtin_seams()and its_load_lock. It does not add a third discovery path. The second per-built-in loader from an earlier round (apps/builtin_slot_modes.py) is gone. - Removed symbols have no readers. Nothing in
src/ortest/importsregister_routesfromdesign_critique.backend.routesthrough the package eagerly.test_backend_routes.py:21reads it off the package, which now goes through__getattr__. The boot loop reads it withgetattrinside theOSErrorguard (dashboard/routes/system.py:251-276). Theroutes._DENIED_ROOT_PARTSidentity pin moved todesign_critique/tests/test_denied_root_parts_owner.py:17. - Moved tests are moved, not rewritten. Git rename similarity is 100% for the owner-gate test and 97% / 88% for the SSRF and resolver-rule tests. In those two files only the path-to-scripts lines and a docstring paragraph changed. The frontend moves are 92-99% similar. The rows removed from the two cross-app frontend tests reappear in
apps/design-critique/api.typedErrors.test.tsanduploads.test.ts, including the 429 relabel case. - Unreadable-file behaviour. I simulated an unreadable auto-research route module and imported
chat_handlers, on this head and on its base. Both log and skip the auto-research seams module and keep the rest. The only difference is timing: here it happens atchat_handlersimport, and on base it happened at the first seam lookup. - Local tests: 261 passed (
design_critique/tests,test_core_design_critique_decoupling.py,test_app_seams.py,test_dashboard_builtin_app_unreadable.py,test_dashboard_chat_api_chat.py,test_denied_root_parts_shared.py,test_spawn_audit.py, at-n 4). Vitest: 19 files, 223 tests passed (apps/design-critique/,appApiTypedErrors.test.ts,appComposerUploads.test.ts, and the progress-bar i18n test). - Mutations, run one at a time and restored after each:
- I replaced
seams.register_worker_slot_mode(APP_ID)withpass. That reddenedtest_worker_slot_mode.py::test_the_app_registers_its_own_name_as_its_worker_modeand::test_the_chat_create_paths_accept_it. - I restored the eager
from .backend.routes import register_routesin the package__init__. That reddenedtest_unreadable_routes_skipped.py::test_the_route_module_is_read_by_the_lookup_not_the_calland::test_an_unreadable_route_module_does_not_abort_route_setup. - I put the
("", "design-critique")literal back inchat_handlers.py. That reddenedtest_core_design_critique_decoupling.py::test_no_core_string_names_the_app.test_app_seams.py::test_the_chat_create_paths_read_the_seamstayed green under that mutation, as expected, because the two tuples are equal. The decoupling gate is the only check that pins the literal's absence.
- I replaced
- CI on this head: 81 success, 11 skipped, 0 failing check runs. PR Readiness and both CodeBuild statuses are success. The Opus, GPT, Design and First Principles lanes all pass on this head, with no HOLD.
git merge-tree --write-treeagainst current main exits 0.
Source-only: Windows behaviour (I relied on the green Windows lanes and did not run it). I did not run the full repository suite locally.
Follow-ups (non-blocking)
- The PR body's manual-verification line says importing
chat_handlersloads "only the two built-ins' seams modules and packages, not the app's route module". After the rebase onto #28338 there are three seams modules. The auto-research package__init__imports itshandlersroute module eagerly, sochat_handlersimport now pulls in auto-research's route module and itscampaign.*modules. Outcomes match base (shown above), so this is a wording update. The spec's §23a "Light package" bullet could also say whether auto-research should adopt the same lazyregister_routesshape when it leaves. register_worker_slot_modedoes not refuse a core mode or a mode already used bychat_folders._VALID_MODES. Today only built-ins reach it, so this is not reachable from an installed app. The App Kit equivalent for external apps will need that rule.
Problem / Motivation
Goal: Kiro Crew's core stops depending on the Design Critique app, so the app can move out of this repository without a core edit.
The chat create paths hard-coded Design Critique's worker slot mode:
chat_handlers._CREATABLE_MODES = ("", "design-critique"). The app's tests also lived in core: threetest/test_design_critique_*.pyfiles, its row of the sharedDENIED_ROOT_PARTSpin, and twelvewebsite/src/test/DesignCritique*files, plus its rows in two cross-app frontend tests. None of that could leave with the app.Why it matters
Under #26967 every built-in moves to its own repository. While the core names an app, removing that app breaks the core. If
"design-critique"stays in the allowlist, it becomes a dead mode. If it is dropped from the allowlist, the app's throwawaydc-*worker slots get created as plain chats and fill the user's chat sidebar.Not a goal
""and"design-critique", as before.What changed (motivation → approach → change)
The core now asks a seam for the worker slot modes the built-ins register, instead of naming one.
POST /api/chat/slotsand thePOST /api/chatauto-createchat_handlers._CREATABLE_MODESseams.pycallsseams.register_worker_slot_mode("design-critique");_CREATABLE_MODES = ("", *seams.worker_slot_modes())test/test_design_critique_*.py, and the app's row intest/test_denied_root_parts_shared.pyapps/builtins/design_critique/tests/; their twonodespawns are rows intest/spawn_audit_app_spawns.pywebsite/src/test/DesignCritique*,designCritiqueSendReceipt.test.ts, and the app's rows inappApiTypedErrors.test.ts/appComposerUploads.test.tswebsite/src/apps/design-critique/The mode is one more seam in the existing
apps/seams.py, so the core keeps one loader for what a built-in provides. Unlike the provider seams, every app may hold one, and each built-in registers its own id.chat_handlersreads the seam once, at import, and that first lookup is what loads the built-in seams modules, so only a built-in reaches the create paths. Because that lookup imports the app's package,design_critique/__init__.pyservesregister_routesfrom a module__getattr__(the aws-control shape): the route module is imported by the boot route loop's guarded lookup, so an unreadable route file is still logged and skipped, not fatal. Comments inchat_handlers.py,chat_send.pyandchat_slot.pystop naming the app.test_core_design_critique_decoupling.pyfails if any core module or script imports the app (any import spelling) or names it in a non-docstring string. It calls the sharedtest/core_app_independence.pyscans, like the aws-control and Files gates, and flags main'schat_handlers.py:672.designCritiqueBoundary.test.tsfails if anything outsideapps/design-critique/imports the UI, except the registry. Spec:app-kit-platform.md§23a and the §30 seam table.Couplings that remain, each leaving with the app:
apps/builtins/__init__.pyBUILTIN_NAMESandwebsite/src/apps/builtinRegistry.ts's/design-critiquerow: the built-in still ships.website/src/components/appstore/appManifest.tsstore-copy keys and theapps.designCritique.*i18n keys in the 15 locale catalogs: these wait for the manifest l10n block (feat(app-kit): add level-1 seams for apps leaving the core #27517).website/public/app-assets/design-critique/: served at the URLsapp.jsonnames..github/black-baseline.txt,.github/docs-lint-baseline.txt,website/eslint.i18n.config.js, the i18n baselines,capture-app-store-gallery.mjs,check-kiro-light-cards.mjs,i18n-surfaces.mjs,test/test_git_tree_removal_windows.py,test/link_screen_sites.py,test/test_ci_surface_tests.py,test/spawn_audit_app_spawns.py,test/gui_user/features.json.security/paths.py,token_auth_app_scope.pyandapi/apiError.ts;src/kiro_crew/docs/apps.md;security-deep-dive.md.design-critiqueonly as a fixture label, with no dependency on the app.Backwards compatibility
Compatible:
_CREATABLE_MODESis("", "design-critique")before and after (test_worker_slot_mode.pypins it). Persisteddc-*slots restore through_restored_mode, which this PR does not touch. The routes, URLs and page are unchanged.Removes nothing: every moved test still runs from its new directory, and no route, key, mode or record is removed.
Tests
test/test_app_seams.pyTestWorkerSlotModes: modes come back in registration order, registering twice is a no-op, no registration means no mode, a non-string is refused, and_CREATABLE_MODESequals("", *worker_slot_modes()).test/test_core_design_critique_decoupling.py: no core module or script imports or names the app. Each import spelling, a hard-coded allowlist entry, a split string and an f-string are proven to be caught; a docstring, a comment and an unrelated built-in are not.apps/builtins/design_critique/tests/test_worker_slot_mode.pyandtest_denied_root_parts_owner.py: the app's mode reaches the create allowlist, and its guard still holds the sharedDENIED_ROOT_PARTSobject.apps/builtins/design_critique/tests/test_unreadable_routes_skipped.py: readingregister_routesoff the package is what imports the route module, and aPermissionErrorthere leavessystem.registerrunning, logged, with no Design Critique route. Both tests fail against a package that imports the route module insideregister_routes.test/test_dashboard_chat_api_chat.pyTestApiChatModeForwardingregisters a fixture worker mode on the facade, so it does not depend on which built-ins register one.website/src/apps/design-critique/designCritiqueBoundary.test.ts,api.typedErrors.test.ts(named like the Files and Design Tweak copies),uploads.test.ts: the UI boundary, and the app's rows of the two cross-app tests, its 429 relabel case included. The coreappApiTypedErrors.test.tsnow pins only Mochi, so its 429 case runs againstgetWatchlist().Proof: not provable -- other: refactor with no behaviour change; the guard's positive control is that it flags origin/main's chat_handlers.py:672
Local, rebased on
deb619a442: the app's own tests,test_core_design_critique_decoupling.py,test_app_seams.py,test_dashboard_builtin_app_unreadable.py,test_dashboard_chat_api_chat.py,test_denied_root_parts_shared.pyandtest_spawn_audit.py: 261 passed at-n 4. The gate reds whenchat_handlers.pygets back a"design-critique"literal or an import of the app. The vitest files underapps/design-critique/, plusappApiTypedErrors.test.ts,appComposerUploads.test.tsandSubagentProgressBar.i18n.test.tsx: 223 passed. mypy, flake8, isort, the black, subprocess-encoding, comment-history, brand, line-cap and docs-lint gates and the flake-pattern ratchet are green. semgrep is not installed on this host, so the SAST lane is the semgrep run.Determinism:
test_unreadable_routes_skipped.pypasses 20 times at-n0, and withtest_dashboard_builtin_app_unreadable.pyinterleaved in one order and its reverse.test_app_seams.pyandtest_worker_slot_mode.pypass 5 times at-n0, each in a different shuffled order (seeds 1 to 5).test_core_design_critique_decoupling.pypasses 5 times at-n0in shuffled orders (seeds 0 to 4), and 3 times over at-n 4.Manual verification
N/A — a refactor with no behaviour change.
_CREATABLE_MODESwas read in a fresh interpreter (('', 'design-critique')), and importingchat_handlersloads only the two built-ins'seamsmodules and packages, not the app's route module.Screenshots / video
Why no screenshot: only test files move under
website/, with only import paths changed, so nothing renders differently.Related Issues
Part of #26967
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)