refactor(test-kit): move the dispatch-disclosure harness out of contracts
What
The dispatch-disclosure harness is a cross-package test fixture: eleven driver tests across daemon, platform-android, platform-apple, platform-web, provider-webdriver and root each read the shared row table and assert they drive exactly the rows they own. It was published from @agent-device/contracts/dispatch-disclosure-fixtures; it now lives in @agent-device/test-kit as three named exports.
- Commit 1: pure
git mvofdispatch-disclosure.fixtures.tsanddispatch-disclosure.test.tsfrompackages/contracts/srctopackages/test-kit/src(contracts cannot import test-kit, so its table test moves with the harness). Content is unchanged; both files use../../../for the repo root, which is the same depth. - Commit 2: the file's first test (
discloseDispatch/discloseUnclassifiedDispatchbehaviour) testskernel/errors, so it becomespackages/kernel/src/errors-dispatch-disclosure.test.ts, verbatim; the two table tests stay in test-kit. - Commit 3: the eleven drivers import the three names they use (
assertDispatchDisclosureDriversMatchRows,DISPATCH_DISCLOSURE_TABLE_PATH,dispatchDisclosureRowsOwnedBy) from@agent-device/test-kit; platform-android, platform-apple, platform-web and provider-webdriver declare test-kit indevDependenciesand tsconfigreferences(daemon already did); the contracts subpath and its export-snapshot line are removed. - Commit 4: merges two duplicate test-kit import statements that lint flagged.
- Commit 5 (
chore(gates)): R13 refused any@agent-device/test-kitimport from a platform package, tests included. It now allows it in test files (*.test.ts,__tests__/,*.fixtures.*) only; production source is still refused. Unit-tested both ways inplatform-package-policy.test.ts.
Fixture decision
| Fixture | Importers by package | Outcome | Reason |
|---|---|---|---|
contracts/dispatch-disclosure-fixtures | daemon 2 tests, platform-android 2, platform-apple 2, platform-web 1, provider-webdriver 2, root 2 | case 3: test-kit | shared by driver tests of six packages; needs only kernel types and the repo-level table |
Parity
vitest run <files> --reporter=json, origin/main against this branch:
| files | tests passed | |
|---|---|---|
| before | 12 (11 drivers + contracts dispatch-disclosure.test.ts, 3 tests) | 196 / 196 |
| after | 13 (11 drivers + kernel errors-dispatch-disclosure 1 + test-kit dispatch-disclosure 2) | 196 / 196 |
unit-core includes packages/*/src/**/*.test.ts, so the moved test-kit and kernel tests are selected; check:affected --run ran them. The 11 drivers were not moved (specifier only). Several use vi.mock; none of those mocks was edited, and all pass.
Surface and counts
exports: contracts 133 -> 132 (./dispatch-disclosure-fixtures removed); test-kit stays one "." entry with +3 named exports; no new subpaths, barrels or export *. New devDependency + tsconfig reference on test-kit in platform-android, platform-apple, platform-web, provider-webdriver (test-kit reaches only capture-kit, contracts, host-kit, kernel, so no cycle; tsc -b passes).
Colocation (my scan): contracts 1 -> 0 not beside a named module.
Gates
check:quick, check:layering, check:fallow, check:gate-manifest, pnpm format, check:affected --run: all pass on head.
🤖 Generated with Claude Code