refactor(tools): remove artificial analysis ceilings

This commit is contained in:
morluto
2026-09-29 16:29:23 +08:00
parent 36aeec9586
commit 2f08c7c932
202 changed files with 2314 additions and 3072 deletions
+23 -26
View File
@@ -4,24 +4,18 @@ import { traceJavaScriptSemanticsRequestSchema } from "./applicationWorkflowInpu
import { ARTIFACT_TOOL_CONTRACTS } from "./artifactToolContracts.js";
import { JAVASCRIPT_FEATURE_TRACE_FULL_EVIDENCE_EXAMPLE } from "./javascriptApplicationWorkflowExamples.js";
import {
MANAGED_WORKFLOW_TOOL_CONTRACTS,
MANAGED_APPLICATION_GRAPH_EXAMPLE,
MANAGED_MEMBER_COMPARISON_EXAMPLE,
MANAGED_NATIVE_VERIFICATION_EXAMPLE,
} from "./managedWorkflowExamples.js";
import {
compareManagedMembersReferenceInputSchema,
managedApplicationGraphReferenceInputSchema,
managedNativeVerificationReferenceInputSchema,
} from "./managedWorkflowToolContracts.js";
const EVIDENCE_ID = `ev_${"a".repeat(64)}`;
const workflowInput = (name: string) => {
const contract = MANAGED_WORKFLOW_TOOL_CONTRACTS.find(
(candidate) => candidate.name === name,
);
if (contract === undefined) throw new Error(`Missing ${name} contract`);
return contract.examples[0].input;
};
describe("workflow input contracts", () => {
it("rejects missing and duplicated application Evidence references", () => {
it("rejects application Evidence ID references and duplicate inline records", () => {
const query = {
seed: { kind: "literal" as const, value: "renderer" },
direction: "callers" as const,
@@ -40,29 +34,29 @@ describe("workflow input contracts", () => {
).toBe(false);
});
it("rejects managed Evidence identity collisions", () => {
const comparison = workflowInput("compare_managed_members");
it("rejects duplicate inline managed Evidence records", () => {
expect(
compareManagedMembersReferenceInputSchema.safeParse({
...comparison,
left_evidence_id: EVIDENCE_ID,
right_evidence_id: EVIDENCE_ID,
left: MANAGED_MEMBER_COMPARISON_EXAMPLE.left,
right: MANAGED_MEMBER_COMPARISON_EXAMPLE.left,
}).success,
).toBe(false);
const native = workflowInput("verify_managed_native_boundaries");
expect(
managedNativeVerificationReferenceInputSchema.safeParse({
...native,
managed_boundaries_evidence_id: EVIDENCE_ID,
native_observation_evidence_ids: [EVIDENCE_ID, EVIDENCE_ID],
managed_boundaries:
MANAGED_NATIVE_VERIFICATION_EXAMPLE.managed_boundaries,
native_observations: [
MANAGED_NATIVE_VERIFICATION_EXAMPLE.native_observations[0],
MANAGED_NATIVE_VERIFICATION_EXAMPLE.native_observations[0],
],
}).success,
).toBe(false);
expect(
managedApplicationGraphReferenceInputSchema.safeParse({
managed_artifact_evidence_id: EVIDENCE_ID,
managed_members_evidence_id: EVIDENCE_ID,
managed_artifact: MANAGED_APPLICATION_GRAPH_EXAMPLE.managed_members,
managed_members: MANAGED_APPLICATION_GRAPH_EXAMPLE.managed_members,
}).success,
).toBe(false);
expect(
@@ -72,9 +66,12 @@ describe("workflow input contracts", () => {
it("accepts each complete managed application Evidence source", () => {
for (const input of [
{ managed_artifact_evidence_id: EVIDENCE_ID },
{ managed_members_evidence_id: EVIDENCE_ID },
{ managed_native_boundaries_evidence_id: EVIDENCE_ID },
{ managed_artifact: MANAGED_APPLICATION_GRAPH_EXAMPLE.managed_members },
{ managed_members: MANAGED_APPLICATION_GRAPH_EXAMPLE.managed_members },
{
managed_native_boundaries:
MANAGED_APPLICATION_GRAPH_EXAMPLE.managed_members,
},
])
expect(
managedApplicationGraphReferenceInputSchema.safeParse(input).success,