refactor: move contracts.ts into src/kernel — Phase 5#950
Conversation
Relocate the central contracts barrel into the kernel/ dependency sink alongside device/errors/redaction/snapshot (kernel now owns the pure domain types per plans/perfect-shape.md §5.5). - src/contracts.ts -> src/kernel/contracts.ts (git rename) - repoint all 44 internal importers to ../kernel/contracts.ts - rslib entry keeps key 'contracts' so dist output stays dist/src/contracts.js; the public 'agent-device/contracts' subpath is byte-identical (proven by the metro precedent in #947 and verified via build + package-exports test) - update .fallowrc.json entrypoint + fallow-baselines/health.json key Behaviorless path codemod (49 files, +57/-57). typecheck/lint/build/fallow audit/public-contract tests all green.
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
Move the remote/proxy/upload subsystem out of the src/ root cluster into a dedicated src/remote/ intent folder, per plans/perfect-shape.md §5.5: daemon-proxy · daemon-artifacts · upload-client(-artifact) · remote-config · remote-config-core · remote-config-schema · remote-connection-state - 8 files moved (git renames); imports repointed via a resolve-based codemod (path.relative recomputation — correctly distinguishes the root remote-config from the unrelated src/utils/remote-config.ts) - rslib entry keeps key 'remote-config' so dist output stays dist/src/remote-config.js; public 'agent-device/remote-config' byte-identical - update .fallowrc.json entrypoint + fallow-baselines/health.json keys + vitest.config.ts coverage include + the integration test import paths Behaviorless path codemod. typecheck/lint/build/fallow/tests all green. Stacked on #950 (contracts→kernel).
|
Reviewed against plans/perfect-shape.md Phase 5 layering guidance. This is a pure ownership move: src/contracts.ts is renamed to src/kernel/contracts.ts, internal imports are repointed, and the public rslib/package subpath remains agent-device/contracts via the unchanged contracts entry key. I checked for old-path internal imports, public export preservation, the moved file dependencies, and command/daemon ownership impact. The moved kernel file keeps runtime dependencies within kernel; the one contract-dir re-export is type-only and matches the PR note/plan to keep per-domain contracts in src/contracts/* for now. Checks are green, and the diff is a path codemod with no behavior-sensitive command route changes. I do not see remaining actionable blockers; ready for human review/merge judgment. |
|
Move the remote/proxy/upload subsystem out of the src/ root cluster into a dedicated src/remote/ intent folder, per plans/perfect-shape.md §5.5: daemon-proxy · daemon-artifacts · upload-client(-artifact) · remote-config · remote-config-core · remote-config-schema · remote-connection-state - 8 files moved (git renames); imports repointed via a resolve-based codemod (path.relative recomputation — correctly distinguishes the root remote-config from the unrelated src/utils/remote-config.ts) - rslib entry keeps key 'remote-config' so dist output stays dist/src/remote-config.js; public 'agent-device/remote-config' byte-identical - update .fallowrc.json entrypoint + fallow-baselines/health.json keys + vitest.config.ts coverage include + the integration test import paths Behaviorless path codemod. typecheck/lint/build/fallow/tests all green. Stacked on #950 (contracts→kernel).
Move the remote/proxy/upload subsystem out of the src/ root cluster into a dedicated src/remote/ intent folder, per plans/perfect-shape.md §5.5: daemon-proxy · daemon-artifacts · upload-client(-artifact) · remote-config · remote-config-core · remote-config-schema · remote-connection-state - 8 files moved (git renames); imports repointed via a resolve-based codemod (path.relative recomputation — correctly distinguishes the root remote-config from the unrelated src/utils/remote-config.ts) - rslib entry keeps key 'remote-config' so dist output stays dist/src/remote-config.js; public 'agent-device/remote-config' byte-identical - update .fallowrc.json entrypoint + fallow-baselines/health.json keys + vitest.config.ts coverage include + the integration test import paths Behaviorless path codemod. typecheck/lint/build/fallow/tests all green. Stacked on #950 (contracts→kernel).
What
Relocates the central
contracts.tsbarrel into thesrc/kernel/dependency sink, alongsidedevice.ts/errors.ts/redaction.ts/snapshot.ts(moved in #940). Per plans/perfect-shape.md §5.5,kernel/owns the pure domain types and is the bottom of the import DAG.Why
Phase 5 (layering): finishes seating the core contract types in the kernel sink so the eventual import-direction lint has a clean target. Pure path codemod — no behavior change.
How
src/contracts.ts→src/kernel/contracts.ts(git rename)…/kernel/contracts.tscontracts, so the dist output staysdist/src/contracts.jsand the publicagent-device/contractssubpath is byte-identical (same pattern proven by themetromove in refactor: extract metro/ folder — Phase 5 #947).fallowrc.jsonentrypoint +fallow-baselines/health.jsonkey to the new pathSafety
agent-device/contractsresolves unchanged; verified bybuildproducingdist/src/contracts.{js,d.ts}andpackage-exports.test.ts/contracts-schema-public.test.tspassing.Note
kernel/contracts.tsretains one type-only re-export from../contracts/debug-symbols.ts(the per-domain contract dir stays put per the plan'scontracts/ (KEEP)). The layering-guard CI job is unaffected; the full import-direction lint is a later Phase 5 slice.