refactor(config): split loader responsibilities - #7304
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS A real monolith split at cohesive seams, with identity-locked re-exports, one-way import guards, and retargeted single-parse-site gates — fully reversible. The extraction is verifiably a move, not a rewrite: loader.py's only non-import additions are functions that existed in the pre-split blob, the boundary test pins every historical name to the same object ( [DESIGN-REVIEWED] fd62d00 |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of All lenses are run; evidence gathered. Producing the review. First-Principles-Verdict: CONCERNS A clean responsibility move with identity re-exports — but loader keeps two dead compat imports nobody consumes, and two doc edits ride along undeclared. What this change shipsIntent: make a ~9.5k-line config loader reviewable by giving its cohesive responsibilities their own modules, with zero caller-visible change — a MOVE (refactor), neither fix nor feature.
WatchItem 8 is inherited surface: grepped Subtractions
[FIRST-PRINCIPLES-REVIEWED] fd62d00 |
Opus 4.8 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: |
|
Disposition: rebutted — keep The governing compatibility contract for this refactor is to preserve the historical
No code change is needed for this advisory subtraction. |
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: |
09b8b81 to
289aeb0
Compare
289aeb0 to
565f158
Compare
565f158 to
b905ddf
Compare
|
Disposition: acknowledged, no code change. I audited all 184 sections re-exports against AST-resolved imports and patch targets across src and test. Only two current patches intersect the re-export set: loader.normalize_agent_model in test_subagent_coverage.py, which remains effective because subagent.py imports it lazily from the facade at call time, and loader.DEFAULT_POOL_SIZE in test_config_loader.py, which remains effective because loader.py reads that facade global at runtime. No existing patch attempts to intercept a sections-internal lookup. The facade contract guarantees historical imports and object identity; a future test that intentionally replaces a sections-internal global should target kiro_crew.config.sections., while loader-owned seams such as config_dir remain local. I am recording that targeting rule here and keeping the already-reviewed runtime SHA stable. |
|
CodeQL disposition: rebutted as a pre-existing Main alert, not introduced by this PR. The failed check annotates src/kiro_crew/wecom/gateway.py:105, which is absent from the PR diff. That file has the identical git blob a311eb91470b686914c23ca805560f7df6c8c39a at the PR base 283625e, this head b905ddf, and current origin/main. Repository code-scanning alert #663 already records the same py/clear-text-logging-sensitive-data finding on refs/heads/main, created 2026-08-24 at base commit 283625e. The check output itself notes that unchanged alerts can be attributed when the diff is large. Per PR scope and scanner policy, I will neither modify the unrelated WeCom gateway nor dismiss the repository-level alert. |
b905ddf to
cb021cf
Compare
|
CI disposition: resolved by rebasing the owning Main repair; no out-of-scope PR change was made. The prior head failed only at Main PR #7492 repaired the owning census ( The config refactor never modified |
07f88ae to
fd62d00
Compare
|
span=first-principles/subtractions/loader-math-urlsplit
The lane's factual claim is correct and I re-derived every part of it rather than What the disposition turns on is that this is not a subtraction of something the PR The lane is advisory (CONCERNS, not BLOCK) and does not gate readiness. It is a |
|
span=codeql/alert-663/py-clear-text-logging-sensitive-data
Verified over the code-scanning REST API rather than from the check summary: On its merits it is also a false positive: the logged I deliberately took neither available shortcut. Adding a CodeQL suppression would widen |
|
span=ci/backend-tests-windows-3/test_session_control-rate-limit
The failure is a creation-rate-limit window bleeding across tests under that shard's Locally the whole module passes: 142 passed for |
|
span=ci/frontend-tests-4/mochi-chat-panel-unclosed-fence
Not this diff. The change is nine files: three docs, Decisive comparison. Head Not inherited from the base either. The mechanism is the 1000 ms The one plausible non-timing race is ruled out.
Backend tests and coverage combine both passed, and on the green head Action taken: re-ran only the failed jobs of run Deliberately not done here: stabilizing the assertion. Awaiting the stream commit before the negative, in the style of the sibling case, is correct work and belongs in a frontend PR that owns that file. Adding |
|
Supplementary CodeQL evidence scoped to the current head 1. The CodeQL lane is not a readiness blocker on this head. 2. Why this PR surfaces the alert when smaller ones do not, and why no rebase clears it. On the merits it remains a false positive, unchanged from the earlier record. I am deliberately not acting on the alert from this PR. Adding a suppression to (a) dismiss #663 on main as a false positive, matching the #630 precedent — cheapest, but it is a security-posture change; I recommend (b). Either way it is non-blocking for this PR, but until one of them lands the alert will keep reddening that check on any future large PR that touches the config package. |
|
Answering the one remaining First Principles point on The two files are I am recording this in the conversation rather than re-opening the description on purpose: |
chenmingwei23
left a comment
There was a problem hiding this comment.
Approved: PR Readiness passed, all review lanes green.
Open PR relationship auditThis is a consolidated, point-in-time code-level audit note. It compares complete merge-base diffs and current/merged code; it does not treat a shared topic as duplication or partial coverage as completion. Relationship findings
No PR, Issue, label, branch, or review state was changed by the relationship-note portion of this audit. |
Problem / Motivation
src/kiro_crew/config/loader.pyhad accumulated section DTOs, schema coercion and parsing, overlay resolution, validation-adjacent helpers, persistence, migrations, caching, and the publicKiroCrewConfigfacade in one roughly 9.5k-line module. The coupling made otherwise local config work hard to review and made ordering and compatibility seams easy to disturb.Why it matters
Config loading is a compatibility boundary used across the daemon, dashboard, CLI, agents, and persisted user state. Giving its cohesive responsibilities explicit module owners reduces change collisions and makes those boundaries testable while keeping existing callers and stored configurations unchanged.
What changed (motivation → approach → change)
config/sections.py.config/resolution.py.KiroCrewConfigfacade inconfig/loader.py; historical loader imports are re-exported by identity.The split preserves config keys, defaults, migration behavior, overlay order, clamps, degraded-file behavior, cache fingerprints, exception types, and user-visible error text.
Tests
test/test_config*family, 941 passed and 1 skipped; the boundary, tailnet-conjunction, resource-limits, and gate-side-census guards together, 165 passed.WinError 1314before reaching product code.7cf627f8cf714b35, so the change itself survived each base move byte-for-byte; the three config-owner blobs move only where main independently editedconfig/loader.pyand the split had to absorb that edit.Manual verification
N/A — this is a behavior-preserving internal boundary refactor with no UI or external-service change; public-import identity, persistence behavior, and direct consumers are covered by automated tests.
Related Issues
no linked issue: internal maintainability refactor of the existing config loader boundary.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)