@fro.bot/systematic 3.18.6 → 3.18.8

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/cli.js CHANGED
@@ -2317,6 +2317,7 @@ var SynthesizedFindingFieldsSchema = object({
2317
2317
  suggested_fix: string().max(2048).nullable().optional(),
2318
2318
  validated: boolean().optional(),
2319
2319
  validation_reason: ReasonSchema.optional(),
2320
+ route_narrowing_reason: ReasonSchema.optional(),
2320
2321
  input_finding_ids: array(boundedText(MAX_INPUT_ID_LENGTH)).min(1).max(MAX_FINDINGS),
2321
2322
  provenance: ProvenanceSchema
2322
2323
  }).strict();
@@ -3498,10 +3499,10 @@ function printResolvedSection() {
3498
3499
  let loaded;
3499
3500
  try {
3500
3501
  loaded = loadConfigWithSources(process.cwd());
3501
- } catch {
3502
- console.log(`
3503
- Resolved configuration: unavailable (the configuration failed to load).`);
3504
- return;
3502
+ } catch (error) {
3503
+ console.error("Resolved configuration: unavailable (the configuration failed to load).");
3504
+ console.error(` Reason: ${error instanceof Error ? error.message : String(error)}`);
3505
+ return false;
3505
3506
  }
3506
3507
  const { metadata, overlays } = loaded;
3507
3508
  const hasProfileSelection = metadata.activeProfile !== null || metadata.profileSelectorSource !== null;
@@ -3510,12 +3511,13 @@ Resolved configuration: unavailable (the configuration failed to load).`);
3510
3511
  Resolved configuration:`);
3511
3512
  if (!hasProfileSelection && !hasOverlays) {
3512
3513
  console.log(" No profiles are selected and no per-agent/category overlays are defined.");
3513
- return;
3514
+ return true;
3514
3515
  }
3515
3516
  printProfileSummary(metadata);
3516
3517
  console.log("");
3517
3518
  console.log(" Routing:");
3518
3519
  printRoutingTable(loaded);
3520
+ return true;
3519
3521
  }
3520
3522
  function toJsonRoutingResolution(resolution) {
3521
3523
  return {
@@ -3587,7 +3589,8 @@ Project configuration:`);
3587
3589
  User configuration:`);
3588
3590
  console.log(fs7.readFileSync(paths.userConfig, "utf-8"));
3589
3591
  }
3590
- printResolvedSection();
3592
+ if (!printResolvedSection())
3593
+ process.exit(1);
3591
3594
  }
3592
3595
  function parseConfigShowArgs(rest) {
3593
3596
  let json = false;
@@ -104,6 +104,7 @@ declare const SynthesizedFindingFieldsSchema: z.ZodObject<{
104
104
  suggested_fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
105
105
  validated: z.ZodOptional<z.ZodBoolean>;
106
106
  validation_reason: z.ZodOptional<z.ZodString>;
107
+ route_narrowing_reason: z.ZodOptional<z.ZodString>;
107
108
  input_finding_ids: z.ZodArray<z.ZodString>;
108
109
  provenance: z.ZodObject<{
109
110
  fingerprint: z.ZodString;
@@ -208,6 +209,7 @@ export declare const ReviewArtifactSchema: z.ZodObject<{
208
209
  suggested_fix?: string | null | undefined;
209
210
  validated?: boolean | undefined;
210
211
  validation_reason?: string | undefined;
212
+ route_narrowing_reason?: string | undefined;
211
213
  input_finding_ids: string[];
212
214
  provenance: {
213
215
  fingerprint: string;
@@ -232,6 +234,7 @@ export declare const ReviewArtifactSchema: z.ZodObject<{
232
234
  suggested_fix?: string | null | undefined;
233
235
  validated?: boolean | undefined;
234
236
  validation_reason?: string | undefined;
237
+ route_narrowing_reason?: string | undefined;
235
238
  input_finding_ids: string[];
236
239
  provenance: {
237
240
  fingerprint: string;
@@ -526,6 +526,7 @@ export declare const MergeOutputSchema: z.ZodObject<{
526
526
  pre_existing: z.ZodBoolean;
527
527
  fingerprint: z.ZodString;
528
528
  submitters: z.ZodArray<z.ZodString>;
529
+ route_narrowing_reason: z.ZodOptional<z.ZodString>;
529
530
  }, z.core.$strict>>;
530
531
  validator_requests: z.ZodArray<z.ZodObject<{
531
532
  finding_id: z.ZodString;
@@ -651,6 +652,7 @@ export declare const FinalizeInputSchema: z.ZodObject<{
651
652
  pre_existing: z.ZodBoolean;
652
653
  fingerprint: z.ZodString;
653
654
  submitters: z.ZodArray<z.ZodString>;
655
+ route_narrowing_reason: z.ZodOptional<z.ZodString>;
654
656
  }, z.core.$strict>>;
655
657
  validator_requests: z.ZodArray<z.ZodObject<{
656
658
  finding_id: z.ZodString;
@@ -966,6 +968,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
966
968
  suggested_fix?: string | null | undefined;
967
969
  validated?: boolean | undefined;
968
970
  validation_reason?: string | undefined;
971
+ route_narrowing_reason?: string | undefined;
969
972
  input_finding_ids: string[];
970
973
  provenance: {
971
974
  fingerprint: string;
@@ -996,6 +999,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
996
999
  suggested_fix?: string | null | undefined;
997
1000
  validated?: boolean | undefined;
998
1001
  validation_reason?: string | undefined;
1002
+ route_narrowing_reason?: string | undefined;
999
1003
  input_finding_ids: string[];
1000
1004
  provenance: {
1001
1005
  fingerprint: string;
@@ -1020,6 +1024,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
1020
1024
  suggested_fix?: string | null | undefined;
1021
1025
  validated?: boolean | undefined;
1022
1026
  validation_reason?: string | undefined;
1027
+ route_narrowing_reason?: string | undefined;
1023
1028
  input_finding_ids: string[];
1024
1029
  provenance: {
1025
1030
  fingerprint: string;
@@ -1050,6 +1055,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
1050
1055
  suggested_fix?: string | null | undefined;
1051
1056
  validated?: boolean | undefined;
1052
1057
  validation_reason?: string | undefined;
1058
+ route_narrowing_reason?: string | undefined;
1053
1059
  input_finding_ids: string[];
1054
1060
  provenance: {
1055
1061
  fingerprint: string;
@@ -1122,6 +1128,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
1122
1128
  suggested_fix?: string | null | undefined;
1123
1129
  validated?: boolean | undefined;
1124
1130
  validation_reason?: string | undefined;
1131
+ route_narrowing_reason?: string | undefined;
1125
1132
  input_finding_ids: string[];
1126
1133
  provenance: {
1127
1134
  fingerprint: string;
@@ -1152,6 +1159,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
1152
1159
  suggested_fix?: string | null | undefined;
1153
1160
  validated?: boolean | undefined;
1154
1161
  validation_reason?: string | undefined;
1162
+ route_narrowing_reason?: string | undefined;
1155
1163
  input_finding_ids: string[];
1156
1164
  provenance: {
1157
1165
  fingerprint: string;
@@ -1176,6 +1184,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
1176
1184
  suggested_fix?: string | null | undefined;
1177
1185
  validated?: boolean | undefined;
1178
1186
  validation_reason?: string | undefined;
1187
+ route_narrowing_reason?: string | undefined;
1179
1188
  input_finding_ids: string[];
1180
1189
  provenance: {
1181
1190
  fingerprint: string;
@@ -1206,6 +1215,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
1206
1215
  suggested_fix?: string | null | undefined;
1207
1216
  validated?: boolean | undefined;
1208
1217
  validation_reason?: string | undefined;
1218
+ route_narrowing_reason?: string | undefined;
1209
1219
  input_finding_ids: string[];
1210
1220
  provenance: {
1211
1221
  fingerprint: string;
@@ -1292,6 +1302,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
1292
1302
  suggested_fix?: string | null | undefined;
1293
1303
  validated?: boolean | undefined;
1294
1304
  validation_reason?: string | undefined;
1305
+ route_narrowing_reason?: string | undefined;
1295
1306
  input_finding_ids: string[];
1296
1307
  provenance: {
1297
1308
  fingerprint: string;
@@ -1322,6 +1333,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
1322
1333
  suggested_fix?: string | null | undefined;
1323
1334
  validated?: boolean | undefined;
1324
1335
  validation_reason?: string | undefined;
1336
+ route_narrowing_reason?: string | undefined;
1325
1337
  input_finding_ids: string[];
1326
1338
  provenance: {
1327
1339
  fingerprint: string;
@@ -1346,6 +1358,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
1346
1358
  suggested_fix?: string | null | undefined;
1347
1359
  validated?: boolean | undefined;
1348
1360
  validation_reason?: string | undefined;
1361
+ route_narrowing_reason?: string | undefined;
1349
1362
  input_finding_ids: string[];
1350
1363
  provenance: {
1351
1364
  fingerprint: string;
@@ -1376,6 +1389,7 @@ export declare const FinalizeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
1376
1389
  suggested_fix?: string | null | undefined;
1377
1390
  validated?: boolean | undefined;
1378
1391
  validation_reason?: string | undefined;
1392
+ route_narrowing_reason?: string | undefined;
1379
1393
  input_finding_ids: string[];
1380
1394
  provenance: {
1381
1395
  fingerprint: string;
@@ -170,6 +170,12 @@ export interface DerivedMergedFindingFields {
170
170
  readonly pre_existing: boolean;
171
171
  readonly fingerprint: string;
172
172
  readonly route: PipelineRoute;
173
+ /** Whether `route` actually differs from the route meet computed over
174
+ * `contributing` -- true only for a genuine narrowing, never merely
175
+ * because the model supplied a `proposed_route`. Assembly uses this,
176
+ * rather than presence of a proposal, to decide whether
177
+ * `route_narrowing_reason` belongs on the wire. */
178
+ readonly route_differs_from_meet: boolean;
173
179
  }
174
180
  type MergedFindingRejectReason = 'route widening' | 'route narrowing missing reason' | 'duplicate agreement credit reviewer' | 'agreement credit reviewer already a submitter' | 'agreement credit reviewer did not return';
175
181
  /** One bounded, payload-safe rejection diagnostic: a fixed reason code and a
@@ -320,7 +326,7 @@ export interface FinalizeContext {
320
326
  readonly rejected_payloads: readonly RejectedPayloadWeight[];
321
327
  readonly lost_risk_critical_personas: readonly LostRiskCriticalPersona[];
322
328
  }
323
- 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' | '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';
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';
324
330
  export interface FinalizeContextRejection {
325
331
  readonly path: string;
326
332
  readonly reason: FinalizeContextRejectReason;
@@ -692,6 +698,7 @@ export interface SynthesizedFindingProjection {
692
698
  readonly suggested_fix?: ReconciledFinding['suggested_fix'];
693
699
  readonly validated?: boolean;
694
700
  readonly validation_reason?: string;
701
+ readonly route_narrowing_reason?: string;
695
702
  readonly input_finding_ids: readonly string[];
696
703
  readonly provenance: SynthesizedFindingProvenanceProjection;
697
704
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fro.bot/systematic",
3
- "version": "3.18.6",
3
+ "version": "3.18.8",
4
4
  "description": "Compound-engineering loops for OpenCode, Pi, and Claude Code",
5
5
  "type": "module",
6
6
  "homepage": "https://fro.bot/systematic",
@@ -99,8 +99,8 @@
99
99
  "devDependencies": {
100
100
  "@biomejs/biome": "2.5.13",
101
101
  "@earendil-works/pi-coding-agent": "0.83.0",
102
- "@opencode-ai/plugin": "1.18.30",
103
- "@opencode-ai/sdk": "1.18.30",
102
+ "@opencode-ai/plugin": "1.18.31",
103
+ "@opencode-ai/sdk": "1.18.31",
104
104
  "@semantic-release/exec": "7.1.0",
105
105
  "@tintinweb/pi-subagents": "0.14.3",
106
106
  "@types/bun": "latest",
@@ -114,7 +114,7 @@
114
114
  "rimraf": "6.1.3",
115
115
  "semantic-release": "25.0.9",
116
116
  "semantic-release-export-data": "1.2.0",
117
- "typebox": "1.3.30",
117
+ "typebox": "1.3.31",
118
118
  "typescript": "7.0.2"
119
119
  },
120
120
  "dependencies": {
@@ -138,14 +138,32 @@ supplies the arithmetic and the narrowing rule.
138
138
  **Input:** `{ prepared:<prepare output>, adjudication:<model envelope with decisions[]> }`.
139
139
  Build one `decisions[]` entry for every candidate-group member: a `merged`
140
140
  decision citing 2+ input IDs from the same group with the merged finding's
141
- `title`, `why_it_matters`, `evidence`, `line`, `proposed_route` (when the
142
- merge's route should narrow), `route_narrowing_reason` (required whenever
143
- `proposed_route` is present), and optional `disagreement_facts` and
144
- `eligible_agreement_credit`; or a `declined` decision citing exactly one
145
- input ID with a `declined_reason` explaining why it stays a separate defect.
146
- Every candidate-group member must be cited by exactly one decision -- no
147
- omissions, no double-citations. `prepare`'s true singletons need no decision
148
- at all.
141
+ `title`, `why_it_matters`, `evidence`, `line`, an optional `proposed_route`,
142
+ `route_narrowing_reason` (required whenever `proposed_route` is present),
143
+ and optional `disagreement_facts` and `eligible_agreement_credit`; or a
144
+ `declined` decision citing exactly one input ID with a `declined_reason`
145
+ explaining why it stays a separate defect. Every candidate-group member must
146
+ be cited by exactly one decision -- no omissions, no double-citations.
147
+ `prepare`'s true singletons need no decision at all.
148
+
149
+ Omit `proposed_route` unless the route genuinely narrows: strictly narrower
150
+ than every contributing finding's own route, per the authored
151
+ narrows-only transitions (`autofix_class`, `owner`, `requires_verification`
152
+ each only ever narrow, never widen). A proposal that turns out to equal the
153
+ resolved route meet over the group's contributors -- for example, proposing
154
+ `owner: 'release'` for a group whose members are already routed to
155
+ incomparable owners whose meet is `release` -- is accepted, not rejected;
156
+ the merge phase simply carries no reason forward for it, since
157
+ `route_narrowing_reason` is defined for the pipeline's route-narrowing
158
+ provenance, not for every proposal a model happens to submit. A proposal
159
+ that genuinely widens the route (or is incomparable to it) is rejected.
160
+
161
+ The pairing between a merged finding's carried route and its
162
+ `route_narrowing_reason` is enforced only inside this pipeline (the
163
+ finalize-phase verifier), not by the persisted artifact's schema -- a
164
+ hand-authored `review-summary.json` carrying a `route_narrowing_reason` next
165
+ to a route that does not actually narrow will still pass `systematic
166
+ validate-review-artifact`.
149
167
 
150
168
  **Output:** `{ merged_findings, validator_requests[{finding_id,file,line}], disagreement_facts }`.
151
169
  `validator_requests` names the merged findings that fall inside the Stage 5b
@@ -342,6 +342,12 @@
342
342
  "maxLength": 2048,
343
343
  "pattern": "\\S"
344
344
  },
345
+ "route_narrowing_reason": {
346
+ "type": "string",
347
+ "minLength": 1,
348
+ "maxLength": 2048,
349
+ "pattern": "\\S"
350
+ },
345
351
  "input_finding_ids": {
346
352
  "minItems": 1,
347
353
  "maxItems": 32,
@@ -2,7 +2,7 @@
2
2
  // biome-ignore-all assist/source/organizeImports: generated bundle
3
3
  // Generated by scripts/generate-ce-review-validator.ts; do not edit by hand.
4
4
  // Run `bun run ce-review-validator:build` to regenerate.
5
- // source-digest: a0479091cb09f961a6cfcef76af7b620d1491dd601fc21322093debadc76fd96
5
+ // source-digest: 7cf7f5a7fe9d032522bd53ea5df68b77c7564b9bf228fd7032c38eca13a50d49
6
6
  var __defProp = Object.defineProperty
7
7
  var __returnValue = (v) => v
8
8
  function __exportSetter(name, newValue) {
@@ -6453,6 +6453,7 @@ var SynthesizedFindingFieldsSchema = object({
6453
6453
  suggested_fix: string2().max(2048).nullable().optional(),
6454
6454
  validated: boolean2().optional(),
6455
6455
  validation_reason: ReasonSchema.optional(),
6456
+ route_narrowing_reason: ReasonSchema.optional(),
6456
6457
  input_finding_ids: array(boundedText(MAX_INPUT_ID_LENGTH))
6457
6458
  .min(1)
6458
6459
  .max(MAX_FINDINGS),
@@ -7180,6 +7181,7 @@ var MergedFindingSchema = object({
7180
7181
  pre_existing: ParentFindingSchema.shape.pre_existing,
7181
7182
  fingerprint: ProvenanceSchema.shape.fingerprint,
7182
7183
  submitters: ProvenanceSchema.shape.submitters,
7184
+ route_narrowing_reason: PipelineReasonSchema.optional(),
7183
7185
  }).strict()
7184
7186
  var MergeOutputSchema = object({
7185
7187
  merged_findings: array(MergedFindingSchema).max(MAX_FINDINGS),
@@ -8034,6 +8036,13 @@ function meetOverNarrowsTo(narrowsTo, values) {
8034
8036
  validCandidates.every((other) => narrowsTo[candidate].includes(other)),
8035
8037
  )
8036
8038
  }
8039
+ function routesEqual(a, b) {
8040
+ return (
8041
+ a.autofix_class === b.autofix_class &&
8042
+ a.owner === b.owner &&
8043
+ a.requires_verification === b.requires_verification
8044
+ )
8045
+ }
8037
8046
  function deriveRouteMeet(contributing) {
8038
8047
  const autofixClasses = contributing.map((finding) => finding.autofix_class)
8039
8048
  const owners = contributing.map((finding) => finding.owner)
@@ -8054,7 +8063,9 @@ function deriveRouteMeet(contributing) {
8054
8063
  }
8055
8064
  function deriveRoute(contributing, decision) {
8056
8065
  const meet = deriveRouteMeet(contributing)
8057
- if (!decision.proposed_route) return { ok: true, value: meet }
8066
+ if (!decision.proposed_route) {
8067
+ return { ok: true, value: meet, differsFromMeet: false }
8068
+ }
8058
8069
  if (!decision.route_narrowing_reason) {
8059
8070
  return rejectMergedFinding(
8060
8071
  formatReviewArtifactIssuePath(['route_narrowing_reason']),
@@ -8067,7 +8078,11 @@ function deriveRoute(contributing, decision) {
8067
8078
  'route widening',
8068
8079
  )
8069
8080
  }
8070
- return { ok: true, value: decision.proposed_route }
8081
+ return {
8082
+ ok: true,
8083
+ value: decision.proposed_route,
8084
+ differsFromMeet: !routesEqual(meet, decision.proposed_route),
8085
+ }
8071
8086
  }
8072
8087
  function deriveMergedFindingFields(input) {
8073
8088
  const submitters = deriveSubmitters(input.contributing)
@@ -8102,6 +8117,7 @@ function deriveMergedFindingFields(input) {
8102
8117
  pre_existing: preExisting,
8103
8118
  fingerprint,
8104
8119
  route: routeResult.value,
8120
+ route_differs_from_meet: routeResult.differsFromMeet,
8105
8121
  },
8106
8122
  }
8107
8123
  }
@@ -8192,6 +8208,9 @@ function assembleMergedGroupFinding(group, survivingIndex, returnedReviewers) {
8192
8208
  evidence: decision.evidence,
8193
8209
  suggested_fix: decision.suggested_fix,
8194
8210
  input_finding_ids: sortedInputIds,
8211
+ route_narrowing_reason: derived.value.route_differs_from_meet
8212
+ ? decision.route_narrowing_reason
8213
+ : undefined,
8195
8214
  },
8196
8215
  derived.value,
8197
8216
  ),
@@ -8226,6 +8245,9 @@ function assembleSingletonFinding(
8226
8245
  evidence: finding.evidence,
8227
8246
  suggested_fix: finding.suggested_fix,
8228
8247
  input_finding_ids: [finding.input_id],
8248
+ route_narrowing_reason: derived.value.route_differs_from_meet
8249
+ ? decisionFields.route_narrowing_reason
8250
+ : undefined,
8229
8251
  },
8230
8252
  derived.value,
8231
8253
  ),
@@ -8270,6 +8292,9 @@ function toMergedFindingWireShape(assembly) {
8270
8292
  ...(assembly.agreement_credit
8271
8293
  ? { agreement_credit: [...assembly.agreement_credit] }
8272
8294
  : {}),
8295
+ ...(assembly.route_narrowing_reason !== undefined
8296
+ ? { route_narrowing_reason: assembly.route_narrowing_reason }
8297
+ : {}),
8273
8298
  }
8274
8299
  }
8275
8300
  function mergeFindingIdCollisionReason(first, second) {
@@ -8755,26 +8780,37 @@ function eligibleAgreementCreditClaim(finding) {
8755
8780
  ? finding.agreement_credit
8756
8781
  : undefined
8757
8782
  }
8758
- function mergedFindingDivergesFromDerivation(
8759
- finding,
8760
- contributingByFindingId,
8761
- returnedReviewers,
8762
- ) {
8763
- const resolved = contributingByFindingId.get(finding.finding_id) ?? []
8764
- const contributing = toContributingTuple(
8765
- resolved.length >= 2 ? resolved : [...resolved, ...resolved],
8783
+ function mergedFindingRouteNarrowed(finding, meet) {
8784
+ return !routesEqual(
8785
+ {
8786
+ autofix_class: finding.autofix_class,
8787
+ owner: finding.owner,
8788
+ requires_verification: finding.requires_verification,
8789
+ },
8790
+ meet,
8766
8791
  )
8792
+ }
8793
+ function mergedFindingRouteReasonMismatch(finding, meet) {
8794
+ return mergedFindingRouteNarrowed(finding, meet)
8795
+ ? finding.route_narrowing_reason === undefined
8796
+ : finding.route_narrowing_reason !== undefined
8797
+ }
8798
+ function mergedFindingDivergesFromDerivation(context) {
8799
+ const { finding, resolved, contributing, meet, returnedReviewers } = context
8800
+ const narrowed = mergedFindingRouteNarrowed(finding, meet)
8767
8801
  const derivation = deriveMergedFindingFields({
8768
8802
  contributing,
8769
8803
  decision: {
8770
8804
  line: finding.line,
8771
8805
  eligible_agreement_credit: eligibleAgreementCreditClaim(finding),
8772
- proposed_route: {
8773
- autofix_class: finding.autofix_class,
8774
- owner: finding.owner,
8775
- requires_verification: finding.requires_verification,
8776
- },
8777
- route_narrowing_reason: 'carried route verification',
8806
+ proposed_route: narrowed
8807
+ ? {
8808
+ autofix_class: finding.autofix_class,
8809
+ owner: finding.owner,
8810
+ requires_verification: finding.requires_verification,
8811
+ }
8812
+ : undefined,
8813
+ route_narrowing_reason: finding.route_narrowing_reason,
8778
8814
  },
8779
8815
  returned_reviewers: returnedReviewers,
8780
8816
  })
@@ -8802,12 +8838,19 @@ function checkMergedFindingsMatchDerivation(
8802
8838
  returnedReviewers,
8803
8839
  ) {
8804
8840
  for (const [index, finding] of mergedFindings.entries()) {
8841
+ const resolved = contributingByFindingId.get(finding.finding_id) ?? []
8842
+ const contributing = toContributingTuple(
8843
+ resolved.length >= 2 ? resolved : [...resolved, ...resolved],
8844
+ )
8845
+ const meet = deriveRouteMeet(contributing)
8805
8846
  if (
8806
- mergedFindingDivergesFromDerivation(
8847
+ mergedFindingDivergesFromDerivation({
8807
8848
  finding,
8808
- contributingByFindingId,
8849
+ resolved,
8850
+ contributing,
8851
+ meet,
8809
8852
  returnedReviewers,
8810
- )
8853
+ })
8811
8854
  ) {
8812
8855
  return {
8813
8856
  path: formatReviewArtifactIssuePath([
@@ -8818,6 +8861,17 @@ function checkMergedFindingsMatchDerivation(
8818
8861
  reason: 'merged finding fields diverge from derivation',
8819
8862
  }
8820
8863
  }
8864
+ if (mergedFindingRouteReasonMismatch(finding, meet)) {
8865
+ return {
8866
+ path: formatReviewArtifactIssuePath([
8867
+ 'merge',
8868
+ 'merged_findings',
8869
+ index,
8870
+ 'route_narrowing_reason',
8871
+ ]),
8872
+ reason: 'merged finding route narrowing reason mismatch',
8873
+ }
8874
+ }
8821
8875
  }
8822
8876
  return
8823
8877
  }
@@ -9657,6 +9711,9 @@ function projectOneSynthesizedFinding(finding) {
9657
9711
  ...(finding.validation_reason !== undefined
9658
9712
  ? { validation_reason: finding.validation_reason }
9659
9713
  : {}),
9714
+ ...(finding.route_narrowing_reason !== undefined
9715
+ ? { route_narrowing_reason: finding.route_narrowing_reason }
9716
+ : {}),
9660
9717
  input_finding_ids: finding.input_finding_ids,
9661
9718
  provenance: {
9662
9719
  fingerprint: finding.fingerprint,