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:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
344b9b6dff
commit
e91c8c39c2
@@ -1,4 +1,4 @@
|
||||
import type { ProcessCapture } from "./processCapture.js";
|
||||
import type { UnverifiedProcessCapture } from "./processCapture.js";
|
||||
import { validateProcessCaptureReactiveRun } from "./processCaptureReactiveValidation.js";
|
||||
import { replayMachineSchema, type ReplayMachine } from "./replayMachine.js";
|
||||
import { digestProcessCommitment } from "./processScenario.js";
|
||||
@@ -24,13 +24,13 @@ const orderedTimestamps = (
|
||||
});
|
||||
|
||||
const transitionsAreContiguous = (
|
||||
previous: ProcessCapture["replay_transitions"][number] | undefined,
|
||||
current: ProcessCapture["replay_transitions"][number],
|
||||
previous: UnverifiedProcessCapture["replay_transitions"][number] | undefined,
|
||||
current: UnverifiedProcessCapture["replay_transitions"][number],
|
||||
): boolean =>
|
||||
previous !== undefined && previous.state_after === current.state_before;
|
||||
|
||||
const validateCommitments = (
|
||||
capture: ProcessCapture,
|
||||
capture: UnverifiedProcessCapture,
|
||||
require: RequireInvariant,
|
||||
): void => {
|
||||
const { manifest } = capture;
|
||||
@@ -54,7 +54,7 @@ const validateCommitments = (
|
||||
};
|
||||
|
||||
const validateOrdering = (
|
||||
capture: ProcessCapture,
|
||||
capture: UnverifiedProcessCapture,
|
||||
require: RequireInvariant,
|
||||
): void => {
|
||||
for (const [name, values] of [
|
||||
@@ -81,10 +81,12 @@ const validateOrdering = (
|
||||
};
|
||||
|
||||
const journalCollectionSizes = (
|
||||
capture: ProcessCapture,
|
||||
capture: UnverifiedProcessCapture,
|
||||
): Readonly<
|
||||
Record<
|
||||
NonNullable<ProcessCapture["event_journal"]>[number]["collection"],
|
||||
NonNullable<
|
||||
UnverifiedProcessCapture["event_journal"]
|
||||
>[number]["collection"],
|
||||
number
|
||||
>
|
||||
> => ({
|
||||
@@ -100,7 +102,7 @@ const journalCollectionSizes = (
|
||||
});
|
||||
|
||||
const validateEventJournal = (
|
||||
capture: ProcessCapture,
|
||||
capture: UnverifiedProcessCapture,
|
||||
require: RequireInvariant,
|
||||
): void => {
|
||||
const journal = capture.event_journal ?? [];
|
||||
@@ -129,7 +131,7 @@ const validateEventJournal = (
|
||||
};
|
||||
|
||||
const validateLifecycle = (
|
||||
capture: ProcessCapture,
|
||||
capture: UnverifiedProcessCapture,
|
||||
require: RequireInvariant,
|
||||
): void => {
|
||||
const checkpointNames = capture.filesystem_checkpoints.map(
|
||||
@@ -146,15 +148,9 @@ const validateLifecycle = (
|
||||
require(capture.exit.reason === "exited" ||
|
||||
capture.exit.code ===
|
||||
null, "exit", "deadline termination cannot declare a normal exit code");
|
||||
require(capture.settlement.state !== "quiesced" ||
|
||||
capture.settlement.cleanup_outcome ===
|
||||
"not_required", "settlement.cleanup_outcome", "quiesced settlement cannot require cleanup");
|
||||
require(capture.settlement.state === "quiesced" ||
|
||||
capture.settlement.cleanup_outcome !==
|
||||
"not_required", "settlement.cleanup_outcome", "non-quiesced settlement must report cleanup");
|
||||
};
|
||||
|
||||
const shimPlans = (capture: ProcessCapture) =>
|
||||
const shimPlans = (capture: UnverifiedProcessCapture) =>
|
||||
capture.manifest.shim_plan.flatMap((shim) =>
|
||||
typeof shim === "object" &&
|
||||
shim !== null &&
|
||||
@@ -171,7 +167,7 @@ const shimPlans = (capture: ProcessCapture) =>
|
||||
);
|
||||
|
||||
const validateShimEvents = (
|
||||
capture: ProcessCapture,
|
||||
capture: UnverifiedProcessCapture,
|
||||
require: RequireInvariant,
|
||||
): void => {
|
||||
const plans = shimPlans(capture);
|
||||
@@ -215,7 +211,7 @@ const machinePlan = (
|
||||
|
||||
const matchesHttpPlan = (
|
||||
value: unknown,
|
||||
event: ProcessCapture["protocol_events"][number],
|
||||
event: UnverifiedProcessCapture["protocol_events"][number],
|
||||
): boolean => {
|
||||
if (!isRecord(value)) return false;
|
||||
const route = isRecord(value["trigger"]) ? value["trigger"] : value;
|
||||
@@ -227,7 +223,7 @@ const matchesHttpPlan = (
|
||||
};
|
||||
|
||||
const validateMatchedHttpEvents = (
|
||||
capture: ProcessCapture,
|
||||
capture: UnverifiedProcessCapture,
|
||||
plans: readonly unknown[],
|
||||
require: RequireInvariant,
|
||||
): void => {
|
||||
@@ -245,7 +241,7 @@ const validateMatchedHttpEvents = (
|
||||
};
|
||||
|
||||
const validateReplayEvents = (
|
||||
capture: ProcessCapture,
|
||||
capture: UnverifiedProcessCapture,
|
||||
require: RequireInvariant,
|
||||
): void => {
|
||||
const replayPlan = capture.manifest.replay_plan;
|
||||
@@ -312,8 +308,8 @@ const validateReplayEvents = (
|
||||
};
|
||||
|
||||
/** Recompute v4 commitments and cross-field invariants without side effects. */
|
||||
export const validateProcessCapture = (
|
||||
capture: ProcessCapture,
|
||||
export const collectProcessCaptureIssues = (
|
||||
capture: UnverifiedProcessCapture,
|
||||
): readonly ProcessCaptureValidationIssue[] => {
|
||||
const issues: ProcessCaptureValidationIssue[] = [];
|
||||
const require: RequireInvariant = (condition, path, message) => {
|
||||
|
||||
Reference in New Issue
Block a user