Skip to content

refactor: split change_card_catalog.py into kinds and plans owners - #22845

Merged
iamwhatever merged 1 commit into
mainfrom
refactor/linecap-s82-change-card-catalog
Oct 22, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
refactor/linecap-s82-change-card-catalog

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring change_card_catalog.py under 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

  • Any behaviour change: every unit moves verbatim, apart from the glue listed under ## Non-move edits.
  • Decomposing the largest units (build_preview, validate_params, _build_undo, the KINDS table); each moves or stays whole.
  • New features in the moved code, or fixing citations that were already wrong before this change.

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_mirror facade (the shape of its caller dashboard/change_cards.py): a test patches LIST_SETTING_WORDING, a global the moved build_preview reads, so the facade sends a write of any of its names to every module holding it.

File Before After Holds
change_card_catalog.py 2,790 724 the facade, plus the evidence, undo, result and manual-change code (extract_evidence, build_undo, result_summary, describe_manual_change, HOOKED_ROUTES, MEMORY_ROUTES)
change_card_catalog_kinds.py (new) 1,137 the kind ids, risk and limit constants, the KINDS table, list_kinds, and parameter validation (validate_params, check_editable)
change_card_catalog_plans.py (new) 1,198 the plan steps and fills, the stores and dashboard setting tables, the display helpers (the credential redactor runs in _display), the plan pieces Apply and Undo share, and build_preview

The 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_FIELDS moves down to the kinds owner because validate_params reads it. The redaction-sink row for change-card details follows the redactor call into change_card_catalog_plans.py, and docs/architecture/mcp.md gains 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). CardCatalogError keeps 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 (the list_change_kinds route) reads it through kiro_crew.change_card_catalog, which serves the change_card_catalog_kinds owner's object; test_change_card_clear_spellings.py
Reader: src/kiro_crew/change_card_catalog.py:validate_params -- chat -- dashboard/handlers/change_cards.py, dashboard/change_cards_readers.py, dashboard/change_cards_records.py and crewmate_bundle.py read it through kiro_crew.change_card_catalog, which serves the change_card_catalog_kinds owner's object; test_change_cards.py
Reader: src/kiro_crew/change_card_catalog.py:valid_mcp_name -- chat -- defined in the change_card_catalog_kinds owner and served by kiro_crew.change_card_catalog (no caller outside the family reads it); test_campaign_facades_base_public_names.py
Reader: src/kiro_crew/change_card_catalog.py:check_editable -- chat -- dashboard/change_cards.py and dashboard/handlers/change_cards.py read it through kiro_crew.change_card_catalog, which serves the change_card_catalog_kinds owner's object; test_change_cards.py
Reader: src/kiro_crew/change_card_catalog.py:step -- chat -- the facade's own undo code imports it from the change_card_catalog_plans owner, and kiro_crew.change_card_catalog serves the same object; test_change_cards_undo.py
Reader: src/kiro_crew/change_card_catalog.py:is_path_fill -- chat -- dashboard/handlers/change_cards.py reads it through kiro_crew.change_card_catalog, which serves the change_card_catalog_plans owner's object; test_member_goals_cards.py
Reader: src/kiro_crew/change_card_catalog.py:placeholder -- chat -- dashboard/handlers/change_cards.py reads it through kiro_crew.change_card_catalog, which serves the change_card_catalog_plans owner's object; test_change_cards_settlement.py
Reader: src/kiro_crew/change_card_catalog.py:value_allowed -- chat -- dashboard/change_cards_settings.py reads it through kiro_crew.change_card_catalog, which serves the change_card_catalog_plans owner's object; test_change_cards_settings.py
Reader: src/kiro_crew/change_card_catalog.py:string_items -- chat -- dashboard/change_cards_readers.py, dashboard/change_cards_settings.py, dashboard/handlers/change_cards.py and the facade's undo code read it, all reaching the change_card_catalog_plans owner's object; test_change_card_clear_spellings.py
Reader: src/kiro_crew/change_card_catalog.py:list_after -- chat -- defined in the change_card_catalog_plans owner beside its one caller build_preview, and served by kiro_crew.change_card_catalog; test_change_cards_settings.py
Reader: src/kiro_crew/change_card_catalog.py:list_op_step -- chat -- the facade's own undo code imports it from the change_card_catalog_plans owner, and kiro_crew.change_card_catalog serves the same object; test_change_cards_settings.py
Reader: src/kiro_crew/change_card_catalog.py:setting_write_step -- chat -- the facade's own undo code imports it from the change_card_catalog_plans owner, and kiro_crew.change_card_catalog serves the same object; test_change_cards_undo.py
Reader: src/kiro_crew/change_card_catalog.py:build_preview -- chat -- dashboard/change_cards_readers.py and dashboard/change_cards_records.py read it through kiro_crew.change_card_catalog, which serves the change_card_catalog_plans owner's object; test_change_cards.py
Reader: src/kiro_crew/change_card_catalog.py:offers_no_undo -- chat -- the facade's own undo code imports it from the change_card_catalog_plans owner, and kiro_crew.change_card_catalog serves the same object; test_change_cards_undo.py
Reader: src/kiro_crew/change_card_catalog.py:legacy_create_apply -- chat -- dashboard/change_cards_records.py reads it through kiro_crew.change_card_catalog, which serves the change_card_catalog_plans owner's object; test_change_cards_settlement.py
Reader: src/kiro_crew/change_card_catalog.py:capability_inverse -- chat -- the facade's own undo code imports it from the change_card_catalog_plans owner, and kiro_crew.change_card_catalog serves the same object; test_change_cards.py

Tests

  • 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 of LIST_SETTING_WORDING through the facade changes the title the moved build_preview writes, and the undo restores it; the owners are exactly the change_card_catalog_*.py siblings, loaded lowest layer first; the kept code stays bound on the facade; names served from outside the family are in the facade's TYPE_CHECKING manifest (L42); CardCatalogError keeps the facade module; python -m kiro_crew.change_card_catalog still imports cleanly; and the file is derived as a corpus gate. 5 runs at -n0, a reversed-order run and -n 3 green.
  • Re-point (L30, Master grant): test/test_first_crewmate_ordinary.py:140 reads dir(catalog) instead of vars(catalog), assertion unchanged. On a mirror facade vars() 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_probe in the kinds owner fails it (rc 1) with dir() and passes with vars().
  • No other existing test changed.

Move audit

move_audit.py --base <merge-base> --head <head> (every BASE top-level unit, by AST):

src/kiro_crew/change_card_catalog.py: 2790 -> 724 lines; moved 100.0% (python-ast)

Non-move edits

Where Edit Why
change_card_catalog_kinds.py CardCatalogError.__module__ = "kiro_crew.change_card_catalog" after the class an exception renders as module.qualname in tracebacks
both owners a module docstring each, and import headers computed from the names each owner's code reads glue
facade glue only: header imports the kept code does not read dropped, owner imports, the two TYPE_CHECKING manifests, the owner-map comment, the owner loop, the mirror install, the class swap, __all__

KindDef keeps 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 names change_card_catalog_plans.py, where _display's redact_via_context call moved; neither the facade nor the kinds owner calls a redactor, so NON_EGRESS_REDACTION_MODULES is unchanged. Reverting the row turns test_a_partially_covered_sink_says_so and the omission test red (rc 1); removing the redactor call from _display turns test_every_named_sink_module_actually_redacts red (rc 1).
  • test/test_first_crewmate_ordinary.py:140: the re-point above.
  • .github/file-line-cap-baseline.txt: the change_card_catalog.py row deleted (the file is under the cap; the owners are under 1,600).
  • New: 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 under docs/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_CREATE in change_card_catalog.py -> change_card_catalog_kinds.py; build_preview in change_card_catalog.py -> change_card_catalog_plans.py
  • docs/request-for-change/rfc-crewmate-share.md:178: build_preview in change_card_catalog.py -> change_card_catalog_plans.py
  • docs/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 in config.md:435, rfc-crewmate-goals.md:77 and feature-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 diff and git diff --minimal report 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

  • Focused floor at -n 3 (every test file that imports change_card_catalog, plus the mirror, mirrored-owner, inventory, security-posture and dashboard-server contract guards, plus test_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 under website/ changes).
  • New and edited tests: 5 runs at -n0, one reversed-order run and the -n 3 floor runs, all green; test_flake_pattern_ratchet.py and test_wait_discipline_ratchet.py at -n0 green.
  • Line coverage over that focused floor (CI measures the whole suite, so these are floors): change_card_catalog.py 91.5%, change_card_catalog_kinds.py 92.7%, change_card_catalog_plans.py 94.1%.
  • mypy src/kiro_crew/: no issues in 3,506 files. flake8 on every edited file, the CI isort command, and black: clean.
  • comment-history, brand, harness parity, docs-lint, line cap (0 failures), subprocess encoding, take-away (16 Reader: lines), check_inventory.py (83 names, none missing): clean.
  • semgrep 1.78 (the CI configs, --baseline-commit at the merge-base) over the 6 changed Python files: 0 findings, no parse errors.
  • An installed wheel built from a git archive export of the head imports the facade and both owners from the installed copy; the facade is a MirroredModule.
  • The recipe (name-anchored, AST-checked script) re-run on the merge-base reproduces the three modules byte for byte.

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: the crewmate.check_ins entry of KINDS, validate_params and CHECK_IN_FIELDS land in change_card_catalog_kinds.py; build_preview, CHECK_IN_LABELS and _check_in_value in change_card_catalog_plans.py. The family's -U0 delta 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 in build_preview (plans owner) and 6 in result_summary and describe_manual_change, which the facade keeps; the family's delta is exactly its 52 changed lines, and the Change cards row of docs/feature-map/README.md keeps 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 changes follows 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 archive imports both new modules.

Related Issues

Part of #20192

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 34457b5
  • What rule changed: no rule changes; one security_posture.py registry row follows a redactor call that moved verbatim: the "Change-card details shown before Apply" sink names change_card_catalog_plans.py, where _display and its redact_via_context call now live, instead of change_card_catalog.py.
  • Before -> after (what was allowed/blocked, now): unchanged behaviour: the same redact_via_context call runs at the same point on the same values (an MCP server's launch line, environment values and request headers a card shows in full); only the module path the posture registry names follows the code, so the panel's sink count and classification are unchanged.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the posture drift guard would report an unregistered redactor site or a stale row (a CI failure); no command, secret or access path changes, because the moved bodies are AST-identical (move audit 100%, 0 changed units).
  • Evidence checked (which sandbox result proves it): test_security_posture.py passes on this head (56 passed); reverting the row to change_card_catalog.py turns test_a_partially_covered_sink_says_so and the omission test red, and removing the redactor call from _display turns test_every_named_sink_module_actually_redacts red (rc 1 each).
  • No regression:
    • Tools still work (which tools/commands were run, result): the focused floor (27 files, every importer of the catalog plus the mirror and posture guards) at -n 3: 1,590 passed; the backend related set (263 files): 10,336 passed, 0 failed; mypy clean on 3,477 files.
    • Backward compatible (old config / old data / old callers still work, how checked): every name the module exported still resolves on it as the same object (test_campaign_facades_base_public_names.py with the new inventory, 83 names), and no stored file format changes (change_cards.json is read and written by the same code).
    • Existing tests (which suites passed on this head): test_security_posture.py, test_change_cards*.py, test_change_card_*.py, test_member_goals*.py, test_facade_mirror_guards.py, test_mirrored_owner_storage.py, test_dashboard_server_composition_contract.py.
  • How to undo: revert this one commit; the row returns to the facade path together with the code it classifies.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security_posture.py

  • @bolichen97 posted a complete reasoning template for 20a12ac.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 20a12acb903e6e09116b3bb4f537970c9ce874d3 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 20a12acb903e6e09116b3bb4f537970c9ce874d3 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

This is a mechanical split behind the repo's existing _facade_mirror facade. Nothing is taken away: every name a caller imports still resolves on the original module, and tests pin that.

Notes

  • In test_first_crewmate_ordinary.py, changing vars(catalog) to dir(catalog) keeps the assertion as strict as before, because the facade's names reach dir() even when they don't appear in vars(). It doesn't weaken the pin.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@bolichen97
bolichen97 enabled auto-merge (squash) October 21, 2026 18:05
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 20a12acb903e6e09116b3bb4f537970c9ce874d3 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: this is a split required by the AGENTS.md 2,000-line cap. It goes through kiro_crew._facade_mirror, which 260 src/kiro_crew modules already use, and no default or behaviour changes.

What this change ships

Inventory (6 items) — 6 justified

Intent: bring change_card_catalog.py under the file-line cap without changing behaviour, so the next change-card kind lands in a module sized for it. This is a REFACTOR (neither a fix nor an addition).

  1. Change-card code now lives in change_card_catalog_kinds.py and change_card_catalog_plans.py, and the old import path stays as a mirror facade — justified
  2. The change_card_catalog.py row is removed from the line-cap baseline — justified
  3. The owner map is added to docs/architecture/mcp.md, and the citations in the feature map and in rfc-crewmate-share.md point at the new owners (status unchanged) — justified
  4. The redaction-sink row in the security posture now names change_card_catalog_plans.py — justified
  5. A facade name inventory (83 names) and a patch-reach test are added — justified
  6. The "no assistant names" pin reads dir(catalog) instead of vars(catalog), so it still covers names the facade serves — justified

[FIRST-PRINCIPLES-REVIEWED] 20a12ac

Description read

[DESCRIPTION-READ] b1bb7817b4a6e6ea265596ff1339babb7632e37565703eb05a790f3e3883a3b0

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 20a12acb903e6e09116b3bb4f537970c9ce874d3 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 20a12ac

Verdict parsed from the review's SHA-scoped output markers for commit 20a12acb903e6e09116b3bb4f537970c9ce874d3.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 20a12acb903e6e09116b3bb4f537970c9ce874d3: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 20a12acb903e6e09116b3bb4f537970c9ce874d3 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 20a12ac

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 20a12acb903e6e09116b3bb4f537970c9ce874d3: <one-sentence reason>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 21, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-s82-change-card-catalog branch from 34457b5 to 5e5562f Compare October 21, 2026 22:31
@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 5e5562f
  • What rule changed: no rule changes; one security_posture.py registry row follows a redactor call that moved verbatim: the "Change-card details shown before Apply" sink names change_card_catalog_plans.py, where _display and its redact_via_context call now live, instead of change_card_catalog.py.
  • Before -> after (what was allowed/blocked, now): unchanged behaviour: the same redact_via_context call runs at the same point on the same values (an MCP server's launch line, environment values and request headers a card shows in full); only the module path the posture registry names follows the code, so the panel's sink count and classification are unchanged.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the posture drift guard would report an unregistered redactor site or a stale row (a CI failure); no command, secret or access path changes, because the moved bodies are AST-identical (move audit 100%, 0 changed units).
  • Evidence checked (which sandbox result proves it): test_security_posture.py passes on this head; reverting the row to change_card_catalog.py turns test_a_partially_covered_sink_says_so and the omission test red, and removing the redactor call from _display turns test_every_named_sink_module_actually_redacts red (rc 1 each).
  • No regression:
    • Tools still work (which tools/commands were run, result): the focused floor (28 files, every importer of the catalog, the heartbeat check-in tests, and the mirror and posture guards) at -n 3: 1,639 passed; the backend related set (263 files): 10,380 passed, 0 failed; mypy clean on 3,483 files.
    • Backward compatible (old config / old data / old callers still work, how checked): every name the module exported still resolves on it as the same object (test_campaign_facades_base_public_names.py with the new inventory, 83 names), and no stored file format changes (change_cards.json is read and written by the same code).
    • Existing tests (which suites passed on this head): test_security_posture.py, test_change_cards*.py, test_change_card_*.py, test_member_goals*.py, test_facade_mirror_guards.py, test_mirrored_owner_storage.py, test_dashboard_server_composition_contract.py.
  • How to undo: revert this one commit; the row returns to the facade path together with the code it classifies.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 21, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-s82-change-card-catalog branch from 5e5562f to 73bb389 Compare October 22, 2026 01:57
@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 73bb389
  • What rule changed: no rule changes; one security_posture.py registry row follows a redactor call that moved verbatim: the "Change-card details shown before Apply" sink names change_card_catalog_plans.py, where _display and its redact_via_context call now live, instead of change_card_catalog.py.
  • Before -> after (what was allowed/blocked, now): unchanged behaviour: the same redact_via_context call runs at the same point on the same values (an MCP server's launch line, environment values and request headers a card shows in full); only the module path the posture registry names follows the code, so the panel's sink count and classification are unchanged.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the posture drift guard would report an unregistered redactor site or a stale row (a CI failure); no command, secret or access path changes, because the moved bodies are AST-identical (move audit 100%, 0 changed units).
  • Evidence checked (which sandbox result proves it): test_security_posture.py passes on this head; reverting the row to change_card_catalog.py turns test_a_partially_covered_sink_says_so and the omission test red, and removing the redactor call from _display turns test_every_named_sink_module_actually_redacts red (rc 1 each).
  • No regression:
    • Tools still work (which tools/commands were run, result): the focused floor (28 files, every importer of the catalog, the heartbeat check-in tests, and the mirror and posture guards) at -n 3: 1,639 passed; the backend related set (263 files): 10,380 passed, 0 failed; mypy clean on 3,483 files.
    • Backward compatible (old config / old data / old callers still work, how checked): every name the module exported still resolves on it as the same object (test_campaign_facades_base_public_names.py with the new inventory, 83 names), and no stored file format changes (change_cards.json is read and written by the same code).
    • Existing tests (which suites passed on this head): test_security_posture.py, test_change_cards*.py, test_change_card_*.py, test_member_goals*.py, test_facade_mirror_guards.py, test_mirrored_owner_storage.py, test_dashboard_server_composition_contract.py.
  • How to undo: revert this one commit; the row returns to the facade path together with the code it classifies.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 22, 2026
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 22, 2026
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
@bolichen97
bolichen97 force-pushed the refactor/linecap-s82-change-card-catalog branch from 73bb389 to 20a12ac Compare October 22, 2026 04:48
@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 20a12ac
  • What rule changed: no rule changes; one security_posture.py registry row follows a redactor call that moved verbatim: the "Change-card details shown before Apply" sink names change_card_catalog_plans.py, where _display and its redact_via_context call now live, instead of change_card_catalog.py.
  • Before -> after (what was allowed/blocked, now): unchanged behaviour: the same redact_via_context call runs at the same point on the same values (an MCP server's launch line, environment values and request headers a card shows in full); only the module path the posture registry names follows the code, so the panel's sink count and classification are unchanged.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the posture drift guard would report an unregistered redactor site or a stale row (a CI failure); no command, secret or access path changes, because the moved bodies are AST-identical (move audit 100%, 0 changed units).
  • Evidence checked (which sandbox result proves it): test_security_posture.py passes on this head; reverting the row to change_card_catalog.py turns test_a_partially_covered_sink_says_so and the omission test red, and removing the redactor call from _display turns test_every_named_sink_module_actually_redacts red (rc 1 each).
  • No regression:
    • Tools still work (which tools/commands were run, result): the focused floor (28 files, every importer of the catalog, the heartbeat check-in tests, and the mirror and posture guards) at -n 3: 1,657 passed; the backend related set (263 files): 10,380 passed, 0 failed at the previous head with an identical patch; mypy clean on 3,506 files.
    • Backward compatible (old config / old data / old callers still work, how checked): every name the module exported still resolves on it as the same object (test_campaign_facades_base_public_names.py with the new inventory, 83 names), and no stored file format changes (change_cards.json is read and written by the same code).
    • Existing tests (which suites passed on this head): test_security_posture.py, test_change_cards*.py, test_change_card_*.py, test_member_goals*.py, test_facade_mirror_guards.py, test_mirrored_owner_storage.py, test_dashboard_server_composition_contract.py.
  • How to undo: revert this one commit; the row returns to the facade path together with the code it classifies.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 22, 2026

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@iamwhatever
iamwhatever merged commit 718fdae into main Oct 22, 2026
107 checks passed
@iamwhatever
iamwhatever deleted the refactor/linecap-s82-change-card-catalog branch October 22, 2026 07:00
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants