refactor: add incremental capability migration safeguards (#819)
This commit is contained in:
@@ -1,19 +1,10 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { reconstructionCoverageEvaluationInputSchema } from "../domain/reconstructionCoverageInput.js";
|
||||
import { AnalysisInputError } from "../domain/analysisErrorCore.js";
|
||||
import { type AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import {
|
||||
evaluateReconstructionClosure,
|
||||
reconstructionCoverageDataSchema,
|
||||
} from "../domain/reconstructionCoverage.js";
|
||||
import { evaluateReconstructionClosure } from "../domain/reconstructionCoverage.js";
|
||||
import { jsonValueSchema, type JsonValue } from "../domain/jsonValue.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
|
||||
export const reconstructionCoverageEvaluationInputSchema = z.strictObject({
|
||||
coverage: reconstructionCoverageDataSchema,
|
||||
boundary_id: z.string().min(1),
|
||||
});
|
||||
|
||||
/** Evaluate inline reconstruction coverage against a named boundary. */
|
||||
export const evaluateReconstructionCoverage = (
|
||||
rawInput: unknown,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { reconstructionCoverageEvaluationInputSchema } from "../domain/reconstructionCoverageInput.js";
|
||||
import { Cli, z } from "incur";
|
||||
|
||||
import {
|
||||
@@ -7,10 +8,7 @@ import {
|
||||
traceApplicationFeatureEvidenceValidated,
|
||||
} from "../application/JavaScriptApplicationWorkflowService.js";
|
||||
import { traceJavaScriptSemanticsEvidenceValidated } from "../application/JavaScriptSemanticTraceService.js";
|
||||
import {
|
||||
evaluateReconstructionCoverage,
|
||||
reconstructionCoverageEvaluationInputSchema,
|
||||
} from "../application/ReconstructionCoverageService.js";
|
||||
import { evaluateReconstructionCoverage } from "../application/ReconstructionCoverageService.js";
|
||||
import { buildReconstructionObligationLedgerEvidenceValidated } from "../application/ReconstructionObligationLedgerService.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { parseCliJsonInput } from "../cliJsonInput.js";
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
traceApplicationFeatureRequestSchema,
|
||||
traceJavaScriptSemanticsRequestSchema,
|
||||
} from "./applicationWorkflowInputContracts.js";
|
||||
import { reconstructionCoverageEvaluationInputSchema } from "../application/ReconstructionCoverageService.js";
|
||||
import { reconstructionCoverageEvaluationInputSchema } from "../domain/reconstructionCoverageInput.js";
|
||||
import { reconstructionClosureResultSchema } from "../domain/reconstructionCoverage.js";
|
||||
import {
|
||||
reconstructionObligationLedgerInputSchema,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { z } from "zod";
|
||||
import { createCli } from "../cli.js";
|
||||
import { createCliInventory } from "../../scripts/lib/product-catalog.mjs";
|
||||
|
||||
import { ENHANCED_TOOL_CONTRACTS } from "./enhancedToolContracts.js";
|
||||
import { OFFICIAL_TOOL_CONTRACTS } from "./officialToolContracts.js";
|
||||
@@ -19,14 +17,7 @@ import { JAVASCRIPT_RUNTIME_OBSERVATION_TOOL_CONTRACTS } from "./javascriptRunti
|
||||
import { APPLICATION_TOOL_CONTRACTS } from "./applicationToolContracts.js";
|
||||
import { WEB_SCRIPT_TOOL_CONTRACTS } from "./webScriptToolContracts.js";
|
||||
import { TOOL_EFFECTS } from "./toolEffects.js";
|
||||
import { TOOL_CONTRACTS, toolContract } from "./toolContracts.js";
|
||||
import {
|
||||
CLI_COMMAND_ALIASES,
|
||||
CLI_COMMAND_NAMES,
|
||||
CLI_COMMAND_TOOL_ALIASES,
|
||||
MCP_TOOLS_WITHOUT_DEDICATED_CLI,
|
||||
} from "../cliCommandNames.js";
|
||||
|
||||
import { toolContract } from "./toolContracts.js";
|
||||
const contractJsonSchema = (schema: z.ZodType) =>
|
||||
z.toJSONSchema(schema, { target: "draft-07", unrepresentable: "any" });
|
||||
|
||||
@@ -135,39 +126,4 @@ describe("tool contract surface", () => {
|
||||
destructiveHint: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("accounts for every MCP tool on the CLI or marks it intentionally MCP-only", () => {
|
||||
const registeredCli = createCliInventory(createCli());
|
||||
const registeredCommandNames = new Set([
|
||||
...registeredCli.primary,
|
||||
...registeredCli.aliases.map(({ name }) => name),
|
||||
]);
|
||||
const cliToolNames = new Set(
|
||||
registeredCli.primary.map((command) => command.replaceAll("-", "_")),
|
||||
);
|
||||
for (const [command, names] of Object.entries(CLI_COMMAND_TOOL_ALIASES)) {
|
||||
expect(registeredCommandNames.has(command)).toBe(true);
|
||||
for (const name of names) cliToolNames.add(name);
|
||||
}
|
||||
for (const command of CLI_COMMAND_NAMES)
|
||||
expect(registeredCommandNames.has(command)).toBe(true);
|
||||
for (const command of CLI_COMMAND_ALIASES)
|
||||
expect(registeredCommandNames.has(command)).toBe(true);
|
||||
const intentionalMcpOnly = new Set<string>(MCP_TOOLS_WITHOUT_DEDICATED_CLI);
|
||||
expect(
|
||||
[...intentionalMcpOnly].filter((name) => cliToolNames.has(name)).sort(),
|
||||
).toEqual([]);
|
||||
const unaccounted = TOOL_CONTRACTS.map(({ name }) => name).filter(
|
||||
(name) => !cliToolNames.has(name) && !intentionalMcpOnly.has(name),
|
||||
);
|
||||
expect(unaccounted).toEqual([]);
|
||||
expect(new Set(MCP_TOOLS_WITHOUT_DEDICATED_CLI).size).toBe(
|
||||
MCP_TOOLS_WITHOUT_DEDICATED_CLI.length,
|
||||
);
|
||||
expect(
|
||||
MCP_TOOLS_WITHOUT_DEDICATED_CLI.every((name) =>
|
||||
TOOL_CONTRACTS.some((contract) => contract.name === name),
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import { z } from "zod";
|
||||
import { reconstructionCoverageDataSchema } from "./reconstructionCoverage.js";
|
||||
|
||||
/** Named-boundary input for inline reconstruction coverage evaluation. */
|
||||
export const reconstructionCoverageEvaluationInputSchema = z.strictObject({
|
||||
coverage: reconstructionCoverageDataSchema,
|
||||
boundary_id: z.string().min(1),
|
||||
});
|
||||
Reference in New Issue
Block a user