Skip to content

refactor: move contracts.ts into src/kernel — Phase 5#950

Merged
thymikee merged 1 commit into
mainfrom
phase5-contracts-kernel
Jun 30, 2026
Merged

refactor: move contracts.ts into src/kernel — Phase 5#950
thymikee merged 1 commit into
mainfrom
phase5-contracts-kernel

Conversation

@thymikee

Copy link
Copy Markdown
Member

What

Relocates the central contracts.ts barrel into the src/kernel/ dependency sink, alongside device.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.tssrc/kernel/contracts.ts (git rename)
  • Repoint all 44 internal importers to …/kernel/contracts.ts
  • rslib entry keeps the key contracts, so the dist output stays dist/src/contracts.js and the public agent-device/contracts subpath is byte-identical (same pattern proven by the metro move in refactor: extract metro/ folder — Phase 5 #947)
  • Update .fallowrc.json entrypoint + fallow-baselines/health.json key to the new path

Safety

  • Public API preserved: agent-device/contracts resolves unchanged; verified by build producing dist/src/contracts.{js,d.ts} and package-exports.test.ts / contracts-schema-public.test.ts passing.
  • typecheck ✅ · oxlint ✅ · build ✅ · fallow audit ✅ (no issues in 50 changed files) · targeted unit tests ✅ (42 passing)
  • 49 files, +57/-57.

Note

kernel/contracts.ts retains one type-only re-export from ../contracts/debug-symbols.ts (the per-domain contract dir stays put per the plan's contracts/ (KEEP)). The layering-guard CI job is unaffected; the full import-direction lint is a later Phase 5 slice.

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.
@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.4 MB 1.4 MB 0 B
JS gzip 455.9 kB 455.9 kB +7 B
npm tarball 561.6 kB 561.6 kB +32 B
npm unpacked 2.0 MB 2.0 MB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.9 ms 28.7 ms +0.8 ms
CLI --help 49.1 ms 49.7 ms +0.5 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/snapshot.js 0 B +2 B
dist/src/1986.js 0 B +2 B
dist/src/9722.js 0 B +1 B
dist/src/2577.js 0 B +1 B
dist/src/cli.js 0 B +1 B

thymikee added a commit that referenced this pull request Jun 30, 2026
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).
@thymikee

Copy link
Copy Markdown
Member Author

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.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Jun 30, 2026
@thymikee thymikee merged commit b6a9bb2 into main Jun 30, 2026
21 checks passed
@thymikee thymikee deleted the phase5-contracts-kernel branch June 30, 2026 09:34
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-30 09:34 UTC

thymikee added a commit that referenced this pull request Jun 30, 2026
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).
thymikee added a commit that referenced this pull request Jun 30, 2026
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant