Repository navigation
test: add the family-import scan to nine more mirror facades - #36627
bolichen97 wants to merge 1 commit into
Conversation
The skill_projection, cli, session_directive_apply, deploy handlers, mcp_cron, policy_distribution, argv_floor, exfil and ui_index facades had no check that only their own family imports an owner. A module that imported an owner directly would keep its own binding, so a patch through the facade would miss it. Each of the nine facade tests gains test_only_the_family_imports_an_owner on the shared test/owner_import_scan.py helper. It reads the owners from the facade's mirror index, asserts it sees one real import of an owner, and asserts every importer is the facade or an owner. Part of #22413 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GPT 6.1 Review — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- test/test_argv_floor_facade.py:425 -- Two family-import checks fail on existing production imports
[BLOCK-MERGE] e3a2536 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 is upheld. The defect is real and the fix is cheap. I couldn't run the two tests because pytest isn't installed in this environment, so the failure below comes from reading the code. F1: MEDIUM harm, but it fires on every run. The scan in False positive or not applicable? A repository writer can comment: |
|
[operator: bolichen97] Holding this PR: auto-merge is off until its scope is settled. #36839 (merged 2026-11-14) added Two ways forward: take |
Code change approver recommendation: ApproveWhy: the decider estimates a 4% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. Test-only PR that adds the existing family-import scan to nine more mirror facade tests. Each new test copies the established version in test_usage_facade.py and test_hooks_handler_facade.py line for line and uses the unchanged shared helper owner_import_scan.py. All nine files already define FACADE and _index(). In the cli case the facade imports its owners by name inside its type-checking-only block, so the scan finds cli.py as expected. Every other mention of the cli owners in src/ is a comment or string, not an import. skill_projection_parts/init.py is only a docstring. Backend tests pass on Linux and Windows. The failing AI-review lanes failed on API rate limits and a merge-base read error, not on the code. 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 |
|
Please rebase onto the latest main. This head is 572 commits behind main, and its CI ran on a base from 11-13. On today's main, two of the nine new scans will fail, because main gained a direct owner import in each family after this branch was cut:
Either fix works:
The other seven scans pass on today's main. |
|
[operator: bolichen97] Maintainer decision: this PR takes option 1 from the review above. The next push drops the The reason: option 1 keeps this PR test-only, while option 2 would hold it until a production change to a file under
|
Problem / Motivation
Goal: the nine mirror facades whose owners no outside module imports today (
acp.skill_projection,cli,dashboard.session_directive_apply,deploy.handlers,mcp_cron,platform.policy_distribution,security.argv_floor,security.exfil,ui_index) get the family-import scan, so a module outside the family that imports an owner directly turns a test red.On
main, 26 facade tests carrytest_only_the_family_imports_an_owner, and a few more carry the same check under another name. These nine facades have owners that no module outside their family imports, but nothing checks that. So a new module could import, say,kiro_crew.security.exfil_bashdirectly instead of going throughkiro_crew.security.exfil, and every test would stay green.Why it matters
A module that imports an owner directly holds its own binding of the owner's names. A test that patches the name through the facade then misses that module, so the patch silently does nothing there and the test proves less than it claims. Without the scan, the first such import in these nine families goes unnoticed.
Not a goal
main(for examplemcp_core,mcp_shared,mcp_discovery,llm_helpers,validation): a scan there would be red today and needs a production change first.acp,agent,acp.livenessand the like), and the meta and helper files that matchtest/*facade*.pybut test no single facade.mcp_dashboardandwork_ledger, which already check the same thing under the nametest_no_module_outside_the_family_imports_an_owner.test/owner_import_scan.py.What changed (motivation → approach → change)
A module outside one of these nine families that imports an owner directly now turns a test red, as it already does for the facades swept before. Each facade test gains one
test_only_the_family_imports_an_owner, built on the shared helpertest/owner_import_scan.py, the same shape as the seven dashboard handler facades in #35593.The test reads the owner list from the facade's own mirror index, so it follows the facade if an owner is added. It streams only the source files that name an owner, collects every file that imports one, and asserts two things: one real import of an owner is found (so a scan that read nothing fails), and every importer is the facade or one of its owners. Each file's module docstring names the new check.
Backwards compatibility
Compatible: test-only; nine tests are added, and the only other edits are one import and one docstring clause per file.
Removes nothing: no test, helper, record or public name is removed or renamed.
Tests
test/test_skill_projection_facade.pyacp/skill_projection_parts/alias_reclaim.pytest/test_cli_split_facade.pycli.py(its owners import no other owner)test/test_session_directive_apply_facade.pydashboard/session_directive_apply_monitor.pytest/test_handlers_deploy_facade.pydeploy/handlers_sites.pytest/test_mcp_cron_facade.pymcp_cron_vet.pytest/test_policy_distribution_facade.pyplatform/policy_distribution_boot.pytest/test_argv_floor_facade.pysecurity/argv_floor_ssh.pytest/test_exfil_facade.pysecurity/exfil_git_object.pytest/test_ui_index_facade.pyui_index_load.pyAll 87 tests in the nine files pass (78 existing, 9 new).
Mutation proof, run on Ubuntu Linux and not committed: a throwaway
src/kiro_crew/_owner_probe_22413.pyimports one owner of each family (absolute,from package import owner,import a.b, aliased and relative spellings). On the base the nine files stay green with it, which is the gap. With this change all nine new tests go red, and with the probe removed they are green again:Determinism, on the nine new tests: 20 runs at
-n0, then 10 at-n 4 --dist loadgroup --max-worker-restart=2with the family-import tests oftest/test_usage_facade.pyandtest/test_hooks_handler_facade.pyas co-tenants, all green. All 87 tests of the nine files in one shuffled order (seed 3476249225) are green.test/test_flake_pattern_ratchet.pyand the repository semgrep rules on the diff are green.Manual verification
N/A — unit coverage sufficient: the change is nine tests, and the mutation proof above shows each one fails on an outside importer.
Screenshots / video
N/A — no frontend file is touched.
Related Issues
Part of #22413
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)