refactor(daemon-contracts): drop the registration and claims fixture exports

Merged
TH
1d ago
+101-76

Stacked on #3686 (test-kit stops depending on daemon-contracts, which this PR needs: daemon-contracts now declares test-kit as a devDependency, and test-kit → daemon-contracts would be a project-reference cycle). Base is #3686's branch; GitHub retargets to main when it merges. Review only the last four commits.

What

Removes daemon-contracts/daemon-registration-fixtures and daemon-contracts/device-claims-fixtures (daemon-contracts exports 17 → 15), moves the one test of daemon-contracts' own code out of daemon, and replaces the package's duplicated tmp-dir.fixtures.ts with test-kit's.

Fixture decisions

FixtureImporters by packageOutcomeReason
publishDaemonRegistrationdaemon-contracts 1 (own test), daemon 5, root 1 (cli-device-status.test.ts)test-kit named exportShared across packages; daemon-contracts' own test now uses the same one, so the roughly 15-line duplicate the coordinator accepted is not needed.
resolveDeviceClaimPathdaemon 7 (6 tests and session-idle-expiry-harness)test-kit deviceClaimFilePathShared across daemon tests; restates the sha256 layout and AGENT_DEVICE_CLAIMS_DIR override so tests pin the on-disk contract instead of re-importing the production resolver. daemon-contracts' own tests never used it.
createDeviceClaimReconciler1 daemon testCase 2, moved into daemon-contractsThe test exercises only device-claim-reconciliation.ts. The coordinator chose to rewrite it through device-claim-recovery because daemon-contracts could not import test-kit; with #3686 it can, so the test moves as a pure git mv instead (named for its module) and keeps testing the unit directly.

Commits

  1. git mv of the reconciler test into packages/daemon-contracts/src/device-claim-reconciliation.test.ts (pure, 100%).
  2. test-kit gains publishDaemonRegistration and deviceClaimFilePath; daemon and root importers switch to @agent-device/test-kit (specifiers, plus the resolveDeviceClaimPath → deviceClaimFilePath identifier at its call sites); the moved test's two specifiers change (./device-claim-reconciliation.ts, ./device-claims.ts); daemon-contracts declares test-kit (devDependencies + tsconfig reference + lockfile).
  3. chore(gates): delete daemon-registration.fixtures.ts, device-claims.fixtures.ts and their two exports.
  4. Delete tmp-dir.fixtures.ts; six daemon-contracts tests import mkdtempForTestSync from test-kit.

Test-count parity (vitest run … --reporter=json)

All files this diff touches, plus every daemon-contracts test: 194 passed / 0 failed on origin/main (23 files, with the reconciler test at its daemon path), 194 / 0 here (same files, reconciler test at its new path; plus daemon-registration-owner.test.ts's 47, covered by #3686). Reconciler test alone: 2 / 0 before and after.

Selection: packages/daemon-contracts/src/device-claim-reconciliation.test.ts is under packages/*/src/**/*.test.ts (unit-core), collected by path; check:affected --run includes it. vi.mock: the moved test uses vi.fn only; none of the touched files adds one.

Surface

daemon-contracts exports 17 → 15; no new subpath on any package. test-kit adds two named exports from its one entry (sorted position). No barrels or export *. daemon-contracts: devDependencies and tsconfig references both declare test-kit.

Gates (on ff0920312, rebased on main after #3684)

check:quick, check:layering, check:fallow, check:gate-manifest, pnpm format, check:affected --run (exit 0; 1828 files, 15474 tests): all clean.

🤖 Generated with Claude Code