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
@@ -11,6 +11,17 @@ import {
|
||||
|
||||
type Shape = ProjectedExportReturnShapes["static_return_shapes"][number];
|
||||
type SelectorResult = JavaScriptExportShapeComparisonResult["left"];
|
||||
type SelectorBase = Omit<SelectorResult, "status" | "selected_node_id">;
|
||||
type ReturnShapeSelection =
|
||||
| {
|
||||
readonly projection: ProjectedExportReturnShapes;
|
||||
readonly observationComplete: boolean;
|
||||
}
|
||||
| {
|
||||
readonly projection: null;
|
||||
readonly observationComplete: false;
|
||||
readonly reason: string;
|
||||
};
|
||||
|
||||
/** One authenticated graph and exact export selector. */
|
||||
export interface JavaScriptExportShapeSideInput {
|
||||
@@ -28,12 +39,19 @@ interface ExportCandidate {
|
||||
}
|
||||
|
||||
/** Exact selector result plus any admitted static return-shape projection. */
|
||||
export interface SelectedJavaScriptExport {
|
||||
readonly selection: SelectorResult;
|
||||
readonly projection: ProjectedExportReturnShapes | null;
|
||||
readonly observationComplete: boolean;
|
||||
readonly limitations: readonly string[];
|
||||
}
|
||||
export type SelectedJavaScriptExport =
|
||||
| {
|
||||
readonly selection: Extract<SelectorResult, { status: "selected" }>;
|
||||
readonly projection: ProjectedExportReturnShapes;
|
||||
readonly observationComplete: boolean;
|
||||
readonly limitations: readonly [];
|
||||
}
|
||||
| {
|
||||
readonly selection: Exclude<SelectorResult, { status: "selected" }>;
|
||||
readonly projection: null;
|
||||
readonly observationComplete: false;
|
||||
readonly limitations: readonly string[];
|
||||
};
|
||||
|
||||
/** Caller-retained return shapes and their exact caller-limit omission count. */
|
||||
export interface RetainedJavaScriptExportShapes {
|
||||
@@ -64,28 +82,40 @@ export const selectJavaScriptExport = (
|
||||
const retainedCandidates = diagnosticPool.slice(0, maxCandidates);
|
||||
const base = selectorBase(side, diagnosticPool, retainedCandidates);
|
||||
if (exact.length === 0)
|
||||
return unresolvedSelection(base, "missing", null, [
|
||||
`No exact export binding matched ${side.modulePath}:${side.exportName}.`,
|
||||
]);
|
||||
return unresolvedSelection(
|
||||
base,
|
||||
{ status: "missing", selected_node_id: null },
|
||||
[
|
||||
`No exact export binding matched ${side.modulePath}:${side.exportName}.`,
|
||||
],
|
||||
);
|
||||
if (exact.length > 1)
|
||||
return unresolvedSelection(base, "ambiguous", null, [
|
||||
`Multiple exact export bindings matched ${side.modulePath}:${side.exportName}; none was selected.`,
|
||||
]);
|
||||
return unresolvedSelection(
|
||||
base,
|
||||
{ status: "ambiguous", selected_node_id: null },
|
||||
[
|
||||
`Multiple exact export bindings matched ${side.modulePath}:${side.exportName}; none was selected.`,
|
||||
],
|
||||
);
|
||||
const selected = exact[0];
|
||||
if (selected === undefined || !selected.trusted)
|
||||
return unresolvedSelection(
|
||||
base,
|
||||
"unavailable",
|
||||
selected?.node.node_id ?? null,
|
||||
{
|
||||
status: "unavailable",
|
||||
selected_node_id: selected?.node.node_id ?? null,
|
||||
},
|
||||
[
|
||||
"The exact export binding lacks the expected static-analysis authority.",
|
||||
],
|
||||
);
|
||||
const returnShape = returnShapeFor(selected.node, side);
|
||||
if (returnShape.projection === null)
|
||||
return unresolvedSelection(base, "unavailable", selected.node.node_id, [
|
||||
returnShape.reason,
|
||||
]);
|
||||
return unresolvedSelection(
|
||||
base,
|
||||
{ status: "unavailable", selected_node_id: selected.node.node_id },
|
||||
[returnShape.reason],
|
||||
);
|
||||
return {
|
||||
selection: {
|
||||
...base,
|
||||
@@ -112,7 +142,7 @@ const selectorBase = (
|
||||
side: JavaScriptExportShapeSideInput,
|
||||
candidates: readonly ExportCandidate[],
|
||||
retained: readonly ExportCandidate[],
|
||||
): Omit<SelectorResult, "status" | "selected_node_id"> => ({
|
||||
): SelectorBase => ({
|
||||
evidence_id: side.evidenceId,
|
||||
graph_id: side.graph.graph_id,
|
||||
requested_module_path: side.modulePath,
|
||||
@@ -128,12 +158,19 @@ const selectorBase = (
|
||||
});
|
||||
|
||||
const unresolvedSelection = (
|
||||
base: Omit<SelectorResult, "status" | "selected_node_id">,
|
||||
status: "missing" | "ambiguous" | "unavailable",
|
||||
nodeId: string | null,
|
||||
base: SelectorBase,
|
||||
resolution:
|
||||
| {
|
||||
readonly status: "missing" | "ambiguous";
|
||||
readonly selected_node_id: null;
|
||||
}
|
||||
| {
|
||||
readonly status: "unavailable";
|
||||
readonly selected_node_id: string | null;
|
||||
},
|
||||
limitations: readonly string[],
|
||||
): SelectedJavaScriptExport => ({
|
||||
selection: { ...base, status, selected_node_id: nodeId },
|
||||
selection: { ...base, ...resolution },
|
||||
projection: null,
|
||||
observationComplete: false,
|
||||
limitations,
|
||||
@@ -176,11 +213,7 @@ const candidateKey = (candidate: ExportCandidate): string =>
|
||||
const returnShapeFor = (
|
||||
node: ApplicationNode,
|
||||
side: JavaScriptExportShapeSideInput,
|
||||
): {
|
||||
readonly projection: ProjectedExportReturnShapes | null;
|
||||
readonly observationComplete: boolean;
|
||||
readonly reason: string;
|
||||
} => {
|
||||
): ReturnShapeSelection => {
|
||||
const roleObservations = node.observations.filter(
|
||||
({ properties }) => properties.semantic_role === "export-return-shapes",
|
||||
);
|
||||
@@ -223,11 +256,12 @@ const returnShapeFor = (
|
||||
observationComplete:
|
||||
observation.evidence.coverage.status === "complete" &&
|
||||
!observation.evidence.coverage.truncated,
|
||||
reason: "",
|
||||
};
|
||||
};
|
||||
|
||||
const unavailableReturnShape = (reason: string) => ({
|
||||
const unavailableReturnShape = (
|
||||
reason: string,
|
||||
): Extract<ReturnShapeSelection, { readonly projection: null }> => ({
|
||||
projection: null,
|
||||
observationComplete: false,
|
||||
reason,
|
||||
|
||||
Reference in New Issue
Block a user