Repository navigation
refactor(composition): one wiring file per context, the root only fixes the order - #1083
Conversation
…es the order The composition root built the whole container in one 860-line function, so changes to different contexts collided in the same file. Each context's wiring now lives in its own file under src/composition/, and src/composition.ts runs them in the same order as before. - runtime.ts: the shared process inputs (database, pool, logger, Redis, clock, env, provider endpoints, infrastructure) and the boot-time configuration guards. - identity, property, portal, guest, integration, review, ai and inbox wiring files: the arguments each context's build receives. - container-capabilities.ts: the object the container exposes. This is a move, not a rewrite. Construction order is unchanged, and the names src/composition.ts exports are unchanged. Callbacks into a context built later (Identity into Property, Portal and Integration, Portal into Reporting, Integration into Review) are passed as getters and first called after construction ends, as the earlier closures were. Client import protection now covers src/composition/** as well as composition.ts, so the moved wiring stays out of the browser bundle. Tests that read the composition source now read the file that holds the code; the Identity check for the session port is tied to the Identity context call, because the name now also appears elsewhere. The complexity suppression moved with the preamble it describes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ECC Tools / Security EvidenceCommit: Security evidence gate passed (success) No security-sensitive scanner-evidence gap detected. Mode: enforce Scanned 22 changed file(s). No missing scanner-evidence signal was detected. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / PR Risk TaxonomyCommit: PR taxonomy review recommended (neutral) Detected 2 PR taxonomy bucket(s): CI/CD Recommendation, Cost/Token Risk. Scanned 22 changed file(s). Roadmap taxonomy buckets: CI/CD RecommendationCI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work. Signals:
Paths:
Cost/Token RiskAI routing, usage, and token-budget changes should include budget or usage-limit evidence. Signals:
Paths:
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Reference Set ReadinessCommit: Reference set readiness gaps detected (neutral) Reference evidence present for 0/7 areas (0%) across 22 changed file(s). This check is based on files changed in this PR. Repository-level readiness is still reported by
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Hosted Promotion ReadinessCommit: Hosted promotion readiness passed (success) No hosted promotion evidence gaps detected across 22 changed file(s); 0 corpus scenarios had matching evidence. This check compares PR file changes against the evaluator/RAG promotion corpus in No evaluator corpus scenarios matched this PR. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Security EvidenceCommit: Security evidence gate passed (success) No security-sensitive scanner-evidence gap detected. Mode: enforce Scanned 22 changed file(s). No missing scanner-evidence signal was detected. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / PR Risk TaxonomyCommit: PR taxonomy review recommended (neutral) Detected 2 PR taxonomy bucket(s): CI/CD Recommendation, Cost/Token Risk. Scanned 22 changed file(s). Roadmap taxonomy buckets: CI/CD RecommendationCI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work. Signals:
Paths:
Cost/Token RiskAI routing, usage, and token-budget changes should include budget or usage-limit evidence. Signals:
Paths:
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Reference Set ReadinessCommit: Reference set readiness gaps detected (neutral) Reference evidence present for 0/7 areas (0%) across 22 changed file(s). This check is based on files changed in this PR. Repository-level readiness is still reported by
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Hosted Promotion ReadinessCommit: Hosted promotion readiness passed (success) No hosted promotion evidence gaps detected across 22 changed file(s); 0 corpus scenarios had matching evidence. This check compares PR file changes against the evaluator/RAG promotion corpus in No evaluator corpus scenarios matched this PR. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
What changed
src/composition.tsbuilt the whole container in one 860-line function, so changes to different contexts collided in the same file. Each context's wiring now lives in its own file undersrc/composition/, and the root runs them in the same order as before.runtime.ts: the shared process inputs (database, pool, logger, Redis, clock, env, provider endpoints, infrastructure) and the boot-time configuration guards.identity-wiring.ts,property-wiring.ts,portal-wiring.ts,guest-wiring.ts,integration-wiring.ts,review-wiring.ts,ai-wiring.ts,inbox-wiring.ts: the arguments each context's build receives.container-capabilities.ts: the object the container exposes.src/composition.tsgoes from 1,099 lines to about 340: the construction order,createContainer,createOperatorContainerGraph, and the process claim and singleton helpers. Every exported name is unchanged.This is a move, not a rewrite. Construction order is unchanged. Callbacks into a context that is built later (Identity into Property, Portal and Integration; Portal into Reporting; Integration into Review) are passed as getters and are first called after construction ends, as the earlier closures were. Nothing a customer or guest sees changes.
Also in this change:
vite.config.tsnow coverssrc/composition/**as well ascomposition.ts, so the moved wiring stays out of the browser bundle.CONTEXT.mdand the composition architecture note say so.Read first: the getters in
src/composition.tsandidentity-wiring.ts.How it was tested
pnpm typecheck, ESLint with zero warnings on the changed files, Prettier, the architecture boundary controls, filename, test-quality, file-length, unchecked-indexed-access and changed-code checks, and a Fallow audit against main all pass.pnpm buildandpnpm check:bundlespass: entry chunk 52,328 B of 70,100 B, first-paint closure 320,737 B of 321,000 B, the same as main. All 458 client JS and CSS files are byte-identical to a build of main.check:security-headersandcheck:language-verifierpass on this build.🤖 Generated with Claude Code