Repository navigation
refactor: split change_card_catalog.py into kinds and plans owners - #22845
Conversation
Sensitive change review
|
Sensitive Change ReviewSensitive files changed:
|
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS This is a mechanical split behind the repo's existing Notes
[DESIGN-REVIEWED] 20a12ac Description read[DESCRIPTION-READ] e4279657e6af7329e7b6268319769b20f549191756ed2cf7efd5d99493d30eb3 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 is a split required by the AGENTS.md 2,000-line cap. It goes through What this change shipsInventory (6 items) — 6 justifiedIntent: bring
[FIRST-PRINCIPLES-REVIEWED] 20a12ac Description read[DESCRIPTION-READ] b1bb7817b4a6e6ea265596ff1339babb7632e37565703eb05a790f3e3883a3b0 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: |
34457b5 to
5e5562f
Compare
Sensitive change review
|
5e5562f to
73bb389
Compare
Sensitive change review
|
change_card_catalog.py (2,742 lines) was over the 2,000-line file cap. It keeps its path as the one import path and patch surface: a _facade_mirror facade that keeps the evidence, undo, result and manual-change code, over two sibling owners moved verbatim: - change_card_catalog_kinds.py: kind ids, risk and limit constants, the KINDS table, list_kinds and parameter validation - change_card_catalog_plans.py: plan steps and fills, the stores and dashboard setting tables, the display helpers, the plan pieces Apply and Undo share, and build_preview A test patches LIST_SETTING_WORDING through the facade and the moved build_preview reads it as a global, so the mirror carries a write of any facade name to every module holding it. CardCatalogError keeps the facade __module__. The change-card redaction sink row follows the redactor call into the plans owner, the line-cap baseline row goes, the facade gains its campaign inventory and patch-reach test, one test reads dir() so its namespace check still covers the moved names, and the docs cite the new homes. Part of #20192
73bb389 to
20a12ac
Compare
Sensitive change review
|
iamwhatever
left a comment
There was a problem hiding this comment.
Approve at 20a12ac.
This is a faithful move behind the existing _facade_mirror facade. An AST comparison against the merge base finds all 155 top-level units of the old change_card_catalog.py verbatim in the three modules, with only facade glue and CardCatalogError.__module__ added. No unit is defined twice, every outside import resolves to the same source, and main has not edited the catalog since the merge base.
The one sensitive-path edit is the redaction sink row in security_posture.py. It follows the unchanged redact_via_context call into change_card_catalog_plans.py, keeps the same classification and drops no row, so nothing about redaction changes.
All AI lanes pass on this head, every check is green, and there is no open change request. I read the CI results and test sources and did not run the suites locally.
— crew-pr-reviewer (r119)
Problem / Motivation
Goal: Bring
change_card_catalog.pyunder the 2,000-line file cap without changing what it does, so the next change card kind, preview or undo lands in a module sized for it.Part of #20192
src/kiro_crew/change_card_catalog.py(2,742 lines) is one of the hand-written files over the repository's 2,000-line cap. It is a row of.github/file-line-cap-baseline.txt, which only shrinks, and it had already grown 684 lines past that row (2,058).Why it matters
A file over the cap blocks the next author who touches it: every new change-card kind adds to the kinds table, the parameter checks, the preview and the undo, all in one file the code-style rule says is too large, and the line-cap guard reports each growth. Splitting by responsibility puts each of those edits in a module that names the work it holds.
Not a goal
## Non-move edits.build_preview,validate_params,_build_undo, theKINDStable); each moves or stays whole.What changed (motivation → approach → change)
The file keeps its path as the one import path and the one patch surface. Its code moves into two sibling owners grouped by responsibility, behind a
kiro_crew._facade_mirrorfacade (the shape of its callerdashboard/change_cards.py): a test patchesLIST_SETTING_WORDING, a global the movedbuild_previewreads, so the facade sends a write of any of its names to every module holding it.change_card_catalog.pyextract_evidence,build_undo,result_summary,describe_manual_change,HOOKED_ROUTES,MEMORY_ROUTES)change_card_catalog_kinds.py(new)KINDStable,list_kinds, and parameter validation (validate_params,check_editable)change_card_catalog_plans.py(new)_display), the plan pieces Apply and Undo share, andbuild_previewThe layering follows the code's own dependencies: validation reads nothing from the plans, the plans read the kinds, and the undo reads both, so the undo stays in the facade and neither owner imports it.
CHECK_IN_FIELDSmoves down to the kinds owner becausevalidate_paramsreads it. The redaction-sink row for change-card details follows the redactor call intochange_card_catalog_plans.py, anddocs/architecture/mcp.mdgains the owner map.Backwards compatibility
Compatible: every name the module bound at BASE still resolves on it as the same object (
test/campaign_facade_inventories/kiro_crew.change_card_catalog.json, 83 names), every function keeps its signature, and a patch of a facade name reaches the moved code (test/test_change_card_catalog_facade.py,test/test_facade_mirror_guards.py).CardCatalogErrorkeeps the facade__module__, because a traceback renders it. The module has no logger, so no record name changes (L25).Reader: src/kiro_crew/change_card_catalog.py:list_kinds -- chat --
dashboard/handlers/change_cards.py(thelist_change_kindsroute) reads it throughkiro_crew.change_card_catalog, which serves thechange_card_catalog_kindsowner's object; test_change_card_clear_spellings.pyReader: src/kiro_crew/change_card_catalog.py:validate_params -- chat --
dashboard/handlers/change_cards.py,dashboard/change_cards_readers.py,dashboard/change_cards_records.pyandcrewmate_bundle.pyread it throughkiro_crew.change_card_catalog, which serves thechange_card_catalog_kindsowner's object; test_change_cards.pyReader: src/kiro_crew/change_card_catalog.py:valid_mcp_name -- chat -- defined in the
change_card_catalog_kindsowner and served bykiro_crew.change_card_catalog(no caller outside the family reads it); test_campaign_facades_base_public_names.pyReader: src/kiro_crew/change_card_catalog.py:check_editable -- chat --
dashboard/change_cards.pyanddashboard/handlers/change_cards.pyread it throughkiro_crew.change_card_catalog, which serves thechange_card_catalog_kindsowner's object; test_change_cards.pyReader: src/kiro_crew/change_card_catalog.py:step -- chat -- the facade's own undo code imports it from the
change_card_catalog_plansowner, andkiro_crew.change_card_catalogserves the same object; test_change_cards_undo.pyReader: src/kiro_crew/change_card_catalog.py:is_path_fill -- chat --
dashboard/handlers/change_cards.pyreads it throughkiro_crew.change_card_catalog, which serves thechange_card_catalog_plansowner's object; test_member_goals_cards.pyReader: src/kiro_crew/change_card_catalog.py:placeholder -- chat --
dashboard/handlers/change_cards.pyreads it throughkiro_crew.change_card_catalog, which serves thechange_card_catalog_plansowner's object; test_change_cards_settlement.pyReader: src/kiro_crew/change_card_catalog.py:value_allowed -- chat --
dashboard/change_cards_settings.pyreads it throughkiro_crew.change_card_catalog, which serves thechange_card_catalog_plansowner's object; test_change_cards_settings.pyReader: src/kiro_crew/change_card_catalog.py:string_items -- chat --
dashboard/change_cards_readers.py,dashboard/change_cards_settings.py,dashboard/handlers/change_cards.pyand the facade's undo code read it, all reaching thechange_card_catalog_plansowner's object; test_change_card_clear_spellings.pyReader: src/kiro_crew/change_card_catalog.py:list_after -- chat -- defined in the
change_card_catalog_plansowner beside its one callerbuild_preview, and served bykiro_crew.change_card_catalog; test_change_cards_settings.pyReader: src/kiro_crew/change_card_catalog.py:list_op_step -- chat -- the facade's own undo code imports it from the
change_card_catalog_plansowner, andkiro_crew.change_card_catalogserves the same object; test_change_cards_settings.pyReader: src/kiro_crew/change_card_catalog.py:setting_write_step -- chat -- the facade's own undo code imports it from the
change_card_catalog_plansowner, andkiro_crew.change_card_catalogserves the same object; test_change_cards_undo.pyReader: src/kiro_crew/change_card_catalog.py:build_preview -- chat --
dashboard/change_cards_readers.pyanddashboard/change_cards_records.pyread it throughkiro_crew.change_card_catalog, which serves thechange_card_catalog_plansowner's object; test_change_cards.pyReader: src/kiro_crew/change_card_catalog.py:offers_no_undo -- chat -- the facade's own undo code imports it from the
change_card_catalog_plansowner, andkiro_crew.change_card_catalogserves the same object; test_change_cards_undo.pyReader: src/kiro_crew/change_card_catalog.py:legacy_create_apply -- chat --
dashboard/change_cards_records.pyreads it throughkiro_crew.change_card_catalog, which serves thechange_card_catalog_plansowner's object; test_change_cards_settlement.pyReader: src/kiro_crew/change_card_catalog.py:capability_inverse -- chat -- the facade's own undo code imports it from the
change_card_catalog_plansowner, andkiro_crew.change_card_catalogserves the same object; test_change_cards.pyTests
test/test_change_card_catalog_facade.py(new): every name the test trees patch through the facade reaches every module holding it, with a non-vacuity self-test of the corpus scan; a patch ofLIST_SETTING_WORDINGthrough the facade changes the title the movedbuild_previewwrites, and the undo restores it; the owners are exactly thechange_card_catalog_*.pysiblings, loaded lowest layer first; the kept code stays bound on the facade; names served from outside the family are in the facade'sTYPE_CHECKINGmanifest (L42);CardCatalogErrorkeeps the facade module;python -m kiro_crew.change_card_catalogstill imports cleanly; and the file is derived as a corpus gate. 5 runs at-n0, a reversed-order run and-n 3green.test/test_first_crewmate_ordinary.py:140readsdir(catalog)instead ofvars(catalog), assertion unchanged. On a mirror facadevars()holds only the facade's own names, so the "no catalog name mentions assistant" check would silently skip every owner name;dir()lists exactly the BASE namespace plus the mirror glue. Mutation-proved: a planted_assistant_probein the kinds owner fails it (rc 1) withdir()and passes withvars().Move audit
move_audit.py --base <merge-base> --head <head>(every BASE top-level unit, by AST):Non-move edits
change_card_catalog_kinds.pyCardCatalogError.__module__ = "kiro_crew.change_card_catalog"after the classmodule.qualnamein tracebacksTYPE_CHECKINGmanifests, the owner-map comment, the owner loop, the mirror install, the class swap,__all__KindDefkeeps its owner__module__: nothing reads it (no reader outside the catalog names the class, and no test, pickle or repr reads its module).Guard changes
src/kiro_crew/security_posture.py(sensitive path, L55): the "Change-card details shown before Apply" sink row nameschange_card_catalog_plans.py, where_display'sredact_via_contextcall moved; neither the facade nor the kinds owner calls a redactor, soNON_EGRESS_REDACTION_MODULESis unchanged. Reverting the row turnstest_a_partially_covered_sink_says_soand the omission test red (rc 1); removing the redactor call from_displayturnstest_every_named_sink_module_actually_redactsred (rc 1).test/test_first_crewmate_ordinary.py:140: the re-point above..github/file-line-cap-baseline.txt: thechange_card_catalog.pyrow deleted (the file is under the cap; the owners are under 1,600).test/campaign_facade_inventories/kiro_crew.change_card_catalog.json(L52).Docs and citations
docs/architecture/mcp.md, which describes the change cards, gains the catalog's owner map (no spec underdocs/system-specs/describes the module's layout). Citations corrected (L29, path or name only),file:line old -> new:docs/request-for-change/rfc-crewmate-share.md:37:KIND_CREWMATE_CREATEinchange_card_catalog.py->change_card_catalog_kinds.py;build_previewinchange_card_catalog.py->change_card_catalog_plans.pydocs/request-for-change/rfc-crewmate-share.md:178:build_previewinchange_card_catalog.py->change_card_catalog_plans.pydocs/feature-map/README.md:453:change_card_catalog.py->change_card_catalog.py(evidence, undo, results),change_card_catalog_kinds.py(kinds and parameter validation),change_card_catalog_plans.py(plans and previews)Left as they are: the dotted
change_card_catalog.<name>cites (the facade serves every name), cites of what stays on the facade (HOOKED_ROUTES,MEMORY_ROUTES), and the module-path cites inconfig.md:435,rfc-crewmate-goals.md:77andfeature-map/README.md:96,154, which name the catalog's import path.CI path references
None: no workflow path filter or explicit file list names the file.
Diff layout (L36)
git diffandgit diff --minimalreport the same numstat and add the same lines on every changed file (facade +189/-2255 under both; every other file equal too). Diff size: 248,702 bytes.Gates run locally
-n 3(every test file that importschange_card_catalog, plus the mirror, mirrored-owner, inventory, security-posture and dashboard-server contract guards, plustest_member_goals_heartbeat.py; 28 files): 1,657 passed, 0 failed.scripts/local-gate.py --base <merge-base>: backend related set, 263 files: 10,380 passed, 43 skipped, 1 xfailed, 0 failed; frontend cross-surface set, 387 files: 11,437 passed (no file underwebsite/changes).-n0, one reversed-order run and the-n 3floor runs, all green;test_flake_pattern_ratchet.pyandtest_wait_discipline_ratchet.pyat-n0green.change_card_catalog.py91.5%,change_card_catalog_kinds.py92.7%,change_card_catalog_plans.py94.1%.mypy src/kiro_crew/: no issues in 3,506 files. flake8 on every edited file, the CI isort command, and black: clean.Reader:lines),check_inventory.py(83 names, none missing): clean.--baseline-commitat the merge-base) over the 6 changed Python files: 0 findings, no parse errors.git archiveexport of the head imports the facade and both owners from the installed copy; the facade is aMirroredModule.Upstream ports
#21172 (
80261cb677, the crewmate heartbeat check-in) edited six units of the catalog after this split was first cut. The recipe re-run on the new main carries each hunk inside the unit it edits, verbatim: thecrewmate.check_insentry ofKINDS,validate_paramsandCHECK_IN_FIELDSland inchange_card_catalog_kinds.py;build_preview,CHECK_IN_LABELSand_check_in_valueinchange_card_catalog_plans.py. The family's-U0delta against the earlier head is exactly that commit's 56 changed lines, and the facade is unchanged. #20965 (f39359db45, the crewmate to mate wording) then edited 26 lines the same way: 20 inbuild_preview(plans owner) and 6 inresult_summaryanddescribe_manual_change, which the facade keeps; the family's delta is exactly its 52 changed lines, and the Change cards row ofdocs/feature-map/README.mdkeeps main's wording with the owner list added.CodeQL alerts that move with the code
None: no open or dismissed alert is on the file.
Sensitive change
src/kiro_crew/security_posture.py: the one registry row listed under## Guard changesfollows the moved redactor call (same classification; the posture panel names the owner module). The author's reasoning template is posted on the PR for the head.Manual verification
N/A — a pure move: the move audit proves the bodies, the change-card suites pass unchanged, and an installed wheel built from
git archiveimports both new modules.Related Issues
Part of #20192
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)