@fro.bot/systematic 3.25.1 → 3.25.2

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.
@@ -1,3 +1,4 @@
1
+ import { type SchemaRejection } from './lib/review-pipeline.js';
1
2
  import { type ReadChunk } from './lib/review-return-validator.js';
2
3
  /**
3
4
  * Entry point for the generated, self-contained `ce:review` skill-local
@@ -35,21 +36,21 @@ export declare const CE_REVIEW_SCREEN_INTERNAL_ERROR_MESSAGE = "ce-review-valida
35
36
  export declare const CE_REVIEW_PREPARE_USAGE = "Usage: node validate-review.mjs prepare";
36
37
  export declare const CE_REVIEW_PREPARE_STDIN_TTY_MESSAGE = "prepare reads one aggregate JSON envelope from stdin; interactive input is not supported";
37
38
  export declare const CE_REVIEW_PREPARE_STDIN_READ_FAILED_MESSAGE = "prepare could not read the aggregate envelope from stdin";
38
- export declare const CE_REVIEW_PREPARE_STDIN_OVERSIZED_MESSAGE = "prepare input exceeds the aggregate byte cap";
39
+ export declare const CE_REVIEW_PREPARE_STDIN_OVERSIZED_MESSAGE = "prepare input exceeds the aggregate byte cap (16842752 bytes)";
39
40
  export declare const CE_REVIEW_PREPARE_STDIN_INVALID_UTF8_MESSAGE = "prepare input is not valid UTF-8";
40
41
  export declare const CE_REVIEW_PREPARE_STDIN_EMPTY_MESSAGE = "prepare received empty stdin";
41
42
  export declare const CE_REVIEW_PREPARE_REJECTED_MESSAGE = "prepare rejected the aggregate envelope";
42
43
  export declare const CE_REVIEW_MERGE_USAGE = "Usage: node validate-review.mjs merge";
43
44
  export declare const CE_REVIEW_MERGE_STDIN_TTY_MESSAGE = "merge reads one aggregate JSON envelope from stdin; interactive input is not supported";
44
45
  export declare const CE_REVIEW_MERGE_STDIN_READ_FAILED_MESSAGE = "merge could not read the aggregate envelope from stdin";
45
- export declare const CE_REVIEW_MERGE_STDIN_OVERSIZED_MESSAGE = "merge input exceeds the aggregate byte cap";
46
+ export declare const CE_REVIEW_MERGE_STDIN_OVERSIZED_MESSAGE = "merge input exceeds the aggregate byte cap (16842752 bytes)";
46
47
  export declare const CE_REVIEW_MERGE_STDIN_INVALID_UTF8_MESSAGE = "merge input is not valid UTF-8";
47
48
  export declare const CE_REVIEW_MERGE_STDIN_EMPTY_MESSAGE = "merge received empty stdin";
48
49
  export declare const CE_REVIEW_MERGE_REJECTED_MESSAGE = "merge rejected the aggregate envelope";
49
50
  export declare const CE_REVIEW_FINALIZE_USAGE = "Usage: node validate-review.mjs finalize";
50
51
  export declare const CE_REVIEW_FINALIZE_STDIN_TTY_MESSAGE = "finalize reads one aggregate JSON envelope from stdin; interactive input is not supported";
51
52
  export declare const CE_REVIEW_FINALIZE_STDIN_READ_FAILED_MESSAGE = "finalize could not read the aggregate envelope from stdin";
52
- export declare const CE_REVIEW_FINALIZE_STDIN_OVERSIZED_MESSAGE = "finalize input exceeds the aggregate byte cap";
53
+ export declare const CE_REVIEW_FINALIZE_STDIN_OVERSIZED_MESSAGE = "finalize input exceeds the aggregate byte cap (16842752 bytes)";
53
54
  export declare const CE_REVIEW_FINALIZE_STDIN_INVALID_UTF8_MESSAGE = "finalize input is not valid UTF-8";
54
55
  export declare const CE_REVIEW_FINALIZE_STDIN_EMPTY_MESSAGE = "finalize received empty stdin";
55
56
  export declare const CE_REVIEW_FINALIZE_REJECTED_MESSAGE = "finalize rejected the aggregate envelope";
@@ -61,4 +62,22 @@ export interface CeReviewValidatorOptions {
61
62
  readonly outputSink?: (message: string) => void;
62
63
  readonly errorSink?: (message: string) => void;
63
64
  }
65
+ /**
66
+ * Bounded, payload-safe rejection message. A schema rejection is the fixed
67
+ * context line `<phase> rejected the aggregate envelope: <reason>`, then up
68
+ * to eight `path code` lines and `… and N more` when there are more. A domain
69
+ * rejection is one line, `<context>: <reason> at <path>`. `reason` is a
70
+ * fixed-vocabulary string from the pipeline, `path` is a safe JSON pointer,
71
+ * and `code` is a Zod issue code; never payload content or an issue message.
72
+ *
73
+ * @internal Exported for tests.
74
+ */
75
+ export declare function formatAggregateRejection(rejectedMessage: string, rejection: AggregateRejection): string;
76
+ /** A rejection the aggregate subcommands can print: a schema failure with its
77
+ * projected issues, or a domain failure with a fixed reason and a safe path. */
78
+ export type AggregateRejection = SchemaRejection<string> | {
79
+ readonly kind: 'domain';
80
+ readonly path: string;
81
+ readonly reason: string;
82
+ };
64
83
  export declare function runCeReviewValidator(options: CeReviewValidatorOptions): number;
package/dist/cli.js CHANGED
@@ -2121,6 +2121,39 @@ function formatReviewArtifactIssuePath(issuePath) {
2121
2121
  return "$";
2122
2122
  return issuePath.map((segment) => typeof segment === "number" ? String(segment) : segment).join(".");
2123
2123
  }
2124
+ var MAX_PROJECTED_ISSUE_LINES = 8;
2125
+ function projectZodIssues(issues, max = MAX_PROJECTED_ISSUE_LINES) {
2126
+ return {
2127
+ issues: issues.slice(0, max).map((issue) => ({
2128
+ path: formatReviewArtifactIssuePath(issue.path),
2129
+ code: issue.code
2130
+ })),
2131
+ total: issues.length
2132
+ };
2133
+ }
2134
+ var REVIEW_ARTIFACT_SCHEMA_RELATIVE_PATH = "skills/ce-review/references/review-summary-schema.json";
2135
+ function formatProjectedIssueLines(projected) {
2136
+ const lines = projected.issues.map((issue) => `${issue.path} ${issue.code}`);
2137
+ const omitted = projected.total - projected.issues.length;
2138
+ if (omitted > 0)
2139
+ lines.push(`\u2026 and ${omitted} more`);
2140
+ return lines;
2141
+ }
2142
+ function formatReviewArtifactValidationFailure(issues) {
2143
+ const projected = projectZodIssues(issues);
2144
+ const issueLines = formatProjectedIssueLines(projected);
2145
+ const shown = projected.issues.length;
2146
+ for (const [index, issue] of issues.slice(0, shown).entries()) {
2147
+ if (issue.code === "custom" && issue.message !== undefined) {
2148
+ issueLines[index] = `${issueLines[index]}: ${issue.message}`;
2149
+ }
2150
+ }
2151
+ return [
2152
+ `Review artifact failed schema validation: ${projected.total} issue(s)`,
2153
+ `Schema: ${REVIEW_ARTIFACT_SCHEMA_RELATIVE_PATH}`,
2154
+ ...issueLines
2155
+ ];
2156
+ }
2124
2157
  function readReviewArtifact(filePath) {
2125
2158
  let content;
2126
2159
  try {
@@ -2243,6 +2276,18 @@ var MAX_INPUT_ID_LENGTH = 128;
2243
2276
  var MAX_REASON_LENGTH = 2048;
2244
2277
  var MAX_FINDINGS = 32;
2245
2278
  var MAX_PERSONAS = 64;
2279
+ var MAX_RUN_FINDINGS = MAX_FINDINGS * MAX_PERSONAS;
2280
+ var MAX_DECISION_FACTS = MAX_FINDINGS;
2281
+ var MAX_RUN_DISAGREEMENT_FACTS = MAX_RUN_FINDINGS * (MAX_DECISION_FACTS + 1);
2282
+ var COVERAGE_BOUNDS = {
2283
+ reviewers: MAX_PERSONAS,
2284
+ validators: MAX_RUN_FINDINGS,
2285
+ residual_risks: MAX_PERSONAS * MAX_PERSONAS,
2286
+ testing_gaps: MAX_PERSONAS * MAX_PERSONAS,
2287
+ failed_reviewers: MAX_PERSONAS,
2288
+ validator_failures: MAX_RUN_FINDINGS,
2289
+ intent_uncertainty: MAX_RUN_DISAGREEMENT_FACTS
2290
+ };
2246
2291
  var REVIEW_ARTIFACT_CUSTOM_MESSAGES = [
2247
2292
  "severity count must match rejected finding count",
2248
2293
  "filtered findings require a validation reason",
@@ -2376,7 +2421,7 @@ var SynthesizedFindingFieldsSchema = object({
2376
2421
  validated: boolean().optional(),
2377
2422
  validation_reason: ReasonSchema.optional(),
2378
2423
  route_narrowing_reason: ReasonSchema.optional(),
2379
- input_finding_ids: array(boundedText(MAX_INPUT_ID_LENGTH)).min(1).max(MAX_FINDINGS),
2424
+ input_finding_ids: array(boundedText(MAX_INPUT_ID_LENGTH)).min(1).max(MAX_RUN_FINDINGS),
2380
2425
  provenance: ProvenanceSchema
2381
2426
  }).strict();
2382
2427
  var SynthesizedFindingSchema = SynthesizedFindingFieldsSchema.superRefine((finding, ctx) => {
@@ -2405,24 +2450,24 @@ var DispatchSchema = object({
2405
2450
  }
2406
2451
  });
2407
2452
  var DispositionCountsSchema = object({
2408
- surviving: number().int().nonnegative().max(MAX_FINDINGS * MAX_PERSONAS),
2409
- merged: number().int().nonnegative().max(MAX_FINDINGS * MAX_PERSONAS),
2410
- suppressed: number().int().nonnegative().max(MAX_FINDINGS * MAX_PERSONAS),
2411
- filtered: number().int().nonnegative().max(MAX_FINDINGS * MAX_PERSONAS),
2412
- rejected: number().int().nonnegative().max(MAX_FINDINGS * MAX_PERSONAS)
2453
+ surviving: number().int().nonnegative().max(MAX_RUN_FINDINGS),
2454
+ merged: number().int().nonnegative().max(MAX_RUN_FINDINGS),
2455
+ suppressed: number().int().nonnegative().max(MAX_RUN_FINDINGS),
2456
+ filtered: number().int().nonnegative().max(MAX_RUN_FINDINGS),
2457
+ rejected: number().int().nonnegative().max(MAX_RUN_FINDINGS)
2413
2458
  }).strict();
2414
2459
  var CoverageSchema = object({
2415
- reviewers: number().int().nonnegative().max(MAX_PERSONAS).optional(),
2416
- validators: number().int().nonnegative().max(MAX_PERSONAS).optional(),
2417
- residual_risks: array(ReasonSchema).max(MAX_PERSONAS),
2418
- testing_gaps: array(ReasonSchema).max(MAX_PERSONAS),
2419
- failed_reviewers: array(ReviewerSchema).max(MAX_PERSONAS),
2420
- validator_failures: array(ReasonSchema).max(MAX_PERSONAS),
2421
- intent_uncertainty: array(ReasonSchema).max(MAX_PERSONAS)
2460
+ reviewers: number().int().nonnegative().max(COVERAGE_BOUNDS.reviewers).optional(),
2461
+ validators: number().int().nonnegative().max(COVERAGE_BOUNDS.validators).optional(),
2462
+ residual_risks: array(ReasonSchema).max(COVERAGE_BOUNDS.residual_risks),
2463
+ testing_gaps: array(ReasonSchema).max(COVERAGE_BOUNDS.testing_gaps),
2464
+ failed_reviewers: array(ReviewerSchema).max(COVERAGE_BOUNDS.failed_reviewers),
2465
+ validator_failures: array(ReasonSchema).max(COVERAGE_BOUNDS.validator_failures),
2466
+ intent_uncertainty: array(ReasonSchema).max(COVERAGE_BOUNDS.intent_uncertainty)
2422
2467
  }).strict();
2423
2468
  var DeclinedMergeSchema = object({
2424
2469
  file: RepoRelativePathSchema,
2425
- input_finding_ids: array(boundedText(MAX_INPUT_ID_LENGTH)).min(2).max(MAX_FINDINGS),
2470
+ input_finding_ids: array(boundedText(MAX_INPUT_ID_LENGTH)).min(2).max(MAX_RUN_FINDINGS),
2426
2471
  reason: ReasonSchema
2427
2472
  }).strict();
2428
2473
  var ValidationSchema = object({
@@ -2485,14 +2530,14 @@ var ReviewArtifactSchema = object({
2485
2530
  verdict: boundedText(256),
2486
2531
  completed_at: CompletedAtSchema,
2487
2532
  dispatches: array(DispatchSchema).max(MAX_PERSONAS),
2488
- input_findings: array(InputFindingSchema).max(MAX_FINDINGS * MAX_PERSONAS),
2489
- findings: array(SynthesizedFindingSchema).max(MAX_FINDINGS),
2490
- declined_merges: array(DeclinedMergeSchema).max(MAX_FINDINGS).optional(),
2533
+ input_findings: array(InputFindingSchema).max(MAX_RUN_FINDINGS),
2534
+ findings: array(SynthesizedFindingSchema).max(MAX_RUN_FINDINGS),
2535
+ declined_merges: array(DeclinedMergeSchema).max(MAX_RUN_FINDINGS).optional(),
2491
2536
  risk_coverage: array(RiskCoverageSchema).max(MAX_PERSONAS).optional(),
2492
2537
  disposition_counts: DispositionCountsSchema,
2493
- applied_fixes: array(ReasonSchema).max(MAX_FINDINGS),
2494
- residual_actionable_work: array(ReasonSchema).max(MAX_FINDINGS),
2495
- advisory_outputs: array(ReasonSchema).max(MAX_FINDINGS),
2538
+ applied_fixes: array(ReasonSchema).max(MAX_RUN_FINDINGS),
2539
+ residual_actionable_work: array(ReasonSchema).max(MAX_RUN_FINDINGS),
2540
+ advisory_outputs: array(ReasonSchema).max(MAX_RUN_FINDINGS),
2496
2541
  coverage: CoverageSchema,
2497
2542
  validation: ValidationSchema.optional()
2498
2543
  }).strict().superRefine((artifact, ctx) => {
@@ -2716,7 +2761,6 @@ var ParentRecordSchema = object({
2716
2761
  import fs5 from "fs";
2717
2762
  var VALIDATE_REVIEW_RETURN_USAGE = "Usage: systematic validate-review-return";
2718
2763
  var MAX_REVIEW_RETURN_BYTES = 1024 * 1024;
2719
- var MAX_PROJECTED_ISSUE_LINES = 8;
2720
2764
  var REVIEW_RETURN_VALID_MESSAGE = "Review return is valid";
2721
2765
  var REVIEW_RETURN_EMPTY_MESSAGE = "Review return is empty";
2722
2766
  var REVIEW_RETURN_INVALID_UTF8_MESSAGE = "Review return is not valid UTF-8";
@@ -2728,11 +2772,7 @@ function validateReviewReturnValue(value) {
2728
2772
  const result = SubAgentReturnSchema.safeParse(value);
2729
2773
  if (result.success)
2730
2774
  return { ok: true };
2731
- const total = result.error.issues.length;
2732
- const issues = result.error.issues.slice(0, MAX_PROJECTED_ISSUE_LINES).map((issue) => ({
2733
- path: formatReviewArtifactIssuePath(issue.path),
2734
- code: issue.code
2735
- }));
2775
+ const { issues, total } = projectZodIssues(result.error.issues);
2736
2776
  return { issues, ok: false, total };
2737
2777
  }
2738
2778
  function formatReviewReturnValidationFailure(total) {
@@ -3236,7 +3276,6 @@ Scope:
3236
3276
  project <cwd>/.pi/agents (default)
3237
3277
  global $PI_CODING_AGENT_DIR/agents or ~/.pi/agent/agents
3238
3278
  `;
3239
- var REVIEW_ARTIFACT_SCHEMA_RELATIVE_PATH = "skills/ce-review/references/review-summary-schema.json";
3240
3279
  function defaultCapabilityRoots() {
3241
3280
  const configDir = process.env.XDG_CONFIG_HOME ? path5.join(process.env.XDG_CONFIG_HOME, "opencode") : path5.join(os2.homedir(), ".config/opencode");
3242
3281
  return {
@@ -3422,13 +3461,9 @@ function runValidateReviewArtifact(options) {
3422
3461
  }
3423
3462
  const result = ReviewArtifactSchema.safeParse(artifact.value);
3424
3463
  if (!result.success) {
3425
- for (const issue of result.error.issues) {
3426
- const issuePath = formatReviewArtifactIssuePath(issue.path);
3427
- const authoredMessage = issue.code === "custom" ? `: ${issue.message}` : "";
3428
- errorSink(`${issuePath} ${issue.code}${authoredMessage}`);
3464
+ for (const line of formatReviewArtifactValidationFailure(result.error.issues)) {
3465
+ errorSink(line);
3429
3466
  }
3430
- errorSink(`Schema: ${REVIEW_ARTIFACT_SCHEMA_RELATIVE_PATH}`);
3431
- errorSink(`Review artifact validation failed: ${result.error.issues.length} issue(s)`);
3432
3467
  return 1;
3433
3468
  }
3434
3469
  outputSink(formatReviewArtifactSuccessMessage(parsedArgs.allowOutsideArtifactRoot));
@@ -13,6 +13,72 @@ export type ReadArtifactResult = {
13
13
  readonly message: string;
14
14
  };
15
15
  export declare function formatReviewArtifactIssuePath(issuePath: readonly PropertyKey[]): string;
16
+ /** Maximum number of projected issues emitted before the total. */
17
+ export declare const MAX_PROJECTED_ISSUE_LINES = 8;
18
+ /** One bounded, payload-safe projected validation issue: a safe path and an
19
+ * issue code, never a message, a value, or an unrecognized key name. */
20
+ export interface ProjectedIssue {
21
+ readonly path: string;
22
+ readonly code: string;
23
+ }
24
+ /** The structural shape of a validation issue the projector reads. A Zod
25
+ * issue satisfies it; this module does not import Zod, so the input is typed
26
+ * by the two fields that are projected. */
27
+ export interface ProjectableIssue {
28
+ readonly path: readonly PropertyKey[];
29
+ readonly code: string;
30
+ }
31
+ export interface ProjectedIssues {
32
+ readonly issues: readonly ProjectedIssue[];
33
+ /** The full issue count, even when {@link ProjectedIssues.issues} is capped. */
34
+ readonly total: number;
35
+ }
36
+ /**
37
+ * Projects at most `max` issues to `{path, code}` pairs plus the full count.
38
+ * Only the path and the code are read, so no issue message, payload value or
39
+ * unrecognized key name can reach the projection.
40
+ */
41
+ export declare function projectZodIssues(issues: readonly ProjectableIssue[], max?: number): ProjectedIssues;
42
+ /** A payload-safe schema rejection: a fixed reason code, the first issue's
43
+ * safe path, up to {@link MAX_PROJECTED_ISSUE_LINES} projected `{path, code}`
44
+ * issues and the full issue count. Never a message, a value or an
45
+ * unrecognized key name. */
46
+ export interface SchemaRejection<Reason extends string> {
47
+ readonly kind: 'schema';
48
+ readonly path: string;
49
+ readonly reason: Reason;
50
+ readonly issues: readonly ProjectedIssue[];
51
+ readonly total: number;
52
+ }
53
+ /**
54
+ * Builds a schema rejection from a failed parse's issues. The path is the
55
+ * first issue's path, or the root `$` when there is none. Every surface that
56
+ * reports a schema failure builds it here, so that rule has one owner.
57
+ */
58
+ export declare function schemaRejection<Reason extends string>(reason: Reason, zodIssues: readonly ProjectableIssue[]): SchemaRejection<Reason>;
59
+ /** The repository-relative path of the published review-summary schema,
60
+ * named in every artifact validation failure. */
61
+ export declare const REVIEW_ARTIFACT_SCHEMA_RELATIVE_PATH = "skills/ce-review/references/review-summary-schema.json";
62
+ /** The `path code` lines of a projection, then `… and N more` when the
63
+ * projection was capped. Pure formatting: nothing but the two projected
64
+ * fields reaches a line. */
65
+ export declare function formatProjectedIssueLines(projected: ProjectedIssues): string[];
66
+ /** A validation issue as the artifact validators format it: the projected
67
+ * path and code, plus the message, which is read only for a `custom` code. */
68
+ export interface ArtifactValidationIssue extends ProjectableIssue {
69
+ readonly message?: string;
70
+ }
71
+ /**
72
+ * The lines both artifact validators print for a schema failure: a context
73
+ * line that carries the full issue count, the published schema's path, up to
74
+ * {@link MAX_PROJECTED_ISSUE_LINES} `path code` lines, then `… and N more`.
75
+ *
76
+ * A `custom` issue keeps its message. Those messages are the closed,
77
+ * author-written set in `REVIEW_ARTIFACT_CUSTOM_MESSAGES`
78
+ * (`tests/unit/review-artifact-schema.test.ts` enforces it), never text
79
+ * derived from the payload. Every other issue's message is dropped.
80
+ */
81
+ export declare function formatReviewArtifactValidationFailure(issues: readonly ArtifactValidationIssue[]): string[];
16
82
  export declare function readReviewArtifact(filePath: string): ReadArtifactResult;
17
83
  export declare function isLegacyReviewArtifact(value: unknown): boolean;
18
84
  export declare function hasParentDirectoryTraversal(input: string): boolean;
@@ -3,6 +3,18 @@ export declare const MAX_INPUT_ID_LENGTH = 128;
3
3
  export declare const MAX_REASON_LENGTH = 2048;
4
4
  export declare const MAX_FINDINGS = 32;
5
5
  export declare const MAX_PERSONAS = 64;
6
+ export declare const MAX_RUN_FINDINGS: number;
7
+ export declare const MAX_DECISION_FACTS = 32;
8
+ export declare const MAX_RUN_DISAGREEMENT_FACTS: number;
9
+ export declare const COVERAGE_BOUNDS: {
10
+ readonly reviewers: 64;
11
+ readonly validators: number;
12
+ readonly residual_risks: number;
13
+ readonly testing_gaps: number;
14
+ readonly failed_reviewers: 64;
15
+ readonly validator_failures: number;
16
+ readonly intent_uncertainty: number;
17
+ };
6
18
  export declare const REVIEW_ARTIFACT_CUSTOM_MESSAGES: readonly ['severity count must match rejected finding count', 'filtered findings require a validation reason', 'risk-critical dispatches require a non-empty selection surface', 'satisfied risk coverage requires a citing input finding ID', 'unsatisfied risk coverage must not cite an input finding ID', 'passed validation must not include a reason; non-passed validation requires a reason', 'validation_unavailable dispatches must record zero input findings', 'a completed run must not contain validation_unavailable evidence', 'a validation_unavailable persona must not have an input finding', 'every synthesized input finding ID must resolve to an admitted ledger row', 'every provenance submitter must be represented by a cited admitted ledger row', 'satisfied risk coverage must cite an admitted ledger row', 'duplicate admitted input finding IDs are not allowed', 'every cited admitted reviewer must appear in provenance.submitters', 'provenance.submitters must not contain duplicate reviewers', 'provenance.agreement_credit must not contain duplicate reviewers', 'provenance.agreement_credit must not overlap provenance.submitters', 'provenance.agreement_credit requires an eligible returned persona with admitted evidence', 'satisfied risk coverage must cite an admitted ledger row owned by another persona'];
7
19
  export declare const DispatchOutcomeSchema: z.ZodEnum<{
8
20
  empty: "empty";
@@ -1,4 +1,5 @@
1
1
  import type { z } from 'zod';
2
+ import { type SchemaRejection } from './review-artifact-path.js';
2
3
  import type { HarnessSchema } from './review-artifact-schema.js';
3
4
  import { type AdjudicationEnvelopeSchema, type FinalizeInputSchema, FinalizeOutputSchema, MergeOutputSchema, type PipelineRoute, type PlanAssessmentEnvelopeSchema, PrepareOutputSchema, ScreenOutputSchema, type ValidatorLifecycleResultsSchema } from './review-pipeline-contract.js';
4
5
  /**
@@ -47,13 +48,19 @@ export type PrepareOutput = ReturnType<typeof PrepareOutputSchema.parse>;
47
48
  export interface PrepareReviewCandidatesInput {
48
49
  readonly raw_input: unknown;
49
50
  }
50
- type PrepareRejectReason = 'aggregate payload exceeds byte cap' | 'malformed JSON' | 'schema validation' | 'duplicate persona outcome' | 'duplicate input id' | 'unselected persona screen result' | 'missing screen result for selected dispatch';
51
- /** One bounded, payload-safe rejection diagnostic: a fixed reason code and a
52
- * safe JSON path only. Never payload content, never exception text. */
53
- export interface PrepareRejection {
51
+ type PrepareRejectReason = `aggregate payload exceeds the byte cap (${number} bytes)` | 'malformed JSON' | 'schema validation' | 'prepare output failed schema validation' | 'duplicate persona outcome' | 'duplicate input id' | 'unselected persona screen result' | 'missing screen result for selected dispatch';
52
+ type PrepareSchemaReason = 'schema validation' | 'prepare output failed schema validation';
53
+ type PrepareDomainReason = Exclude<PrepareRejectReason, PrepareSchemaReason>;
54
+ export type { SchemaRejection };
55
+ /** A domain rejection: a fixed reason code and a safe JSON path only. */
56
+ interface DomainRejection<Reason extends string> {
57
+ readonly kind: 'domain';
54
58
  readonly path: string;
55
- readonly reason: PrepareRejectReason;
59
+ readonly reason: Reason;
56
60
  }
61
+ /** One bounded, payload-safe rejection diagnostic. Never payload content,
62
+ * never exception text. */
63
+ export type PrepareRejection = DomainRejection<PrepareDomainReason> | SchemaRejection<PrepareSchemaReason>;
57
64
  export type PrepareReviewCandidatesResult = {
58
65
  readonly ok: true;
59
66
  readonly value: PrepareOutput;
@@ -102,11 +109,12 @@ export interface ValidatedAdjudication {
102
109
  readonly declined: readonly ValidatedDeclinedSingleton[];
103
110
  readonly singletons: readonly string[];
104
111
  }
105
- type AdjudicationRejectReason = 'unknown input id' | 'suppressed input id' | 'duplicate input id citation' | 'omitted eligible input id' | 'cross-group input id citation' | 'representative line mismatch' | 'unexpected decisions for empty candidate set' | 'duplicate merged group decision id' | 'duplicate declined decision id' | 'duplicate passthrough singleton input id' | 'declined decision id collides with merged group decision id' | 'declined decision id collides with passthrough singleton input id' | 'passthrough singleton input id collides with merged group decision id';
112
+ type AdjudicationRejectReason = 'unknown input id' | 'suppressed input id' | 'duplicate input id citation' | 'omitted eligible input id' | 'cross-group input id citation' | 'representative line mismatch' | 'unexpected decisions for empty candidate set' | 'duplicate merged group decision id' | 'duplicate declined decision id' | 'duplicate passthrough singleton input id' | 'declined decision id collides with merged group decision id' | 'declined decision id collides with passthrough singleton input id' | 'passthrough singleton input id collides with merged group decision id' | 'prepared survivor missing for input id' | 'prepared survivor missing from the partition' | 'duplicate prepared survivor input id' | 'duplicate candidate group member' | 'singleton input id is also a candidate group member';
106
113
  /** One bounded, payload-safe rejection diagnostic: a fixed reason code and a
107
114
  * safe JSON path only. Never payload content, never a finding title, never
108
115
  * exception text. */
109
116
  export interface AdjudicationRejection {
117
+ readonly kind: 'domain';
110
118
  readonly path: string;
111
119
  readonly reason: AdjudicationRejectReason;
112
120
  }
@@ -182,6 +190,7 @@ type MergedFindingRejectReason = 'route widening' | 'route narrowing missing rea
182
190
  * safe JSON path only. Never payload content, never a finding title, never
183
191
  * exception text. */
184
192
  export interface MergedFindingRejection {
193
+ readonly kind: 'domain';
185
194
  readonly path: string;
186
195
  readonly reason: MergedFindingRejectReason;
187
196
  }
@@ -215,7 +224,7 @@ export type ApplyReviewAdjudicationResult = {
215
224
  readonly value: MergeOutput;
216
225
  } | {
217
226
  readonly ok: false;
218
- readonly rejection: AdjudicationRejection | MergedFindingRejection;
227
+ readonly rejection: AdjudicationRejection | MergedFindingRejection | SchemaRejection<'merge output failed schema validation'>;
219
228
  };
220
229
  /**
221
230
  * The top-level merge phase: validates the adjudication partition, derives
@@ -281,6 +290,7 @@ type ReconcileValidatorResultsRejectReason = 'missing validator result' | 'dupli
281
290
  /** One bounded, payload-safe rejection diagnostic: a fixed reason code and a
282
291
  * safe JSON path only. Never payload content, never a finding title. */
283
292
  export interface ReconcileValidatorResultsRejection {
293
+ readonly kind: 'domain';
284
294
  readonly path: string;
285
295
  readonly reason: ReconcileValidatorResultsRejectReason;
286
296
  }
@@ -326,8 +336,9 @@ export interface FinalizeContext {
326
336
  readonly rejected_payloads: readonly RejectedPayloadWeight[];
327
337
  readonly lost_risk_critical_personas: readonly LostRiskCriticalPersona[];
328
338
  }
329
- type FinalizeContextRejectReason = 'duplicate merged finding ID' | 'merged finding references unknown survivor' | 'survivor missing from merge inputs' | 'survivor claimed by multiple merged findings' | 'validator request references unknown merged finding' | 'dispatch record mismatch' | 'duplicate selection surface entry' | 'screen result missing for selected persona' | 'unexpected screen result for persona' | 'screen result outcome does not match dispatch record' | 'merged finding fields diverge from derivation' | 'merged finding route narrowing reason mismatch' | 'confidence disposition references unscreened finding' | 'merged finding cites input from unavailable reviewer' | 'merged finding submitter not a cited reviewer' | 'merged finding agreement credit overlaps submitters' | 'surviving finding diverges from its screened finding' | 'surviving finding references unscreened input' | 'duplicate confidence disposition' | 'validation must be not_attempted at finalize';
339
+ type FinalizeContextRejectReason = 'duplicate merged finding ID' | 'merged finding references unknown survivor' | 'survivor missing from merge inputs' | 'survivor claimed by multiple merged findings' | 'validator request references unknown merged finding' | 'dispatch record mismatch' | 'duplicate selection surface entry' | 'screen result missing for selected persona' | 'unexpected screen result for persona' | 'screen result outcome does not match dispatch record' | 'merged finding fields diverge from derivation' | 'merged finding route narrowing reason mismatch' | 'confidence disposition references unscreened finding' | 'merged finding cites input from unavailable reviewer' | 'merged finding submitter not a cited reviewer' | 'merged finding agreement credit overlaps submitters' | 'surviving finding diverges from its screened finding' | 'surviving finding references unscreened input' | 'duplicate confidence disposition' | 'screened finding lacks exactly one confidence disposition' | 'validation must be not_attempted at finalize';
330
340
  export interface FinalizeContextRejection {
341
+ readonly kind: 'domain';
331
342
  readonly path: string;
332
343
  readonly reason: FinalizeContextRejectReason;
333
344
  }
@@ -443,6 +454,7 @@ export interface FinalizeReviewDispositionsOutput {
443
454
  }
444
455
  type FinalizeReviewDispositionsRejectReason = 'survivor missing from merged findings';
445
456
  export interface FinalizeReviewDispositionsRejection {
457
+ readonly kind: 'domain';
446
458
  readonly path: string;
447
459
  readonly reason: FinalizeReviewDispositionsRejectReason;
448
460
  }
@@ -656,6 +668,7 @@ export interface ReviewCoverageSummary {
656
668
  }
657
669
  type BuildReviewCoverageRejectReason = 'coverage array exceeds bound';
658
670
  export interface BuildReviewCoverageRejection {
671
+ readonly kind: 'domain';
659
672
  readonly path: string;
660
673
  readonly reason: BuildReviewCoverageRejectReason;
661
674
  }
@@ -673,7 +686,7 @@ export type BuildReviewCoverageResult = {
673
686
  * `never_returned`, or `validation_unavailable`; the disproving reasons for
674
687
  * every requested validator that never answered; and the merge phase's
675
688
  * disagreement facts, carried through unchanged. Every array is checked
676
- * against `MAX_PERSONAS` before assembly -- an overflow rejects rather than
689
+ * against `COVERAGE_BOUNDS` before assembly -- an overflow rejects rather than
677
690
  * silently truncating. Never reads `process.env`, the filesystem, or the
678
691
  * clock.
679
692
  */
@@ -719,13 +732,7 @@ export interface ProjectSynthesizedFindingsInput {
719
732
  export declare function projectSynthesizedFindings(input: ProjectSynthesizedFindingsInput): readonly SynthesizedFindingProjection[];
720
733
  export type FinalizeReviewInput = FinalizeInputValue;
721
734
  type FinalizeOutputValue = ReturnType<typeof FinalizeOutputSchema.parse>;
722
- type FinalizeReviewRejection = FinalizeContextRejection | ReconcileValidatorResultsRejection | FinalizeReviewDispositionsRejection | BuildReviewCoverageRejection | RiskCoverageSemanticsRejection | DispositionLedgerReconciliationRejection | {
723
- readonly path: string;
724
- readonly reason: 'artifact failed schema validation';
725
- } | {
726
- readonly path: string;
727
- readonly reason: 'finalize output failed schema validation';
728
- };
735
+ type FinalizeReviewRejection = FinalizeContextRejection | ReconcileValidatorResultsRejection | FinalizeReviewDispositionsRejection | BuildReviewCoverageRejection | RiskCoverageSemanticsRejection | DispositionLedgerReconciliationRejection | SchemaRejection<'artifact failed schema validation'> | SchemaRejection<'finalize output failed schema validation'>;
729
736
  export type FinalizeReviewResult = {
730
737
  readonly ok: true;
731
738
  readonly value: FinalizeOutputValue;
@@ -752,6 +759,7 @@ interface RiskCoverageSemanticsInput {
752
759
  readonly risk_coverage?: readonly ArtifactRiskCoverageEntry[];
753
760
  }
754
761
  interface RiskCoverageSemanticsRejection {
762
+ readonly kind: 'domain';
755
763
  readonly path: string;
756
764
  readonly reason: 'satisfied risk coverage must cite a validated finding on the lost persona selection surface';
757
765
  }
@@ -778,6 +786,7 @@ type RiskCoverageSemanticsResult = {
778
786
  */
779
787
  export declare function checkRiskCoverageSemantics(artifactCandidate: RiskCoverageSemanticsInput): RiskCoverageSemanticsResult;
780
788
  interface DispositionLedgerReconciliationRejection {
789
+ readonly kind: 'domain';
781
790
  readonly path: string;
782
791
  readonly reason: 'disposition counts do not reconcile with the admitted input ledger';
783
792
  }
@@ -816,4 +825,3 @@ export declare function checkDispositionCountsReconcileLedger(dispositionCounts:
816
825
  * partial output. Never reads `process.env`, the filesystem, or the clock.
817
826
  */
818
827
  export declare function finalizeReview(input: FinalizeReviewInput): FinalizeReviewResult;
819
- export {};
@@ -1,3 +1,4 @@
1
+ import { MAX_PROJECTED_ISSUE_LINES, type ProjectedIssue } from './review-artifact-path.js';
1
2
  /**
2
3
  * Bounded, no-write structural validator for a single raw `ce:review` persona
3
4
  * return read from stdin.
@@ -10,8 +11,7 @@
10
11
  export declare const VALIDATE_REVIEW_RETURN_USAGE = "Usage: systematic validate-review-return";
11
12
  /** Input cap in bytes. Reads stop at {@link MAX_REVIEW_RETURN_BYTES} plus one. */
12
13
  export declare const MAX_REVIEW_RETURN_BYTES: number;
13
- /** Maximum number of projected issue lines emitted before the summary. */
14
- export declare const MAX_PROJECTED_ISSUE_LINES = 8;
14
+ export { MAX_PROJECTED_ISSUE_LINES };
15
15
  export declare const REVIEW_RETURN_VALID_MESSAGE = "Review return is valid";
16
16
  export declare const REVIEW_RETURN_EMPTY_MESSAGE = "Review return is empty";
17
17
  export declare const REVIEW_RETURN_INVALID_UTF8_MESSAGE = "Review return is not valid UTF-8";
@@ -20,10 +20,7 @@ export declare const REVIEW_RETURN_OVERSIZED_MESSAGE = "Review return exceeds th
20
20
  export declare const REVIEW_RETURN_READ_FAILED_MESSAGE = "Review return could not be read from stdin";
21
21
  export declare const REVIEW_RETURN_TTY_MESSAGE = "validate-review-return reads one JSON document from stdin; interactive input is not supported";
22
22
  /** One bounded, payload-safe projected validation issue. */
23
- export interface ReviewReturnIssue {
24
- readonly path: string;
25
- readonly code: string;
26
- }
23
+ export type ReviewReturnIssue = ProjectedIssue;
27
24
  export type ReviewReturnValidation = {
28
25
  readonly ok: true;
29
26
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fro.bot/systematic",
3
- "version": "3.25.1",
3
+ "version": "3.25.2",
4
4
  "description": "Compound-engineering loops for OpenCode, Pi, and Claude Code",
5
5
  "type": "module",
6
6
  "homepage": "https://fro.bot/systematic",
@@ -520,8 +520,8 @@ A helper failure (`prepare` or `merge` exiting 1 or 2) is never permission to ha
520
520
 
521
521
  Dispatch validators for exactly the findings `merge`'s `validator_requests` names -- the P0/P1-or-`requires_verification` gating band is already computed; Stage 5b no longer identifies the gated set by hand.
522
522
 
523
- 1. For each entry in `validator_requests`, spawn one validator subagent in parallel using the validator template at `references/validator-template.md`. Look up that finding's full fields (title, why_it_matters, evidence, file, line, severity, autofix_class, owner, suggested_fix) from `merge`'s `merged_findings` by `finding_id`, and pass them along with the intent summary, file list, and full diff.
524
- 2. Collect `{outcome: 'true'|'false'|'failed'|'unavailable', reason?}` from each validator, keyed by `finding_id`. `outcome: 'true'` needs no reason; the other three outcomes each require one.
523
+ 1. For each entry in `validator_requests`, spawn one validator subagent in parallel with the others in its batch, using the validator template at `references/validator-template.md`. Dispatch in bounded batches, sized to what the harness handles reliably. Each batch runs in parallel and finishes before the next starts. Look up that finding's full fields (title, why_it_matters, evidence, file, line, severity, autofix_class, owner, suggested_fix) from `merge`'s `merged_findings` by `finding_id`, and pass them along with the intent summary, file list, and full diff.
524
+ 2. Collect `{outcome: 'true'|'false'|'failed'|'unavailable', reason?}` from each validator, keyed by `finding_id`. `outcome: 'true'` needs no reason; the other three outcomes each require one. Every request needs a result: a subagent that returns nothing, or an answer that is not one of these outcomes, is recorded as `unavailable` with a reason.
525
525
  3. Carry every result forward as `validator_lifecycle_results` into `finalize` (Stage 6). Do not reconcile filtered findings, update ledger dispositions, or recompute the "Filtered (not validated)" group by hand -- `finalize` derives all of it from these results plus `merge`'s output.
526
526
 
527
527
  **Outcome semantics** (enforced by `finalize`, not the model): `true` validates the finding -- it flows to Stage 6 unchanged. `false` filters the finding -- it drops out of the surviving/actioned set, receives disposition `filtered` with the validator's exact one-sentence reason, and appears in the "Filtered (not validated)" group. `failed` and `unavailable` leave the finding actionable and unvalidated (no `validated` annotation; it appears in the normal severity tables) but each records a lifecycle failure that marks the run `degraded` and blocks a clean verdict -- report the failed/unavailable validator in Coverage rather than silently treating it as validated.
@@ -23,10 +23,45 @@ exit 2 is a launch failure, not a payload problem. On exit 1 (the input
23
23
  was structurally rejected), the parent may correct its own JSON envelope
24
24
  exactly once -- fixing a genuine encoding mistake, never reshaping the
25
25
  envelope to force acceptance -- and retry; a second exit 1 stops the run
26
- visibly with degraded or abnormal status. Never fall back to writing a
26
+ visibly with degraded or abnormal status. An exit 1 whose message says the
27
+ input exceeds the aggregate byte cap is not an encoding mistake: do not retry
28
+ the same bytes, and do not shrink the payload to fit. Stop visibly and report
29
+ the cap the message names. Never fall back to writing a
27
30
  finding, a merged finding, a queue, a disposition count, or a report section
28
31
  by hand because a phase call failed.
29
32
 
33
+ ## Rejection output
34
+
35
+ An exit 1 from `prepare`, `merge` or `finalize` prints one of four shapes on
36
+ stderr:
37
+
38
+ - **Schema rejection.** `<phase> rejected the aggregate envelope: <reason>`,
39
+ then up to eight `path code` lines, then `… and N more` when more issues
40
+ were found.
41
+ - **Rejection of the content.** One line,
42
+ `<phase> rejected the aggregate envelope: <reason> at <path>`. Malformed JSON
43
+ is this shape too, with the reason `malformed JSON` and the path `$`.
44
+ - **Byte cap.** One bare line, `<phase> input exceeds the aggregate byte cap
45
+ (16842752 bytes)`. It names the cap and carries no reason or path.
46
+ - **Invalid UTF-8.** One bare line, `<phase> input is not valid UTF-8`.
47
+
48
+ `path` points into the envelope and `code` is a schema issue code. No payload
49
+ value, key name or issue message is printed, so the lines are safe to quote
50
+ in Coverage and are enough to locate the field to correct.
51
+
52
+ The artifact validators (`artifact` here, `validate-review-artifact` in the
53
+ CLI) print `Review artifact failed schema validation: N issue(s)` with the full
54
+ issue count, a `Schema:` line, and the same bounded `path code` lines, then
55
+ `… and N more` when more were found. An issue the schema authors wrote a
56
+ message for (a `custom` issue) carries that one authored message after its
57
+ code, as `path custom: <message>`; no other issue prints a message.
58
+
59
+ Validators installed before the run-level limits were raised reject artifacts
60
+ with more than 32 findings or other run-level entries. Schema version 1 is
61
+ unchanged, so an older artifact still validates. If an older external
62
+ validator rejects a large artifact on a count, that is a version mismatch to
63
+ report, not a malformed artifact: update the validator.
64
+
30
65
  ## screen
31
66
 
32
67
  Structurally admits one persona's raw return and binds it to the dispatched
@@ -7,7 +7,7 @@
7
7
  "type": "object",
8
8
  "properties": {
9
9
  "decisions": {
10
- "maxItems": 32,
10
+ "maxItems": 2048,
11
11
  "type": "array",
12
12
  "items": {
13
13
  "oneOf": [
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "input_finding_ids": {
28
28
  "minItems": 2,
29
- "maxItems": 32,
29
+ "maxItems": 2048,
30
30
  "type": "array",
31
31
  "items": {
32
32
  "type": "string",
@@ -363,7 +363,7 @@
363
363
  "pattern": "\\S"
364
364
  },
365
365
  "results": {
366
- "maxItems": 32,
366
+ "maxItems": 2048,
367
367
  "type": "array",
368
368
  "items": {
369
369
  "type": "object",