Repository navigation
refactor: keep split facades' base public names bound and typed - #15675
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the frozen Suggestions
[DESIGN-REVIEWED] 55a88bd Description read[DESCRIPTION-READ] a487f41ce49f81af541cd5830aa7c68d07c810aea121ad0d40f4dd9dd9411403 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 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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: |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS 86 zero-consumer re-exports are restored on the word of an audit this repo does not carry, then frozen as a permanent 500-name inventory pin. Not justified as shipped
What this change shipsInventory (10 items) — 2 justifiedIntent: FIX — restore public names six split facades stopped resolving, make mypy see two facades' forwards, and stop AutoNudge holding its store path twice.
[FIRST-PRINCIPLES-REVIEWED] 55a88bd Description read[DESCRIPTION-READ] baed2513038b1daab34128872a335b4679bae582b5f5aeca841fcd26731a0cf4 That sha256 names the PR description this verdict read. Recompute it with |
|
|
|
5a0f249 to
79d02d3
Compare
|
CI note for head Infra, rerun once with
The lanes logged "could not read this PR's comments/description after 3 attempts". Unrelated test reds:
|
|
Opus 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: |
79d02d3 to
db9749f
Compare
Six split facades stopped resolving public kiro_crew names they bound before their owners moved out, two forwarding facades hid most public re-exports from mypy, and AutoNudgeService held its store path twice. - acp/client.py, cron.py, autonudge.py, the Ops Mission Control and Issue Radar routes and mcp_gateway/gatewayd.py bind again every such name (86 in all); the client forwards its six to transport_errors, the module that reads them. The plain facades' docstrings say the re-exports are not patch seams, and gatewayd's states exactly which names it re-exports instead of every name an owner holds. - pod/runtime.py and the source-providers handler import every public forwarded name under TYPE_CHECKING (37 and 19). - AutoNudgeService._path is a read-only view of the store's path, so the loader reads the file the store writes. A repo-wide test freezes each facade's base public names and checks every re-bound name is its home module's object in a fresh interpreter; the two facades' contract tests pin the TYPE_CHECKING coverage, and the AutoNudge contract test pins the path view.
db9749f to
55a88bd
Compare
|
|
buluoray
left a comment
There was a problem hiding this comment.
Approve at 55a88bdc0611bf9c50d1c95bd9854a16a3736dc7.
This PR restores the public names that six split facades dropped, makes the TYPE_CHECKING blocks of two forwarding facades cover their whole public _EXPORTS, and turns AutoNudgeService._path into a live read-only view of _store.path. Without it, an import of a name these facades used to offer raises AttributeError, 56 forwarded rt./sp. reads fail mypy with attr-defined, and _load keeps reading the old file after the store's path is reassigned.
What I verified at this head
- The inventory is complete and correct. I derived each facade's top-level public
kiro_crewimports independently, from the parent of its split commit (#15153, #14615, #14994, #14537, #14545, #14976). Names that did not resolve at base: acp/client 6, cron 5, autonudge 28, OMC routes 21, Issue Radar routes 3, gatewayd 23. That is exactly the 86 the PR re-binds, and all of them resolve at head. - Patches through the acp/client facade still reach the owner.
monkeypatch.setattr(client, <name>, sentinel)reachestransport_errors.<name>for all six forwarded names, and undo restores it. The forwarding goes through_ReExportModule.__setattr__. - No current test is broken by the new plain-facade re-exports. I grepped
test/andsrc/for patches of every re-bound plain-facade name (string targets,setattr,patch.object) and found none, so no existing test patch silently misses its owner. The gatewayd guardtest_no_owner_reads_a_patched_name_as_its_own_globalalso catches such a patch: a temporary test patchinggatewayd.hash_commandturned it red (daemon/launch.py:352: hash_command). - mypy. mypy on the 8 touched
srcfiles reports no issues. A probe that reads every public_EXPORTSname ofpod/runtimeandsource_providersgets 56attr-definederrors at base (37 + 19, which matches the added TYPE_CHECKING names) and 0 at head. flake8 is clean on the touched files. _pathis never assigned on AutoNudge. The onlysvc._path = ...writes intest/are onCronService(test_portability.py) and the new negative assertion. The threeAutoNudgeService.__new__sites intest_autonudge_wake_judge.pydo not touch_path, and that file passes (293).- Targeted tests pass. The new and changed facade tests pass (504), as do the gatewayd composition and cron contract tests (123) and the acp facade, Issue Radar seams/surface and OMC ledger tests (426).
Mutation checks (each one reddened, then restored)
- I put back
self._path = self._store.pathand removed the property.test_autonudge_refactor_contract.py::...::test_the_loader_reads_the_path_the_store_holds_nowfailed. - I dropped gatewayd's
BackendUnavailablere-export.test_every_base_public_name_resolves_on_its_facade[kiro_crew.mcp_gateway.gatewayd]andtest_a_rebound_name_is_the_object_its_home_module_holdsfailed. - I dropped
loopback_owner_pidsfrom pod/runtime's TYPE_CHECKING block.test_every_public_reexport_is_named_for_type_checkersfailed. - I dropped source_providers'
sanitizeTYPE_CHECKING import.test_type_checkers_resolve_every_public_forwarded_name_from_its_ownerfailed.
Red "Publish readiness signal" check
This is not a code issue. Run 36837121314 (09:34Z) died on API rate limit exceeded for installation (core limit 0/15000) at gh api repos/.../pulls/15675, before it evaluated anything. A later evaluation published the PR Readiness commit status as success at 10:00:08Z ("Eligible automated validation passed for this revision") and applied readiness: passed at 10:00:11Z. The red check-run is the stale rate-limited attempt. All other check-runs are success (85) or skipped (11).
Bot dispositions
- Design (PASS), "verify the inventories were dumped from the pre-split modules": checked. My independent derivation from the split parents matches the re-bound set exactly. Does not gate.
- Design suggestion, "land the S9/M5 guard soon": gatewayd already has a working guard (confirmed by mutation above). cron, autonudge, OMC and Issue Radar have none: a future patch of, say,
kiro_crew.cron.platform_compatwould silently not reach the owner. No test does that today. This is a follow-up, and the PR declares it out of scope. Does not gate. - First Principles (CONCERNS), "zero-consumer re-exports and a frozen inventory": this is a scope objection, not a defect. The restored names are exactly what each facade bound before its split, which follows the #14602/#14606 precedent. Does not gate.
- GPT 5.6 and Opus 5: no findings.
Non-blocking follow-ups
- Add the S9/M5 patch-reach guard for the cron, autonudge, Ops Mission Control and Issue Radar facades, so the
not a seamrule is enforced by a test rather than by docstrings. - Ops Mission Control
routes.pynow importskiro_crew.cronat import time (CronStoreUnreadable), as it did before the split. This is fine; I note it only as an import-graph edge.
The squash commit body is accurate: 86 names, and 37 + 19 TYPE_CHECKING names.
…n main) (#16032) #12781 added a function-local 'from kiro_crew import probes' in _is_work_ledger_monitor while #15675 bound probes at module level as a re-export, so main's Backend Lint fails with F811 at autonudge.py:1797. Read probes off the module binding and drop the now-stale lazy-import rationale from the docstring. No behaviour change. Co-authored-by: w <w@k.local>
Problem / Motivation
Goal: Six split facades resolve every public name they offered before their split again, two forwarding facades stop hiding public re-exports from mypy, and the AutoNudge loader always reads the file its store writes.
The campaign audit of the merged facade splits (quality report §3.2 #14, #15 and #20; rework plan S2, S3 and S8) found three latent gaps that break nothing on main today:
kiro_crewnames they bound before their split. These areacp/client.py(B09, 6 names),cron.py(B11, 5),autonudge.py(B12, 28), the Ops Mission Control routes (I02, 21), the Issue Radar routes (I06, 3) andmcp_gateway/gatewayd.py(I10, 23). A caller or a star import that still uses one getsAttributeError.gatewayd.py's docstring also claimed that "every name an owner holds is re-exported".pod/runtime.py(B06) and the source-providers handler (B01) hide their forwarding__getattr__from mypy, but theirTYPE_CHECKINGimports listed only part of the public_EXPORTS. As a result, 37 and 19 names resolve at run time but fail type checking withattr-defined.AutoNudgeService.__init__copiedself._store.pathintoself._path._loadread the copy while writes went toself._store.path, so reassigning the store's path left the loader reading a different file.Why it matters
The campaign's facade contract says a split must not shrink a facade's public surface or hide it from the type checker. Each gap is a trap for the next caller or test: an import of a name the facade has always offered fails at run time, a mistyped or removed
rt.<name>read type-checks asAny, and two copies of one path can drift apart.Not a goal
cron_descriptorOptions/get_descriptionand gatewayd's five private imports.onboarding_import.pyandartifacts.py(QF1) and I04 (QF4) are not touched.What changed (motivation → approach → change)
Splitting these modules into owners shrank their public surface. Callers lost names they could import, mypy lost sight of names that still worked at run time, and one path was held twice. This PR puts the surface back without changing what any owner does. Each facade gets its fix through the mechanism it already uses:
acp/client.py(forwarding facade): the six names (launcher_refusal,sandbox_init_remediation,LAUNCHER_EXIT_PREFIXES, the twoSANDBOX_LAYER_*,ACP_BACKENDS_HOST_AUTH_CALLBACK) join_EXPORTS_BY_OWNER["kiro_crew.acp.transport_errors"], the one module that reads them, and itsTYPE_CHECKINGblock. This follows the existingcorroborate_launcher_refusalprecedent, so a patch through the client still reaches the reader.cron.py,autonudge.py,src/kiro_crew/apps/builtins/ops_mission_control/backend/routes.py,src/kiro_crew/apps/builtins/issue_radar/backend/routes.py,gatewayd.py):# noqa: F401re-export lines. Each docstring now says these names resolve but are not patch seams. Ingatewayd.pyevery line names one import and is markednot a seam, so isort cannot merge them into the blocks of names the module uses. Two function-localtargetsassignments inautonudge.pytake# noqa: F811, now that the module re-exportsprobes.targets.pod/runtime.py,src/kiro_crew/dashboard/handlers/source_providers.py: every public_EXPORTSname is imported underTYPE_CHECKINGfrom the owner the table names.AutoNudgeService._pathis a read-only property returningself._store.path.learn-cron-dashboard.md(the cron and AutoNudge surface sentences, and the_pathstate row) andmcp-gateway-daemon-lifecycle.md(one sentence that matches thegatewayd.pydocstring word for word).Backwards compatibility
Compatible: names are only added to the six facades. No caller-visible behaviour changes.
_pathis still readable, and no code insrcortestassigns it.Tests
test/test_campaign_facades_base_public_names.py:test_pod_runtime_refactor_facade.py: every public_EXPORTSname is declared underTYPE_CHECKING.test_source_providers_refactor_facade.py: every public_EXPORTSname is declared underTYPE_CHECKING, imported from the owner the table names.test_autonudge_refactor_contract.py:_loadreads a reassigned store path, and_pathcannot be assigned.scripts/local-gate.py --dry-runselected 2,001 backend and 1,427 frontend related files, more than this shared host runs whole. A targeted set of 46 files ran instead: the touched facades' contract, create-guard and owner tests,test_mirrored_owner_storage.py,test_lazy_reexport_storage.py,test_security_posture.py,test_spawn_audit.py, the boot smoke and the AutoNudge_pathreaders. Result: 4,308 passed, 13 skipped, 5 xfailed. mypy oversrc/kiro_crewis clean (1,996 files), and the CI semgrep rule set in baseline mode reports 0 new findings. CI runs the broad set.TYPE_CHECKINGpins and the_pathtest). A mypy probe that reads every public forwarded name shows 62attr-definederrors at base (37 + 19 + 6) and 0 after the change.Manual verification
N/A: unit coverage is sufficient, because the change adds bindings and type-only imports and nothing runs differently.
Related Issues
Closes campaign audit items X-08 (B09-1, B11-1, B12-2, I02-F3, I06-F2, I10-F1, and the D6
gatewayd.pydocstring), X-09 (B06, B01) and B12-3. No claimed item was skipped.Follow-ups this PR leaves alone, all of them false or partial before this PR too:
mcp_gateway/daemon/__init__.pyandautonudge_service/__init__.pysay "every name an owner holds is re-exported"; both are outside the claim.TYPE_CHECKINGblock.Checklist
Contribution License Agreement