audit-tools 0.44.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audit/cli/dispatch/hostHandoff.d.ts +64 -3
- package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
- package/dist/audit/cli/dispatch/hostHandoff.js +196 -24
- package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
- package/dist/audit/cli/dispatch.d.ts +1 -1
- package/dist/audit/cli/dispatch.d.ts.map +1 -1
- package/dist/audit/cli/dispatch.js +1 -1
- package/dist/audit/cli/dispatch.js.map +1 -1
- package/dist/audit/cli/laneSubmissions.d.ts +3 -2
- package/dist/audit/cli/laneSubmissions.d.ts.map +1 -1
- package/dist/audit/cli/laneSubmissions.js.map +1 -1
- package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
- package/dist/audit/cli/nextStepCommand.js +1 -0
- package/dist/audit/cli/nextStepCommand.js.map +1 -1
- package/dist/audit/cli/nextStepHelpers.d.ts +36 -2
- package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
- package/dist/audit/cli/nextStepHelpers.js +95 -7
- package/dist/audit/cli/nextStepHelpers.js.map +1 -1
- package/dist/audit/cli/semanticReviewStep.d.ts +5 -2
- package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
- package/dist/audit/cli/semanticReviewStep.js +19 -0
- package/dist/audit/cli/semanticReviewStep.js.map +1 -1
- package/dist/audit/cli/unacceptResultsCommand.d.ts +18 -0
- package/dist/audit/cli/unacceptResultsCommand.d.ts.map +1 -0
- package/dist/audit/cli/unacceptResultsCommand.js +49 -0
- package/dist/audit/cli/unacceptResultsCommand.js.map +1 -0
- package/dist/audit/cli.d.ts +6 -0
- package/dist/audit/cli.d.ts.map +1 -1
- package/dist/audit/cli.js +34 -59
- package/dist/audit/cli.js.map +1 -1
- package/dist/audit/contracts/findingContractPrompt.d.ts +11 -0
- package/dist/audit/contracts/findingContractPrompt.d.ts.map +1 -0
- package/dist/audit/contracts/findingContractPrompt.js +112 -0
- package/dist/audit/contracts/findingContractPrompt.js.map +1 -0
- package/dist/audit/contracts/workerSchemas.d.ts +70 -16
- package/dist/audit/contracts/workerSchemas.d.ts.map +1 -1
- package/dist/audit/contracts/workerSchemas.js +5 -6
- package/dist/audit/contracts/workerSchemas.js.map +1 -1
- package/dist/audit/types.d.ts +15 -1
- package/dist/audit/types.d.ts.map +1 -1
- package/dist/audit/validation/auditResults.d.ts +39 -0
- package/dist/audit/validation/auditResults.d.ts.map +1 -1
- package/dist/audit/validation/auditResults.js +111 -53
- package/dist/audit/validation/auditResults.js.map +1 -1
- package/dist/audit/validation/ingestIssueCodes.d.ts +18 -0
- package/dist/audit/validation/ingestIssueCodes.d.ts.map +1 -0
- package/dist/audit/validation/ingestIssueCodes.js +26 -0
- package/dist/audit/validation/ingestIssueCodes.js.map +1 -0
- package/dist/remediate/state/types.d.ts +15 -1
- package/dist/remediate/state/types.d.ts.map +1 -1
- package/dist/shared/decompose/systemicChallenge.d.ts +15 -1
- package/dist/shared/decompose/systemicChallenge.d.ts.map +1 -1
- package/dist/shared/index.d.ts +3 -2
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +2 -2
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/submission/submissionClassifier.d.ts +4 -1
- package/dist/shared/submission/submissionClassifier.d.ts.map +1 -1
- package/dist/shared/submission/submissionClassifier.js.map +1 -1
- package/dist/shared/submission/submissionLedger.d.ts +11 -4
- package/dist/shared/submission/submissionLedger.d.ts.map +1 -1
- package/dist/shared/submission/submissionLedger.js +9 -0
- package/dist/shared/submission/submissionLedger.js.map +1 -1
- package/dist/shared/types/finding.d.ts +132 -20
- package/dist/shared/types/finding.d.ts.map +1 -1
- package/dist/shared/types/finding.js +70 -63
- package/dist/shared/types/finding.js.map +1 -1
- package/docs/audit-pkg/contracts.md +6 -0
- package/docs/audit-pkg/operator-guide.md +8 -0
- package/package.json +1 -1
- package/schemas/audit_result.schema.json +1 -1
- package/schemas/audit_results.schema.json +1 -1
- package/schemas/finding.schema.json +1 -1
- package/wrapper/audit-code-wrapper-lib.mjs +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// The audit draw's finding contract as prompt lines.
|
|
2
|
+
//
|
|
3
|
+
// DERIVED from `WorkerFindingSchema` — the strict projection ingestion parses —
|
|
4
|
+
// plus `AUDIT_RESULT_RULES`, the registry of the rules that are not expressible
|
|
5
|
+
// as per-finding schema refinements and that `validateAuditResults` emits its
|
|
6
|
+
// messages FROM. Prompt, acceptance and validation therefore share ONE source:
|
|
7
|
+
// a field or rule the validators enforce is stated here because it exists in
|
|
8
|
+
// the schema/registry, never because someone remembered to copy it in.
|
|
9
|
+
//
|
|
10
|
+
// A dispatch prompt that says only "findings must satisfy the audit finding
|
|
11
|
+
// contract" leaves the host to remember or fetch the contract; a measured lap
|
|
12
|
+
// lost four complete results exactly that way (findings missing the required
|
|
13
|
+
// per-finding `lens`; `evidence` submitted as a string where an array is
|
|
14
|
+
// required), and the 2026-08-21 lap then lost more to `evidence` being omitted
|
|
15
|
+
// entirely while downstream validation required it.
|
|
16
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
17
|
+
import { CONFIDENCES, LENSES, SEVERITIES, FINDING_LINE_END_INTEGER_RULE, FINDING_LINE_ORDER_RULE, FINDING_LINE_START_INTEGER_RULE, } from "audit-tools/shared";
|
|
18
|
+
import { AUDIT_RESULT_RULES } from "../validation/auditResults.js";
|
|
19
|
+
import { WorkerFindingSchema } from "./workerSchemas.js";
|
|
20
|
+
function describeField(node) {
|
|
21
|
+
if (node === undefined)
|
|
22
|
+
return "value";
|
|
23
|
+
if (Array.isArray(node.enum)) {
|
|
24
|
+
return `one of ${node.enum.map((value) => String(value)).join("|")}`;
|
|
25
|
+
}
|
|
26
|
+
if (node.type === "array") {
|
|
27
|
+
const item = node.items;
|
|
28
|
+
if (item?.type === "object") {
|
|
29
|
+
const required = [...(item.required ?? [])].sort();
|
|
30
|
+
return required.length > 0
|
|
31
|
+
? `array of objects, each requiring ${required.join(" + ")}`
|
|
32
|
+
: "array of objects";
|
|
33
|
+
}
|
|
34
|
+
return typeof item?.type === "string" ? `array of ${item.type}s` : "array";
|
|
35
|
+
}
|
|
36
|
+
return typeof node.type === "string" ? node.type : "value";
|
|
37
|
+
}
|
|
38
|
+
let renderedContract;
|
|
39
|
+
/**
|
|
40
|
+
* The finding contract as prompt lines: required fields (with their shapes),
|
|
41
|
+
* min-length facts, the closed vocabularies, the optional fields with their own
|
|
42
|
+
* `.describe()` text, and every non-schema rule statement verbatim.
|
|
43
|
+
*
|
|
44
|
+
* Memoized: the derivation is pure and the result is embedded in every
|
|
45
|
+
* work-item prompt (and therefore in every prompt hash), so it must be both
|
|
46
|
+
* cheap and byte-stable across a run.
|
|
47
|
+
*/
|
|
48
|
+
export function findingContractPromptLines() {
|
|
49
|
+
if (renderedContract !== undefined)
|
|
50
|
+
return renderedContract;
|
|
51
|
+
const schema = zodToJsonSchema(WorkerFindingSchema, {
|
|
52
|
+
$refStrategy: "none",
|
|
53
|
+
target: "jsonSchema7",
|
|
54
|
+
});
|
|
55
|
+
const properties = schema.properties ?? {};
|
|
56
|
+
const required = [...(schema.required ?? [])].sort();
|
|
57
|
+
const arrayFields = Object.entries(properties)
|
|
58
|
+
.filter(([, node]) => node.type === "array")
|
|
59
|
+
.map(([name]) => name)
|
|
60
|
+
.sort();
|
|
61
|
+
const optionalFields = Object.entries(properties)
|
|
62
|
+
.filter(([name]) => !required.includes(name))
|
|
63
|
+
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));
|
|
64
|
+
// Every min(1) the schema carries is a contract fact the host must know —
|
|
65
|
+
// an empty value fails the parse exactly as a missing field does — so it is
|
|
66
|
+
// detected FROM the schema node (required or optional, array or string),
|
|
67
|
+
// never from a hand list.
|
|
68
|
+
const nonEmptyFields = Object.entries(properties)
|
|
69
|
+
.filter(([, node]) => (node.minItems ?? 0) >= 1 || (node.minLength ?? 0) >= 1)
|
|
70
|
+
.map(([name]) => name)
|
|
71
|
+
.sort();
|
|
72
|
+
const nonEmptyLine = (names) => `Finding contract — ${names.join(", ")} ` +
|
|
73
|
+
`${names.every((name) => required.includes(name)) ? "must be non-empty" : "must be non-empty when supplied"} ` +
|
|
74
|
+
"(an empty value rejects the submission).";
|
|
75
|
+
const lines = [
|
|
76
|
+
"Finding contract — every entry of `findings` must carry these required fields: " +
|
|
77
|
+
required
|
|
78
|
+
.map((name) => `${name} (${describeField(properties[name])})`)
|
|
79
|
+
.join(", ") +
|
|
80
|
+
".",
|
|
81
|
+
...[
|
|
82
|
+
nonEmptyFields.filter((name) => required.includes(name)),
|
|
83
|
+
nonEmptyFields.filter((name) => !required.includes(name)),
|
|
84
|
+
]
|
|
85
|
+
.filter((names) => names.length > 0)
|
|
86
|
+
.map((names) => nonEmptyLine(names)),
|
|
87
|
+
"These fields are JSON arrays whenever present, never a bare string or object: " +
|
|
88
|
+
arrayFields.join(", ") +
|
|
89
|
+
". A finding that fails this contract rejects the whole submission.",
|
|
90
|
+
// `lens` is an OPTIONAL finding field (the enclosing AuditResult supplies
|
|
91
|
+
// the default), so its vocabulary clause is scoped to findings that supply
|
|
92
|
+
// one — stated two lines above as "lens is optional" — while severity and
|
|
93
|
+
// confidence are required on every finding. Still derived: the value list
|
|
94
|
+
// comes from LENSES, never a hand-typed copy.
|
|
95
|
+
`Closed vocabularies — severity must be one of ${SEVERITIES.join("|")}; confidence one of ${CONFIDENCES.join("|")}; lens, when supplied, one of ${LENSES.join("|")}.`,
|
|
96
|
+
...optionalFields
|
|
97
|
+
.filter(([, node]) => typeof node.description === "string")
|
|
98
|
+
.map(([name, node]) => `${name} is optional${typeof node.description === "string" ? `: ${node.description}` : "."}`),
|
|
99
|
+
// The line-span rules are enforced by the shared location refinement; the
|
|
100
|
+
// prompt states the very sentences the refinement emits (the exported
|
|
101
|
+
// constants), so the check and the statement cannot drift.
|
|
102
|
+
`Rule: ${FINDING_LINE_START_INTEGER_RULE}`,
|
|
103
|
+
`Rule: ${FINDING_LINE_END_INTEGER_RULE}`,
|
|
104
|
+
`Rule: ${FINDING_LINE_ORDER_RULE}`,
|
|
105
|
+
// Every cross-record rule the downstream validator enforces, verbatim from
|
|
106
|
+
// the registry the validator itself reads — not a paraphrase.
|
|
107
|
+
...AUDIT_RESULT_RULES.map((rule) => `Rule: ${rule.statement}`),
|
|
108
|
+
];
|
|
109
|
+
renderedContract = lines;
|
|
110
|
+
return renderedContract;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=findingContractPrompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findingContractPrompt.js","sourceRoot":"","sources":["../../../src/audit/contracts/findingContractPrompt.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,uEAAuE;AACvE,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yEAAyE;AACzE,+EAA+E;AAC/E,oDAAoD;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,WAAW,EACX,MAAM,EACN,UAAU,EACV,6BAA6B,EAC7B,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAgBzD,SAAS,aAAa,CAAC,IAA4B;IACjD,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IACvC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,OAAO,UAAU,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC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AAe,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAC/F;QACH,0EAA0E;QAC1E,sEAAsE;QACtE,2DAA2D;QAC3D,SAAS,+BAA+B,EAAE;QAC1C,SAAS,6BAA6B,EAAE;QACxC,SAAS,uBAAuB,EAAE;QAClC,2EAA2E;QAC3E,8DAA8D;QAC9D,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,IAAI,CAAC,SAAS,EAAE,CAAC;KAC/D,CAAC;IACF,gBAAgB,GAAG,KAAK,CAAC;IACzB,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const WorkerFindingLocationSchema: z.ZodObject<{
|
|
2
|
+
export declare const WorkerFindingLocationSchema: z.ZodEffects<z.ZodObject<{
|
|
3
3
|
path: z.ZodString;
|
|
4
|
+
line_start: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
line_end: z.ZodOptional<z.ZodNumber>;
|
|
4
6
|
symbol: z.ZodOptional<z.ZodString>;
|
|
5
7
|
quoted_text: z.ZodOptional<z.ZodString>;
|
|
6
8
|
hash_at_plan_time: z.ZodOptional<z.ZodString>;
|
|
7
|
-
} & {
|
|
8
|
-
line_start: z.ZodOptional<z.ZodNumber>;
|
|
9
|
-
line_end: z.ZodOptional<z.ZodNumber>;
|
|
10
9
|
}, "strict", z.ZodTypeAny, {
|
|
11
10
|
path: string;
|
|
12
11
|
symbol?: string | undefined;
|
|
@@ -21,6 +20,20 @@ export declare const WorkerFindingLocationSchema: z.ZodObject<{
|
|
|
21
20
|
line_end?: number | undefined;
|
|
22
21
|
quoted_text?: string | undefined;
|
|
23
22
|
hash_at_plan_time?: string | undefined;
|
|
23
|
+
}>, {
|
|
24
|
+
path: string;
|
|
25
|
+
symbol?: string | undefined;
|
|
26
|
+
line_start?: number | undefined;
|
|
27
|
+
line_end?: number | undefined;
|
|
28
|
+
quoted_text?: string | undefined;
|
|
29
|
+
hash_at_plan_time?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
path: string;
|
|
32
|
+
symbol?: string | undefined;
|
|
33
|
+
line_start?: number | undefined;
|
|
34
|
+
line_end?: number | undefined;
|
|
35
|
+
quoted_text?: string | undefined;
|
|
36
|
+
hash_at_plan_time?: string | undefined;
|
|
24
37
|
}>;
|
|
25
38
|
export declare const WorkerFindingSchema: z.ZodObject<{
|
|
26
39
|
id: z.ZodString;
|
|
@@ -120,14 +133,13 @@ export declare const WorkerFindingSchema: z.ZodObject<{
|
|
|
120
133
|
} & {
|
|
121
134
|
category: z.ZodString;
|
|
122
135
|
lens: z.ZodOptional<z.ZodEnum<["correctness", "architecture", "maintainability", "security", "reliability", "performance", "data_integrity", "tests", "operability", "config_deployment", "observability"]>>;
|
|
123
|
-
affected_files: z.ZodArray<z.ZodObject<{
|
|
136
|
+
affected_files: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
124
137
|
path: z.ZodString;
|
|
138
|
+
line_start: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
line_end: z.ZodOptional<z.ZodNumber>;
|
|
125
140
|
symbol: z.ZodOptional<z.ZodString>;
|
|
126
141
|
quoted_text: z.ZodOptional<z.ZodString>;
|
|
127
142
|
hash_at_plan_time: z.ZodOptional<z.ZodString>;
|
|
128
|
-
} & {
|
|
129
|
-
line_start: z.ZodOptional<z.ZodNumber>;
|
|
130
|
-
line_end: z.ZodOptional<z.ZodNumber>;
|
|
131
143
|
}, "strict", z.ZodTypeAny, {
|
|
132
144
|
path: string;
|
|
133
145
|
symbol?: string | undefined;
|
|
@@ -142,6 +154,20 @@ export declare const WorkerFindingSchema: z.ZodObject<{
|
|
|
142
154
|
line_end?: number | undefined;
|
|
143
155
|
quoted_text?: string | undefined;
|
|
144
156
|
hash_at_plan_time?: string | undefined;
|
|
157
|
+
}>, {
|
|
158
|
+
path: string;
|
|
159
|
+
symbol?: string | undefined;
|
|
160
|
+
line_start?: number | undefined;
|
|
161
|
+
line_end?: number | undefined;
|
|
162
|
+
quoted_text?: string | undefined;
|
|
163
|
+
hash_at_plan_time?: string | undefined;
|
|
164
|
+
}, {
|
|
165
|
+
path: string;
|
|
166
|
+
symbol?: string | undefined;
|
|
167
|
+
line_start?: number | undefined;
|
|
168
|
+
line_end?: number | undefined;
|
|
169
|
+
quoted_text?: string | undefined;
|
|
170
|
+
hash_at_plan_time?: string | undefined;
|
|
145
171
|
}>, "many">;
|
|
146
172
|
evidence: z.ZodArray<z.ZodString, "many">;
|
|
147
173
|
reproduction: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -247,6 +273,8 @@ export declare const WorkerFindingSchema: z.ZodObject<{
|
|
|
247
273
|
rule?: string | undefined;
|
|
248
274
|
} | undefined;
|
|
249
275
|
}>;
|
|
276
|
+
/** One finding as the strict projection parses it (ingestion's parse output). */
|
|
277
|
+
export type WorkerFinding = z.infer<typeof WorkerFindingSchema>;
|
|
250
278
|
export declare const WorkerAuditTaskSchema: z.ZodObject<{
|
|
251
279
|
task_id: z.ZodString;
|
|
252
280
|
unit_id: z.ZodString;
|
|
@@ -451,14 +479,13 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
451
479
|
} & {
|
|
452
480
|
category: z.ZodString;
|
|
453
481
|
lens: z.ZodOptional<z.ZodEnum<["correctness", "architecture", "maintainability", "security", "reliability", "performance", "data_integrity", "tests", "operability", "config_deployment", "observability"]>>;
|
|
454
|
-
affected_files: z.ZodArray<z.ZodObject<{
|
|
482
|
+
affected_files: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
455
483
|
path: z.ZodString;
|
|
484
|
+
line_start: z.ZodOptional<z.ZodNumber>;
|
|
485
|
+
line_end: z.ZodOptional<z.ZodNumber>;
|
|
456
486
|
symbol: z.ZodOptional<z.ZodString>;
|
|
457
487
|
quoted_text: z.ZodOptional<z.ZodString>;
|
|
458
488
|
hash_at_plan_time: z.ZodOptional<z.ZodString>;
|
|
459
|
-
} & {
|
|
460
|
-
line_start: z.ZodOptional<z.ZodNumber>;
|
|
461
|
-
line_end: z.ZodOptional<z.ZodNumber>;
|
|
462
489
|
}, "strict", z.ZodTypeAny, {
|
|
463
490
|
path: string;
|
|
464
491
|
symbol?: string | undefined;
|
|
@@ -473,6 +500,20 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
473
500
|
line_end?: number | undefined;
|
|
474
501
|
quoted_text?: string | undefined;
|
|
475
502
|
hash_at_plan_time?: string | undefined;
|
|
503
|
+
}>, {
|
|
504
|
+
path: string;
|
|
505
|
+
symbol?: string | undefined;
|
|
506
|
+
line_start?: number | undefined;
|
|
507
|
+
line_end?: number | undefined;
|
|
508
|
+
quoted_text?: string | undefined;
|
|
509
|
+
hash_at_plan_time?: string | undefined;
|
|
510
|
+
}, {
|
|
511
|
+
path: string;
|
|
512
|
+
symbol?: string | undefined;
|
|
513
|
+
line_start?: number | undefined;
|
|
514
|
+
line_end?: number | undefined;
|
|
515
|
+
quoted_text?: string | undefined;
|
|
516
|
+
hash_at_plan_time?: string | undefined;
|
|
476
517
|
}>, "many">;
|
|
477
518
|
evidence: z.ZodArray<z.ZodString, "many">;
|
|
478
519
|
reproduction: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -1052,14 +1093,13 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1052
1093
|
} & {
|
|
1053
1094
|
category: z.ZodString;
|
|
1054
1095
|
lens: z.ZodOptional<z.ZodEnum<["correctness", "architecture", "maintainability", "security", "reliability", "performance", "data_integrity", "tests", "operability", "config_deployment", "observability"]>>;
|
|
1055
|
-
affected_files: z.ZodArray<z.ZodObject<{
|
|
1096
|
+
affected_files: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
1056
1097
|
path: z.ZodString;
|
|
1098
|
+
line_start: z.ZodOptional<z.ZodNumber>;
|
|
1099
|
+
line_end: z.ZodOptional<z.ZodNumber>;
|
|
1057
1100
|
symbol: z.ZodOptional<z.ZodString>;
|
|
1058
1101
|
quoted_text: z.ZodOptional<z.ZodString>;
|
|
1059
1102
|
hash_at_plan_time: z.ZodOptional<z.ZodString>;
|
|
1060
|
-
} & {
|
|
1061
|
-
line_start: z.ZodOptional<z.ZodNumber>;
|
|
1062
|
-
line_end: z.ZodOptional<z.ZodNumber>;
|
|
1063
1103
|
}, "strict", z.ZodTypeAny, {
|
|
1064
1104
|
path: string;
|
|
1065
1105
|
symbol?: string | undefined;
|
|
@@ -1074,6 +1114,20 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1074
1114
|
line_end?: number | undefined;
|
|
1075
1115
|
quoted_text?: string | undefined;
|
|
1076
1116
|
hash_at_plan_time?: string | undefined;
|
|
1117
|
+
}>, {
|
|
1118
|
+
path: string;
|
|
1119
|
+
symbol?: string | undefined;
|
|
1120
|
+
line_start?: number | undefined;
|
|
1121
|
+
line_end?: number | undefined;
|
|
1122
|
+
quoted_text?: string | undefined;
|
|
1123
|
+
hash_at_plan_time?: string | undefined;
|
|
1124
|
+
}, {
|
|
1125
|
+
path: string;
|
|
1126
|
+
symbol?: string | undefined;
|
|
1127
|
+
line_start?: number | undefined;
|
|
1128
|
+
line_end?: number | undefined;
|
|
1129
|
+
quoted_text?: string | undefined;
|
|
1130
|
+
hash_at_plan_time?: string | undefined;
|
|
1077
1131
|
}>, "many">;
|
|
1078
1132
|
evidence: z.ZodArray<z.ZodString, "many">;
|
|
1079
1133
|
reproduction: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workerSchemas.d.ts","sourceRoot":"","sources":["../../../src/audit/contracts/workerSchemas.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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,CAAA;CAAE,CAaxC,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBzB"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
// Worker-facing contract schemas derived from the canonical zod sources.
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
4
|
-
import { FindingSchema,
|
|
4
|
+
import { FindingSchema, FindingLocationObjectSchema, LensSchema, refineFindingLocationLines, } from "audit-tools/shared";
|
|
5
5
|
import { AuditTaskSchema, AuditResultSchema, AuditVerificationSchema, } from "../types.js";
|
|
6
|
-
export const WorkerFindingLocationSchema =
|
|
7
|
-
line_start: z.number().int().min(1).optional(),
|
|
8
|
-
line_end: z.number().int().min(1).optional(),
|
|
9
|
-
}).strict();
|
|
6
|
+
export const WorkerFindingLocationSchema = FindingLocationObjectSchema.strict().superRefine(refineFindingLocationLines);
|
|
10
7
|
// `grounding` is OMITTED, not merely left un-extended: it is the tool's own
|
|
11
8
|
// re-check of the worker's quote (computed at ingest by `ingestAuditHostResults`),
|
|
12
9
|
// so the worker-facing contract must not advertise it. `.extend` inherits the
|
|
@@ -15,7 +12,9 @@ export const WorkerFindingLocationSchema = FindingLocationSchema.extend({
|
|
|
15
12
|
export const WorkerFindingSchema = FindingSchema.omit({ grounding: true })
|
|
16
13
|
.extend({
|
|
17
14
|
category: z.string().min(1),
|
|
18
|
-
|
|
15
|
+
// Optionality itself is stated by the prompt renderer (`… is optional:`);
|
|
16
|
+
// the describe text states only WHAT happens when omitted.
|
|
17
|
+
lens: LensSchema.describe("defaults from the enclosing AuditResult lens when omitted.").optional(),
|
|
19
18
|
affected_files: z.array(WorkerFindingLocationSchema).min(1),
|
|
20
19
|
evidence: z.array(z.string()).min(1),
|
|
21
20
|
reproduction: z.array(z.string()).min(1).optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workerSchemas.js","sourceRoot":"","sources":["../../../src/audit/contracts/workerSchemas.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"workerSchemas.js","sourceRoot":"","sources":["../../../src/audit/contracts/workerSchemas.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,UAAU,EACV,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,2BAA2B,GACtC,2BAA2B,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;AAE/E,4EAA4E;AAC5E,mFAAmF;AACnF,8EAA8E;AAC9E,8EAA8E;AAC9E,iFAAiF;AACjF,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;KACvE,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,0EAA0E;IAC1E,2DAA2D;IAC3D,IAAI,EAAE,UAAU,CAAC,QAAQ,CACvB,4DAA4D,CAC7D,CAAC,QAAQ,EAAE;IACZ,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3D,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG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,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,qBAAqB,GAG9B;IACF,kBAAkB,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE;IACzD,qBAAqB,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,eAAe,EAAE;IAC9E,wBAAwB,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,KAAK,EAAE,YAAY,EAAE;IAChF,0BAA0B,EAAE;QAC1B,MAAM,EAAE,uBAAuB;QAC/B,KAAK,EAAE,cAAc;KACtB;IACD,2BAA2B,EAAE;QAC3B,MAAM,EAAE,wBAAwB;QAChC,KAAK,EAAE,eAAe;KACvB;CACF,CAAC;AAEF,MAAM,UAAU,sBAAsB,CACpC,QAAgB;IAEhB,MAAM,KAAK,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,2CAA2C,QAAQ,GAAG,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE;QAC9C,YAAY,EAAE,MAAM;QACpB,MAAM,EAAE,aAAa;KACtB,CAA4B,CAAC;IAC9B,OAAO,SAAS,CAAC,OAAO,CAAC;IACzB,OAAO;QACL,OAAO,EAAE,8CAA8C;QACvD,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,GAAG,SAAS;KACb,CAAC;AACJ,CAAC"}
|
package/dist/audit/types.d.ts
CHANGED
|
@@ -527,7 +527,7 @@ export declare const AuditResultSchema: z.ZodObject<{
|
|
|
527
527
|
confidence: z.ZodEnum<["high", "medium", "low"]>;
|
|
528
528
|
lens: z.ZodString;
|
|
529
529
|
summary: z.ZodString;
|
|
530
|
-
affected_files: z.ZodArray<z.ZodObject<{
|
|
530
|
+
affected_files: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
531
531
|
path: z.ZodString;
|
|
532
532
|
line_start: z.ZodOptional<z.ZodNumber>;
|
|
533
533
|
line_end: z.ZodOptional<z.ZodNumber>;
|
|
@@ -548,6 +548,20 @@ export declare const AuditResultSchema: z.ZodObject<{
|
|
|
548
548
|
line_end?: number | undefined;
|
|
549
549
|
quoted_text?: string | undefined;
|
|
550
550
|
hash_at_plan_time?: string | undefined;
|
|
551
|
+
}>, {
|
|
552
|
+
path: string;
|
|
553
|
+
symbol?: string | undefined;
|
|
554
|
+
line_start?: number | undefined;
|
|
555
|
+
line_end?: number | undefined;
|
|
556
|
+
quoted_text?: string | undefined;
|
|
557
|
+
hash_at_plan_time?: string | undefined;
|
|
558
|
+
}, {
|
|
559
|
+
path: string;
|
|
560
|
+
symbol?: string | undefined;
|
|
561
|
+
line_start?: number | undefined;
|
|
562
|
+
line_end?: number | undefined;
|
|
563
|
+
quoted_text?: string | undefined;
|
|
564
|
+
hash_at_plan_time?: string | undefined;
|
|
551
565
|
}>, "many">;
|
|
552
566
|
impact: z.ZodOptional<z.ZodString>;
|
|
553
567
|
likelihood: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/audit/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnE,MAAM,MAAM,IAAI,GACZ,aAAa,GACb,cAAc,GACd,iBAAiB,GACjB,UAAU,GACV,aAAa,GACb,aAAa,GACb,gBAAgB,GAChB,OAAO,GACP,aAAa,GACb,mBAAmB,GACnB,eAAe,CAAC;AAEpB;qEACqE;AACrE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,IAAI,CAAC;IACT,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;;;;;;;;;;;;;;;;;;;;;;;;;;IAgB5B;;;;;;;;;;;OAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAhEH;;;;;;eAMG;;YAEH;;;;;eAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6EH,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import type { AuditTask } from "../types.js";
|
|
2
2
|
import { type ValidationIssue } from "audit-tools/shared";
|
|
3
3
|
export type IssueSeverity = "error" | "warning";
|
|
4
|
+
/**
|
|
5
|
+
* THE one statement of each finding/result rule that is NOT expressible as a
|
|
6
|
+
* per-finding zod refinement — it needs cross-record context (the declared
|
|
7
|
+
* coverage, the zero/positive finding count) or the assigned task. The dispatch
|
|
8
|
+
* prompt's contract block renders every `statement` verbatim
|
|
9
|
+
* (`findingContractPromptLines`), and each validator site below emits its issue
|
|
10
|
+
* message FROM its registry entry, so the prompt the tool generates states
|
|
11
|
+
* exactly what the validator enforces: one source, not two.
|
|
12
|
+
*
|
|
13
|
+
* Rules expressible IN the schemas are not here — they live where they are
|
|
14
|
+
* enforced (the finding/location contracts in `audit-tools/shared`, which the
|
|
15
|
+
* prompt renders from `WorkerFindingSchema`).
|
|
16
|
+
*/
|
|
17
|
+
export declare const AUDIT_RESULT_RULES: readonly [{
|
|
18
|
+
readonly id: "affected_span_within_coverage";
|
|
19
|
+
readonly statement: "Every affected_files line span must fall inside the declared file_coverage for its file.";
|
|
20
|
+
}, {
|
|
21
|
+
readonly id: "reviewed_clean_affirmation";
|
|
22
|
+
readonly statement: "A result with zero findings must set reviewed_clean: true; reviewed_clean must never be set when findings are reported.";
|
|
23
|
+
}, {
|
|
24
|
+
readonly id: "finding_lens_matches_task";
|
|
25
|
+
readonly statement: "Each finding's lens must match the assigned task lens (or be omitted to default from it).";
|
|
26
|
+
}];
|
|
27
|
+
/** Look up one registry entry by id (validator sites emit FROM this text). */
|
|
28
|
+
export declare function auditResultRule(id: (typeof AUDIT_RESULT_RULES)[number]["id"]): string;
|
|
4
29
|
/**
|
|
5
30
|
* True when a declared `total_lines` diverges from the actual line count by
|
|
6
31
|
* enough to treat the result as semantically wrong (CE-009), rather than an S7
|
|
@@ -48,6 +73,20 @@ export interface ValidateAuditResultOptions {
|
|
|
48
73
|
*/
|
|
49
74
|
boundaryPaths?: string[];
|
|
50
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The PER-RESULT half of {@link validateAuditResults}, exported for callers
|
|
78
|
+
* that must apply exactly the same rules to ONE result before admitting it —
|
|
79
|
+
* the host-handoff ingest validates each converted result BEFORE writing it to
|
|
80
|
+
* the accepted pair, so a result the batch gate would later reject is never
|
|
81
|
+
* accepted in the first place. One rule body: this delegates to the same
|
|
82
|
+
* internal `validateSingleAuditResult` the batch walk uses, so the two cannot
|
|
83
|
+
* drift.
|
|
84
|
+
*
|
|
85
|
+
* Returns the issues (possibly empty); it never throws and never writes the
|
|
86
|
+
* batch summary to stderr — a single-result caller surfaces outcomes in its own
|
|
87
|
+
* vocabulary.
|
|
88
|
+
*/
|
|
89
|
+
export declare function validateOneAuditResult(result: unknown, tasks: AuditTask[], options?: ValidateAuditResultOptions): AuditResultIssue[];
|
|
51
90
|
export declare function validateAuditResults(results: unknown, tasks: AuditTask[], options?: ValidateAuditResultOptions): AuditResultIssue[];
|
|
52
91
|
export declare function formatAuditResultIssues(issues: AuditResultIssue[]): string;
|
|
53
92
|
//# sourceMappingURL=auditResults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auditResults.d.ts","sourceRoot":"","sources":["../../../src/audit/validation/auditResults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,aAAa,CAAC;AAEtD,OAAO,
|
|
1
|
+
{"version":3,"file":"auditResults.d.ts","sourceRoot":"","sources":["../../../src/audit/validation/auditResults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,aAAa,CAAC;AAEtD,OAAO,EASL,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;EAgBrB,CAAC;AAEX,8EAA8E;AAC9E,wBAAgB,eAAe,CAC7B,EAAE,EAAE,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAC5C,MAAM,CAIR;AAkBD;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAKvF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC;;;;;;;;;;;OAW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