refactor(test): colocate pure-domain tests and reduce test debt (#471)

* refactor(test): colocate pure-domain tests and reduce test debt

Move focused immutable domain/contracts/adapter tests from
tests/composition/** beside their production owners under src/** as
colocated *.test.ts/*.fixture.ts, and relocate persistence-shaped
composition tests under tests/boundary/filesystem/**. Update import
paths, the Vitest project topology (shared worker context for pure
domain/contracts and recording-port service projects), the test
migration ledger, testing docs, and AGENTS.md to match.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* docs: remove test migration ledger

The cutover is complete and the ledger is no longer referenced anywhere
in source, scripts, or the docs gate. Drop the standalone artifact.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* docs: clean up stale migration artifacts

Remove empty directories left by the test migration and replace the
"final cutover" language in docs/testing.md with standing PR guidance
that no longer references the completed migration.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: repair CI failures from schema, knip, and stale generated artifacts

Three root causes fixed:

1. catalog-schemas.mjs: valuesAt only traversed anyOf from Zod's
   toJSONSchema, not oneOf. The webScreenshotDiffSchema change to a
   discriminated union produces oneOf, so the product catalog generator
   could not derive the web_screenshot_diff schema version. Add oneOf
   traversal.

2. conformancePackage.ts: the test rewrite removed the only imports of
   ScenarioManifest, ReplayPlan, ShimPlan, and ExpectedEvidence, making
   them unused exports that knip flags. Remove the dead type aliases.

3. Regenerate stale artifacts (product catalog, MCP tool catalog, skill
   metadata, conformance manifest) that drifted from the source changes.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
morluto
2026-08-10 14:57:44 +08:00
committed by GitHub
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent 344b9b6dff
commit e91c8c39c2
302 changed files with 6822 additions and 5781 deletions
@@ -1,4 +1,4 @@
import { rm, writeFile } from "node:fs/promises";
import { writeFile } from "node:fs/promises";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
@@ -37,47 +37,43 @@ const deferred = <Value>() => {
describe("cross-version inventory", () => {
it("starts both scans together and preserves left/right result order", async () => {
const root = await createTestTempDirectory("rea-version-inventory-");
try {
const artifact = join(root, "artifact.js");
await writeFile(artifact, "export const value = 1;\n");
const snapshot = await scanArtifactInventory(artifact, LIMITS);
const left = deferred<typeof snapshot>();
const right = deferred<typeof snapshot>();
const calls: string[] = [];
const controller = new AbortController();
const scanner: VersionInventoryScanner = (...arguments_) => {
const [path, roots, limits, options] = arguments_;
if (options === undefined) throw new Error("Expected scanner options");
calls.push(path);
expect(roots).toEqual([root]);
expect(limits).toBe(LIMITS);
expect(options.signal).toBe(controller.signal);
expect(options.integrity).toBe(INTEGRITY);
return path === "left" ? left.promise : right.promise;
};
const artifact = join(root, "artifact.js");
await writeFile(artifact, "export const value = 1;\n");
const snapshot = await scanArtifactInventory(artifact, LIMITS);
const left = deferred<typeof snapshot>();
const right = deferred<typeof snapshot>();
const calls: string[] = [];
const controller = new AbortController();
const scanner: VersionInventoryScanner = (...arguments_) => {
const [path, roots, limits, options] = arguments_;
if (options === undefined) throw new Error("Expected scanner options");
calls.push(path);
expect(roots).toEqual([root]);
expect(limits).toBe(LIMITS);
expect(options.signal).toBe(controller.signal);
expect(options.integrity).toBe(INTEGRITY);
return path === "left" ? left.promise : right.promise;
};
const result = scanVersionInventories(
{
leftPath: "left",
rightPath: "right",
inputRoots: [root],
limits: LIMITS,
signal: controller.signal,
integrity: INTEGRITY,
},
scanner,
);
const result = scanVersionInventories(
{
leftPath: "left",
rightPath: "right",
inputRoots: [root],
limits: LIMITS,
signal: controller.signal,
integrity: INTEGRITY,
},
scanner,
);
expect(calls).toEqual(["left", "right"]);
right.resolve(snapshot);
left.resolve(snapshot);
await expect(result).resolves.toEqual({
left: snapshot,
right: snapshot,
});
} finally {
await rm(root, { recursive: true, force: true });
}
expect(calls).toEqual(["left", "right"]);
right.resolve(snapshot);
left.resolve(snapshot);
await expect(result).resolves.toEqual({
left: snapshot,
right: snapshot,
});
});
it("rejects promptly when either parallel scan fails", async () => {