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
@@ -192,47 +192,70 @@ const applicationLimitSchema = z.strictObject({
|
||||
});
|
||||
|
||||
/** Bounded collection coverage without treating omission as absence. */
|
||||
export const applicationCoverageSchema = z
|
||||
.strictObject({
|
||||
status: z.enum(["complete", "partial", "unknown", "unavailable"]),
|
||||
truncated: z.boolean(),
|
||||
omitted_count: z
|
||||
.number()
|
||||
.int()
|
||||
.min(0)
|
||||
.max(Number.MAX_SAFE_INTEGER)
|
||||
.nullable(),
|
||||
limits: z.array(applicationLimitSchema).max(32),
|
||||
})
|
||||
.superRefine((coverage, context) => {
|
||||
if (
|
||||
coverage.status === "complete" &&
|
||||
(coverage.truncated || coverage.omitted_count !== 0)
|
||||
)
|
||||
context.addIssue({
|
||||
code: "custom",
|
||||
message: "Complete coverage cannot be truncated or omit items",
|
||||
});
|
||||
if (
|
||||
coverage.truncated &&
|
||||
(coverage.status !== "partial" ||
|
||||
coverage.limits.length === 0 ||
|
||||
coverage.omitted_count === 0)
|
||||
)
|
||||
context.addIssue({
|
||||
code: "custom",
|
||||
message:
|
||||
"Truncated coverage must be partial, name a limit, and not claim zero omissions",
|
||||
});
|
||||
if (
|
||||
["unknown", "unavailable"].includes(coverage.status) &&
|
||||
(coverage.truncated || coverage.omitted_count !== null)
|
||||
)
|
||||
context.addIssue({
|
||||
code: "custom",
|
||||
message:
|
||||
"Unknown or unavailable coverage cannot invent truncation counts",
|
||||
});
|
||||
const coverageLimitsSchema = z.array(applicationLimitSchema).max(32);
|
||||
const omittedCountSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
||||
|
||||
export const applicationCoverageSchema = z.union([
|
||||
z.strictObject({
|
||||
status: z.literal("complete"),
|
||||
truncated: z.literal(false),
|
||||
omitted_count: z.literal(0),
|
||||
limits: coverageLimitsSchema,
|
||||
}),
|
||||
z.strictObject({
|
||||
status: z.literal("partial"),
|
||||
truncated: z.literal(false),
|
||||
omitted_count: omittedCountSchema.nullable(),
|
||||
limits: coverageLimitsSchema,
|
||||
}),
|
||||
z.strictObject({
|
||||
status: z.literal("partial"),
|
||||
truncated: z.literal(true),
|
||||
omitted_count: z.union([omittedCountSchema.positive(), z.null()]),
|
||||
limits: z.array(applicationLimitSchema).min(1).max(32),
|
||||
}),
|
||||
z.strictObject({
|
||||
status: z.enum(["unknown", "unavailable"]),
|
||||
truncated: z.literal(false),
|
||||
omitted_count: z.null(),
|
||||
limits: coverageLimitsSchema,
|
||||
}),
|
||||
]);
|
||||
export type ApplicationCoverage = z.infer<typeof applicationCoverageSchema>;
|
||||
|
||||
/** Construct complete bounded coverage under the stated configured limits. */
|
||||
export const completeApplicationCoverage = (
|
||||
limits: ApplicationCoverage["limits"] = [],
|
||||
): ApplicationCoverage =>
|
||||
applicationCoverageSchema.parse({
|
||||
status: "complete",
|
||||
truncated: false,
|
||||
omitted_count: 0,
|
||||
limits,
|
||||
});
|
||||
|
||||
/** Construct partial non-truncated coverage without inventing omissions. */
|
||||
export const partialApplicationCoverage = (
|
||||
limits: ApplicationCoverage["limits"],
|
||||
omittedCount: number | null,
|
||||
): ApplicationCoverage =>
|
||||
applicationCoverageSchema.parse({
|
||||
status: "partial",
|
||||
truncated: false,
|
||||
omitted_count: omittedCount,
|
||||
limits,
|
||||
});
|
||||
|
||||
/** Construct limit-truncated coverage with a named bound. */
|
||||
export const truncatedApplicationCoverage = (
|
||||
limits: ApplicationCoverage["limits"],
|
||||
omittedCount: number | null,
|
||||
): ApplicationCoverage =>
|
||||
applicationCoverageSchema.parse({
|
||||
status: "partial",
|
||||
truncated: true,
|
||||
omitted_count: omittedCount,
|
||||
limits,
|
||||
});
|
||||
|
||||
const applicationGraphEvidenceBaseSchema = z.strictObject({
|
||||
|
||||
Reference in New Issue
Block a user