clearotron 0.6.0 → 0.7.0-beta.1

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.
Files changed (146) hide show
  1. package/INSTALL.md +7 -4
  2. package/QUICKSTART.md +1 -0
  3. package/README.md +5 -2
  4. package/THIRD-PARTY-NOTICES.md +1 -1
  5. package/bin/clearotron.mjs +4 -2
  6. package/bin/onboard.mjs +158 -29
  7. package/build-info.json +2 -2
  8. package/docs/CLIENT-MCP.md +3 -1
  9. package/docs/DELIVERY.md +6 -3
  10. package/docs/architecture/02-architecture.md +1 -1
  11. package/docs/architecture/04-configuration-reference.md +105 -8
  12. package/docs/branding.md +4 -4
  13. package/docs/report-data/clearance-1.schema.json +320 -0
  14. package/docs/report-data/knockout-1.schema.json +268 -0
  15. package/driver/CHANGELOG.md +77 -0
  16. package/driver/cancel.mjs +19 -0
  17. package/driver/connotation-search.mjs +1 -1
  18. package/driver/contract-e3-backlog.mjs +41 -41
  19. package/driver/contract-vocabulary.mjs +1 -1
  20. package/driver/coverage-ledger.mjs +18 -2
  21. package/driver/deferral-row.mjs +1 -1
  22. package/driver/degraded-parts.mjs +1 -0
  23. package/driver/driver.config.mjs +5 -5
  24. package/driver/effective-scope.mjs +3 -1
  25. package/driver/engagement-receipt.mjs +3 -3
  26. package/driver/engine/anthropic-agent.mjs +15 -1
  27. package/driver/engine/common.mjs +7 -0
  28. package/driver/engine/mcp/band-server.mjs +7 -16
  29. package/driver/engine/mcp/codex-config.mjs +3 -0
  30. package/driver/engine/mcp/recording-server.mjs +45 -34
  31. package/driver/engine/openai-agent.mjs +74 -7
  32. package/driver/engine/session-record.mjs +44 -2
  33. package/driver/findings-model.mjs +14 -2
  34. package/driver/follow-up-twins.mjs +86 -0
  35. package/driver/gateway.mjs +77 -12
  36. package/driver/jx-units.mjs +3 -1
  37. package/driver/jx.mjs +13 -5
  38. package/driver/manuals-inline.mjs +98 -0
  39. package/driver/manuals-seen.mjs +134 -0
  40. package/driver/mark-logos.mjs +174 -0
  41. package/driver/methodology-witness.mjs +2 -1
  42. package/driver/owner-use-check.mjs +8 -4
  43. package/driver/package.json +1 -1
  44. package/driver/pipeline-knockout.mjs +23 -4
  45. package/driver/pipeline.mjs +128 -15
  46. package/driver/portal-local-auth.mjs +6 -2
  47. package/driver/portal-report.mjs +45 -14
  48. package/driver/portal-routes/me.mjs +4 -1
  49. package/driver/portal-runs.mjs +19 -16
  50. package/driver/predelivery-lint.mjs +7 -5
  51. package/driver/profiles.mjs +4 -4
  52. package/driver/publish/README.md +9 -7
  53. package/driver/publish/email-conditions.mjs +22 -5
  54. package/driver/publish/evidence-words.mjs +21 -0
  55. package/driver/publish/index.mjs +304 -211
  56. package/driver/publish/knockout.mjs +297 -247
  57. package/driver/publish/office-record-links.mjs +11 -9
  58. package/driver/publish/page-shell.mjs +98 -0
  59. package/driver/publish/pool-admin.mjs +2 -2
  60. package/driver/publish/publish-inputs.mjs +4 -0
  61. package/driver/publish/regions.mjs +28 -3
  62. package/driver/publish/register-record-html.mjs +105 -0
  63. package/driver/publish/register-record.mjs +165 -0
  64. package/driver/publish/render-knockout.mjs +299 -671
  65. package/driver/publish/render.mjs +561 -492
  66. package/driver/publish/report-data.mjs +226 -13
  67. package/driver/publish/report-document.mjs +353 -0
  68. package/driver/publish/search-depth.mjs +88 -7
  69. package/driver/publish/shell.mjs +41 -1
  70. package/driver/publish/strings.mjs +810 -0
  71. package/driver/publish/templates/clearance-print.css +23 -0
  72. package/driver/publish/templates/knockout.css +224 -0
  73. package/driver/publish/templates/report.css +112 -53
  74. package/driver/publish/xlsx.mjs +158 -139
  75. package/driver/record-goods.mjs +42 -0
  76. package/driver/reference-score.mjs +4 -1
  77. package/driver/register-count.mjs +5 -1
  78. package/driver/register-reach.mjs +39 -0
  79. package/driver/registry-fidelity.mjs +155 -37
  80. package/driver/repair-composers.mjs +7 -3
  81. package/driver/repair-targets.mjs +4 -1
  82. package/driver/replay-archive.mjs +4 -3
  83. package/driver/run-delivered.mjs +14 -8
  84. package/driver/run-record.mjs +1 -0
  85. package/driver/runner.mjs +73 -29
  86. package/driver/scope-facts.mjs +27 -6
  87. package/driver/search-policy.mjs +9 -4
  88. package/driver/skills/clearance-search/report-prose.md +3 -0
  89. package/driver/skills/knockout-assess/SKILL.md +8 -0
  90. package/driver/stage-freshness.mjs +8 -5
  91. package/driver/stages.mjs +69 -43
  92. package/driver/steps/delivery.mjs +9 -5
  93. package/driver/steps/overview-and-cards.mjs +54 -15
  94. package/driver/steps/register-sweep.mjs +5 -4
  95. package/driver/steps/skeptic-and-follow-up.mjs +3 -2
  96. package/driver/steps/verdict-gate.mjs +35 -14
  97. package/driver/suite-census.json +579 -87
  98. package/driver/synthesis-record.mjs +4 -3
  99. package/driver/terminal-clamp.mjs +6 -1
  100. package/driver/withdrawn-rating.mjs +72 -0
  101. package/mcp-server/CHANGELOG.md +8 -0
  102. package/mcp-server/lib/audit-view.mjs +5 -2
  103. package/mcp-server/lib/brief.mjs +6 -2
  104. package/mcp-server/lib/evidence.mjs +94 -23
  105. package/mcp-server/lib/findings.mjs +19 -2
  106. package/mcp-server/lib/knockout.mjs +13 -4
  107. package/mcp-server/lib/scrub.mjs +1 -1
  108. package/mcp-server/package.json +1 -1
  109. package/mcp-server/server.mjs +22 -3
  110. package/package.json +4 -1
  111. package/portal-ui/dist/assets/{index-CYaO2ygd.js → index-BBlN4CYq.js} +238 -80
  112. package/portal-ui/dist/assets/{index-izLa9apq.css → index-CxAkJXIT.css} +25 -5
  113. package/portal-ui/dist/index.html +2 -2
  114. package/portal-ui/package.json +3 -3
  115. package/providers/_shared/ledger.mjs +30 -2
  116. package/providers/_shared/record-uri.mjs +15 -0
  117. package/providers/clarivate/src/adapter.js +11 -0
  118. package/providers/clarivate/src/core.js +17 -1
  119. package/providers/jx/src/core.js +4 -4
  120. package/providers/jx/src/judge.js +1 -3
  121. package/providers/jx/src/nativeread.js +1 -3
  122. package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
  123. package/providers/oauth-mcp-bridge/package.json +1 -1
  124. package/scripts/README.md +147 -3
  125. package/scripts/added-reference-check.mjs +35 -7
  126. package/scripts/e2e-first-time.mjs +4 -4
  127. package/scripts/env-audit.mjs +16 -9
  128. package/scripts/freeze-example-run.mjs +3 -3
  129. package/scripts/mint-public-residue.mjs +3 -3
  130. package/scripts/mint-search-level-tags.mjs +61 -0
  131. package/scripts/mint-source-pin-census.mjs +89 -0
  132. package/scripts/release-note-required.mjs +65 -6
  133. package/scripts/test-durations-reporter.mjs +25 -0
  134. package/scripts/test-full.mjs +72 -18
  135. package/scripts/test-run.mjs +18 -1
  136. package/shared/brand.mjs +93 -6
  137. package/shared/inline-markdown.mjs +53 -0
  138. package/shared/names-in-force.mjs +0 -1
  139. package/shared/portal-tokens.mjs +2 -1
  140. package/shared/reference-guard-classes.mjs +43 -2
  141. package/shared/register-selection.mjs +8 -3
  142. package/shared/search-level-tags.json +25 -0
  143. package/shared/source-spans.mjs +91 -0
  144. package/shared/tools/derive-band-pairs.mjs +10 -0
  145. package/driver/own-rights.mjs +0 -83
  146. package/driver/use-check.mjs +0 -85
@@ -1,11 +1,12 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-only
2
2
  // Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
3
- // publish/report-data.mjs — PR-9: the CLEARANCE run as data. The knockout lane has written
4
- // report-data.json since the one-report collapse; the clearance lane's native-render branch existed in
5
- // the portal with NO producer anywhere (B3's "the aspirational path") — this is that producer.
3
+ // publish/report-data.mjs — the run as data, one producer per shape: clearanceReportData writes
4
+ // `report-data/clearance-1` and knockoutReportData (at the end of this file) `report-data/knockout-1`.
5
+ // Each shape's JSON Schema is under docs/report-data/.
6
6
  //
7
- // Two readers, one file (the knockout doctrine, as it stood): the assistant drafts client-facing mail
8
- // from it, and the portal's native-render path reads it instead of iframing baked HTML.
7
+ // The assistant drafts client-facing mail from it. The portal does not read it: every report the portal
8
+ // shows is the stored HTML. The Knockout's shape is a different one, `report-data/knockout-1`; the two
9
+ // schemas are under docs/report-data/.
9
10
  //
10
11
  // THE TWO LANES DIVERGED ON 2026-09-07 AND THIS FILE DID NOT MOVE. The owner ruled
11
12
  // that the KNOCKOUT report carries the reviewer's notes, on the ground that one report is read by the
@@ -31,7 +32,10 @@
31
32
  // PURE — no IO, no config: publishReport gathers the stores and passes them in, so the producer is unit-
32
33
  // testable offline and a republished archived run reproduces its file deterministically.
33
34
  import { stripInternal, dropLabelledInternals, stripEngineInternals } from './parse.mjs';
34
- import { DISPOSITION_GROUP, deriveActionConditions, projectAssessmentField } from '../findings-model.mjs';
35
+ import { DISPOSITION_GROUP, deriveActionConditions, projectAssessmentField, knockoutFindingViews } from '../findings-model.mjs';
36
+ import { COUNT_BASIS, COUNT_PREDICATES, countsForMark, countLine, variantFormsLine, disclosedFloor } from '../register-count.mjs';
37
+ import { recordBasisOf, recordsForMark, recordsLine } from '../register-records.mjs';
38
+ import { registerCardViews, ownerCheckFor, ownerCheckText, ownerCheckOutcome, NOT_WEIGHED_LINE as NOT_WEIGHED } from './render-knockout.mjs';
35
39
  import { clientConditions } from '../terminal-clamp.mjs'; // the reader's clause per condition — one definition, shared with the email
36
40
 
37
41
  // The client scrub choke point: the three existing rules, in the order the client HTML applies them.
@@ -81,7 +85,7 @@ export function clearanceReportData({
81
85
  deadline: a.deadline?.date ? { kind: a.deadline.kind ?? null, date: a.deadline.date } : null,
82
86
  });
83
87
  return {
84
- schema: 'report-data/1',
88
+ schema: 'report-data/clearance-1',
85
89
  kind: 'clearance',
86
90
  runId,
87
91
  codename: codename || null,
@@ -99,7 +103,7 @@ export function clearanceReportData({
99
103
  auditFile: auditFile || null,
100
104
  level: { searchLevel: searchLevel ?? null, stageLabel: stageLabel ?? null },
101
105
  framework: framework ? { key: framework.framework_key, title: framework.title, bands: framework.bands.map((b) => ({ label: b.label, tone: b.tone })) } : null,
102
- // The rating + the one risk statement — the exact record every other surface joins (spec 64). Named
106
+ // The rating + the one risk statement — the exact record every other surface joins. Named
103
107
  // `rating` (ruled 2026-09-22): as `verdict` it read as the clearance's answer and carried the reviewer's
104
108
  // sign-off word beside the band. The sign-off stays in the review stage's own record, not the client's.
105
109
  rating: verdictInfo ? {
@@ -200,11 +204,10 @@ export function clearanceReportData({
200
204
  // ADVISORY_TAG rather than a named filter. then wrote a watch group for "monitoring and
201
205
  // filing-routine" and neither copy was told. Ruling 2026-08-19: the kind renders.
202
206
  //
203
- // This surface is the one that matters most for it. Legacy runs are served as baked bytes, but NEW
204
- // runs render component-native from report-data.json — so a fix that reached only the markdown
205
- // renderer would have left the kind unreachable on every run from here on, while the tests around
206
- // the other copy went green. All four ADVISORY_KINDS travel; the partition is conditions vs
207
- // advisories and nothing else.
207
+ // This surface is the one an outside reader of the data takes the asks from, so a fix that reached
208
+ // only the markdown renderer would have left the kind unreachable here, while the tests around the
209
+ // other copy went green. All four ADVISORY_KINDS travel; the partition is conditions vs advisories and
210
+ // nothing else.
208
211
  actions: {
209
212
  conditions: conditionActions.map(action),
210
213
  advisories: advisoryActions.map(action),
@@ -214,3 +217,213 @@ export function clearanceReportData({
214
217
  })).filter((a) => a.ask && a.answer),
215
218
  };
216
219
  }
220
+
221
+ /**
222
+ * The KNOCKOUT run as data: report-data.json beside each name's report, in the shape
223
+ * `report-data/knockout-1` (docs/report-data/knockout-1.schema.json). It moved here from the Knockout
224
+ * renderer so both producers sit together; its output did not change but for that string.
225
+ *
226
+ * The assistant drafts a client-facing email from it (which is why the retired per-customer email template
227
+ * does not need to come back as config: formatting is judgement, and this is the input judgement works from).
228
+ *
229
+ * It carries what the REPORT says, plus the level identity, and nothing internal: the audit workbook is
230
+ * where the working notes live, and a data file that quietly re-admitted them would reopen exactly the
231
+ * leak this series closed.
232
+ */
233
+ export function knockoutReportData(findings, framework, { runId, codename, overall, issued, identity, registerCounts, registerRecords = null, ownerChecks = [], url, auditFile, customerKey, matter, servedModels = null }) {
234
+ const marks = findings?.marks ?? [];
235
+ return {
236
+ schema: 'report-data/knockout-1',
237
+ runId,
238
+ codename: codename || null,
239
+ matter: matter || runId,
240
+ customerKey: customerKey || 'generic',
241
+ issued: issued || null,
242
+ url: url || null,
243
+ auditFile: auditFile || null,
244
+ // The models that served the run, in first-use order, as tokens.mjs servedModels names them for a
245
+ // client: a deployment's own name never, its tier instead. null when nothing was read.
246
+ servedModels: Array.isArray(servedModels) ? servedModels : null,
247
+ level: {
248
+ searchLevel: identity?.level ?? null,
249
+ stageLabel: identity?.stageLabel ?? null,
250
+ identity: identity?.identity ?? null,
251
+ // `banner` is NOT projected. It is stageLabel joined to identity, so on a retired row it carries a
252
+ // depth rung — and report-data.json is a CLIENT surface (the portal's native render and the MCP
253
+ // brief read it). The two fields it is made of are both here already; a consumer that wants the
254
+ // internal face takes `stageLabel`, and nothing gets a pre-joined string that leaks one.
255
+ },
256
+ framework: framework ? { key: framework.framework_key, title: framework.title, bands: framework.bands.map((b) => ({ label: b.label, tone: b.tone })) } : null,
257
+ overall: overall ?? null,
258
+ summary: findings?.batch?.executiveSummary ?? null,
259
+ productContext: findings?.batch?.productContext ?? null,
260
+ caveats: findings?.batch?.standardCaveats ?? [],
261
+ marks: marks.map((m) => {
262
+ const counted = registerCounts ? countsForMark(registerCounts, m.name) : null;
263
+ return {
264
+ name: m.name,
265
+ band: m.rating ?? null,
266
+ qualifier: m.ratingQualifier ?? null,
267
+ // WHAT THIS NAME IS FOR. Per MARK, not per batch — a character name and a
268
+ // franchise title can sit at different bands on identical evidence, and the manner-of-use
269
+ // calibration in the firm-wide reasoning turns on exactly this. It reached the plan and the
270
+ // rater and stopped there: this projection is an explicit whitelist, so a field nobody adds is
271
+ // a field the assistant drafting client mail never sees, however faithfully the rater carried
272
+ // it. Null on an archived run that predates the frame carrying it.
273
+ contextFraming: m.contextFraming ?? null,
274
+ classesSearched: m.classesSearched ?? [],
275
+ classesDriving: m.classesDriving ?? [],
276
+ ...(Array.isArray(m.classGroups) && m.classGroups.length ? { classGroups: m.classGroups } : {}),
277
+ degraded: Boolean(m.degraded),
278
+ points: m.bullets ?? [],
279
+ // ── THE ASSESSMENT THE RUN ALREADY WROTE ──────────────────────────────────────────────────
280
+ //
281
+ // Seven keys the assess stage writes into knockout-findings.json reached this file as nothing.
282
+ // They were not withheld by a rule — no code decided against them; this projection is an explicit
283
+ // whitelist and nobody had added them, so an assistant drafting from this file could not see the
284
+ // reasoning behind a rating it was drafting about.
285
+ //
286
+ // `assessment` is the sharpest case: publish substitutes it into `batch.executiveSummary` ONLY on
287
+ // a multi-mark batch, so on a single-mark run — the common knockout — the mark's own opening read
288
+ // was written, validated, and then dropped by both surfaces at once.
289
+ //
290
+ // `purpleNotes` is the reviewer's notes, and it is here by the owner's ruling of 2026-09-07: one
291
+ // report, read by the person who ran Clearotron, because keeping material off it "just adds
292
+ // confusion for where data is lost". They are LABELLED on the page rather than merged into the
293
+ // client-voiced body — see reviewerNotesBlock — so a reader can tell whose voice they are in.
294
+ assessment: (() => { const t = String(m.assessment ?? '').trim(); return t || null; })(),
295
+ counterFactors: m.counterFactors ?? [],
296
+ mitigation: (() => { const t = String(m.mitigation ?? '').trim(); return t || null; })(),
297
+ // `null`, not `false`, when the rater said nothing: a crowded field is a mitigant the reasoning
298
+ // turns on, and an unstated one must not read as a stated "no".
299
+ crowdedField: typeof m.crowdedField === 'boolean' ? m.crowdedField : null,
300
+ reviewerNotes: m.purpleNotes ?? [],
301
+ // The proof-of-search rows — the same defensibility record list_searches answers from.
302
+ negatives: (m.negatives ?? []).map((n) => ({
303
+ term: n?.term ?? null, source: n?.source ?? null, note: n?.note ?? null,
304
+ })),
305
+ // The rater's read of a filing it weighed, keyed by the record id the card prints, so a consumer
306
+ // can join a read to its filing without matching on prose.
307
+ registerReads: (m.registerReads ?? []).map((x) => ({
308
+ recordId: x?.recordId ?? null,
309
+ read: x?.read ?? null,
310
+ band: String(x?.band ?? '').trim() || null,
311
+ // the framework's own inputs, where it states a method — absent otherwise, so every other run's data is unchanged
312
+ ...(x?.inputs ? { inputs: x.inputs } : {}),
313
+ })),
314
+ // — the typed finding, ranked, with the reference the report prints. The old key was
315
+ // `evidence[]` and it was `(m.findings ?? []).filter((f) => f?.url)`: a typed finding has no
316
+ // `url`, so this file — the one the assistant drafts client mail from — silently carried zero
317
+ // conflicts for a mark that had several. `shape` says which record each row came from, so a
318
+ // reader can tell a typed run from an archived prose one without guessing at the blanks.
319
+ findings: [
320
+ ...knockoutFindingViews(m, { manifest: framework }).map((v) => ({
321
+ ref: v.ref, ordinal: v.ordinal, name: v.name, owner: v.owner, band: v.band, type: v.type,
322
+ net: v.lead, basis: v.detail, evidence: v.evidence, shape: v.shape,
323
+ ...(v.inputs ? { inputs: v.inputs } : {}),
324
+ })),
325
+ // — the promoted register filings, in the SAME array, from the SAME projection the page
326
+ // renders from (registerCardViews). Two reasons it cannot live under its own key:
327
+ //
328
+ // 1. THE FLAG. portal-service.mjs resolves per-finding feedback as
329
+ // `data.marks[markIndex].findings.find(f => f.ordinal === ordinal)`, against the
330
+ // `data-ko-ord` the card carries. A card in the DOM with no row here resolves NOTHING and
331
+ // logs `resolved:false` — the reader's correction is captured against no facts, silently.
332
+ // 2. THE BRIEF. mcp-server/lib/brief.mjs walks this array to write "Each name screened".
333
+ // A promoted filing the brief omitted would be the report and the brief disagreeing about
334
+ // what the run found.
335
+ //
336
+ // `shape: 'register'` is the load-bearing field: a consumer can tell a weighed conflict from a
337
+ // pointed-at filing without parsing prose.
338
+ //
339
+ // `band` AND `basis` NOW CARRY THE RATER'S READ WHEN IT SENT ONE. Before
340
+ // this, both were constants — `band: null` and the not-weighed sentence — on every filing of
341
+ // every run, including runs where the seat had written a full read of that exact filing and the
342
+ // HTML card was already printing it. The page and this file disagreed, and this file is the one
343
+ // the MCP brief answers from, so the surface a reader asks "what did you make of that
344
+ // registration?" was the surface that had dropped the answer.
345
+ //
346
+ // The unmatched case is unchanged and must stay that way: no row for this recordId ⇒ `band:
347
+ // null` and the not-weighed line, which describes the card and claims nothing.
348
+ ...registerCardViews(m, framework, registerRecords).cards.map((v) => {
349
+ const row = (Array.isArray(m?.registerReads) ? m.registerReads : [])
350
+ .find((x) => String(x?.recordId ?? '').trim() && String(x?.recordId ?? '').trim() === String(v.record?.recordId ?? '').trim());
351
+ const read = String(row?.read ?? '').trim() || null;
352
+ const band = String(row?.band ?? '').trim() || null;
353
+ // The driver's own record of where this filing's proprietor was looked up, joined by
354
+ // recordId. `null` where the run owed no check — the same three states the
355
+ // card has, so a consumer can tell "searched and found nothing" from "never searched".
356
+ const oc = ownerCheckFor(ownerChecks, v.record?.recordId);
357
+ return {
358
+ ref: v.ref, ordinal: v.ordinal, name: v.record.mark, owner: v.record.owner, band,
359
+ ...(band && row?.inputs ? { inputs: row.inputs } : {}),
360
+ type: 'Register filing',
361
+ net: read ? v.statement : `${v.statement} It was ${NOT_WEIGHED}.`,
362
+ basis: read ?? NOT_WEIGHED,
363
+ useCheckSource: ownerCheckText(ownerCheckOutcome(oc)),
364
+ evidence: v.evidence, shape: 'register',
365
+ };
366
+ }),
367
+ ],
368
+ registerCounts: counted?.counts
369
+ ? {
370
+ classScope: counted.classScope ?? null,
371
+ classes: counted.classes ?? [],
372
+ ...Object.fromEntries(COUNT_PREDICATES.map((p) => [p.key, Number.isFinite(counted.counts[p.key]?.total) ? counted.counts[p.key].total : null])),
373
+ // The figure stays null for a floor — a floor is never a count to be summed — and the floor
374
+ // rides beside it, so a reader of this file has the register's own figure and not only a null.
375
+ ...(COUNT_PREDICATES.some((p) => disclosedFloor(counted.counts[p.key]) !== null)
376
+ ? { floors: Object.fromEntries(COUNT_PREDICATES.filter((p) => disclosedFloor(counted.counts[p.key]) !== null)
377
+ .map((p) => [p.key, disclosedFloor(counted.counts[p.key])])) }
378
+ : {}),
379
+ // The close column is an aggregate, so the forms under it ride with it — a consumer that
380
+ // got the number and not the forms could restate the figure but never explain it, and this
381
+ // file is what the assistant drafts client mail from.
382
+ closeVariationForms: (counted.counts.close?.forms ?? []).map((f) => f.form),
383
+ closeVariationsLine: variantFormsLine(counted),
384
+ line: countLine(counted),
385
+ }
386
+ : null,
387
+ // part 5 — the filings behind the narrow counts, as data. The assistant drafts client mail
388
+ // from this file, so it gets the SAME three states the report gets: rows, an answered nothing,
389
+ // or a stated reason. `records: []` with no line beside it would be read as "no filings".
390
+ registerFilings: (() => {
391
+ const listed = registerRecords ? recordsForMark(registerRecords, m.name) : null;
392
+ if (registerRecords?.unavailable) return { available: false, line: registerRecords.unavailable, records: [] };
393
+ if (!listed) return null;
394
+ return {
395
+ available: true,
396
+ line: recordsLine(listed),
397
+ fetched: listed.fetched ?? (listed.records ?? []).length,
398
+ capped: Boolean(listed.capped),
399
+ // THE CAP THE RUN RECORDED, beside the flag that says it bit. `capped: true` on its own cannot
400
+ // tell a listing truncated at fifty from one a cap of zero stopped before it began: the first
401
+ // is a register outcome and the second is a configuration, and a consumer reading the flag
402
+ // alone reports them the same way. The run has always written `cap` per mark; nothing read it.
403
+ //
404
+ // NULL IS NOT ZERO and the two are kept apart all the way out, the way the portal's allowance
405
+ // contract keeps them. Null is a sidecar that recorded no cap at all, which is every run
406
+ // archived before the field existed; zero is a cap that was set to zero. Folding them together
407
+ // would put an archived run and a misconfigured one on the same line.
408
+ cap: Number.isFinite(listed.cap) ? listed.cap : null,
409
+ records: (listed.records ?? []).map((r) => ({
410
+ mark: r.mark, owner: r.owner, status: r.status, classes: r.classes ?? [],
411
+ territory: r.territory, matchedForm: r.matchedForm, matchedBasis: r.matchedBasis,
412
+ recordId: r.recordId, url: r.url,
413
+ // The office's page for the filing, or its office and number and why it is not a link: the
414
+ // report's own cell, as data. Only where the run's register has no record pages of its own.
415
+ ...(r.officeLink ? { officeRecord: { label: r.officeLink.label, href: r.officeLink.href, reason: r.officeLink.reason } } : {}),
416
+ })),
417
+ // Which searches did NOT answer, by name. A consumer that lists only `records` would report
418
+ // a partial listing as a complete one. A form the cap stopped keeps its sentence; a failed
419
+ // search's own text stays in the run's filings record, never in this file.
420
+ unanswered: (listed.terms ?? []).filter((t) => !t.ok).map((t) => ({ form: t.term, basis: t.basis, reason: t.notAsked ? t.reason ?? null : null })),
421
+ };
422
+ })(),
423
+ };
424
+ }),
425
+ registerCountBasis: registerCounts ? COUNT_BASIS : null,
426
+ registerFilingsBasis: registerRecords && !registerRecords.unavailable ? recordBasisOf(registerRecords) : null,
427
+ registerProvider: registerCounts ? (registerCounts.providerLabel ?? registerCounts.provider ?? null) : null,
428
+ };
429
+ }
@@ -0,0 +1,353 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
3
+ // publish/report-document.mjs — the run's report as one versioned JSON document, `report-document/clearance-1`.
4
+ //
5
+ // Every surface a run publishes (the page, the workbook, the cover emails, meta.json, the data file and the
6
+ // connector) reads its facts from what publish assembles. Today each surface takes them by its own route; this
7
+ // document is the one route they move to, one surface at a time, each move proved byte-equal. It is written to
8
+ // the run's own record (`_driver/report-document.json`), never the pool: the pool is the delivered archive, and
9
+ // the reviewer and staff sections do not belong in it.
10
+ //
11
+ // THE SECTION IS THE AUDIENCE. `client` is what reaches the client page, the email, the data file and the
12
+ // portal; `reviewer` is what only the workbook and the reviewing lawyer see; `staff` is the run record's alone.
13
+ // `run`, `scope`, `framework`, `verdict` and `prose` are read by every surface. A value sits in one place.
14
+ //
15
+ // VALUES ARE STORED RAW, as publish read them. The client scrub, a surface's own fallback (the data file's
16
+ // `matter || runId`, meta.json's frozen stage label) and its own field names are the projection's work, so
17
+ // two surfaces that default differently today still can from one document.
18
+ //
19
+ // JSON-SAFE BY CONSTRUCTION: a Map is stored as its [key, value] entries in insertion order (an object would
20
+ // turn ordinal keys into strings and reorder them), a Set as its members in insertion order, a Set inside a Map's
21
+ // value included (JSON writes a Set as `{}`). The register's
22
+ // records and the saved logos are stored by reference: their bodies stay in the run's `_records/` and
23
+ // `_driver/logos/`, which can hold thousands of records.
24
+ //
25
+ // PURE: no IO and no clock. publishReport hands it the values readClearanceDocument read.
26
+ import { clearanceReportData, knockoutReportData } from './report-data.mjs';
27
+ import { deriveActionConditions } from '../findings-model.mjs';
28
+ import { deliveryFlagLines } from '../predelivery-lint.mjs';
29
+ import { NOT_COMPLETED } from '../degraded-parts.mjs';
30
+
31
+ export const CLEARANCE_DOCUMENT = 'report-document/clearance-1';
32
+
33
+ const entries = (m) => (m instanceof Map ? [...m].map(([k, v]) => [k, v instanceof Set ? [...v] : v]) : null);
34
+ const members = (s) => (s instanceof Set ? [...s] : null);
35
+ const orNull = (v) => (v === undefined ? null : v);
36
+
37
+ /**
38
+ * The clearance run as one document. `d` is readClearanceDocument's return; `codename`, `customerKey` and
39
+ * `auditFile` are known only to publishReport (the last once the workbook is built).
40
+ */
41
+ export function clearanceReportDocument(d, { codename = null, customerKey = null, auditFile = null, auditError = null } = {}) {
42
+ const all = Array.isArray(d.findings) ? d.findings : [];
43
+ const isWithdrawn = (f) => f?.disposition === 'withdrawn';
44
+ // The forward asks as the report partitions them. An ask whose findings were all withdrawn is dropped
45
+ // here, so the client section never needs the withdrawn findings to read its own asks.
46
+ const { conditionActions, advisoryActions } = deriveActionConditions(d.actionsRegister ?? [], all);
47
+ const pol = d.searchPolicy ?? null;
48
+ return {
49
+ document: CLEARANCE_DOCUMENT,
50
+ build: { engineCommit: orNull(d.engineCommit), renderedAt: orNull(d.renderedAt), tokens: orNull(d.tokenRollup?.total) },
51
+ run: {
52
+ runId: d.runId ?? null,
53
+ codename: codename || null,
54
+ customerKey: customerKey || null,
55
+ organisation: orNull(d.organisation),
56
+ project: orNull(d.project),
57
+ markName: orNull(d.markName),
58
+ issued: orNull(d.issued),
59
+ issuedAt: orNull(d.issuedAt),
60
+ asOf: orNull(d.asOf),
61
+ url: orNull(d.reportRoute),
62
+ auditFile: auditFile || null,
63
+ product: {
64
+ name: orNull(d.productName),
65
+ level: orNull(pol?.level),
66
+ // Today's registry's label and the one frozen with the run, apart: the page and the data file read the
67
+ // first, meta.json the second.
68
+ stageLabel: orNull(d.stageLabel),
69
+ frozenStageLabel: orNull(d.frozenStageLabel),
70
+ depthNote: orNull(d.depthNote),
71
+ },
72
+ provenance: {
73
+ recipe: orNull(pol?.recipe), enqueuedVia: orNull(pol?.enqueuedVia),
74
+ enqueuedBy: orNull(pol?.enqueuedBy), parentRunId: orNull(pol?.parentRunId),
75
+ },
76
+ // The register the run read: its name, its citation rule, and where its records are published.
77
+ provider: {
78
+ label: orNull(d.providerLabel),
79
+ citation: orNull(d.runProviderConf?.recordCitation),
80
+ origin: orNull(d.recordOrigin),
81
+ origins: orNull(d.runOrigins),
82
+ },
83
+ // The findings record's declared version; the page chooses the grouped negatives' layout by it.
84
+ findingsVersion: orNull(d.findingsSchemaVersion),
85
+ },
86
+ scope: {
87
+ jurisdiction: orNull(d.jurisdiction),
88
+ scopeBasis: orNull(d.scopeBasis),
89
+ searchedJurisdictions: orNull(d.searchedJurisdictions),
90
+ planTerritories: orNull(d.planTerritories),
91
+ registerReach: orNull(d.registerReach),
92
+ registerScope: orNull(d.registerScope),
93
+ registerOnly: Boolean(d.registerOnly),
94
+ noMarketplacesPicked: Boolean(d.noMarketplacesPicked),
95
+ searchDepth: orNull(d.searchDepth),
96
+ },
97
+ framework: { manifest: orNull(d.framework), method: orNull(d.frameworkMethod) },
98
+ verdict: {
99
+ // The verdict record whole. Its sign-off is the reviewer's word, but the page prints it as the recommendation
100
+ // on a record with no statement, so it is read here with the rest.
101
+ record: orNull(d.verdictInfo),
102
+ // The record as written in the run's verdict file, which the cover email reads. It differs from `record` on a record
103
+ // older than the derived display fields, and where the assessment was not completed.
104
+ written: orNull(d.verdictWritten),
105
+ assessmentNotCompleted: Boolean(d.assessmentNotCompleted),
106
+ },
107
+ client: {
108
+ findings: all.filter((f) => !isWithdrawn(f)),
109
+ coverage: d.coverage ?? [],
110
+ contextNotes: d.contextNotes ?? [],
111
+ markAssessment: orNull(d.markAssessment),
112
+ fourAnswers: orNull(d.fourAnswers),
113
+ askAnswers: orNull(d.askAnswers),
114
+ actions: { conditions: conditionActions, advisories: advisoryActions },
115
+ coverageJudgment: orNull(d.coverageJudgmentDisplay),
116
+ // Each finding's court decisions. The session-wide notice is not carried: no surface prints it.
117
+ caseLaw: { byOrdinal: entries(d.caseLawByOrdinal) ?? [] },
118
+ enforcerSignals: d.enforcerSignals ?? [],
119
+ seniorRights: orNull(d.seniorRights),
120
+ records: d.recordsByUri instanceof Map ? [...d.recordsByUri.keys()] : [],
121
+ recordLinks: d.officeLinks ? { byUri: entries(d.officeLinks.byUri), tally: orNull(d.officeLinks.tally), summary: orNull(d.officeLinks.summary) } : null,
122
+ logos: d.logos instanceof Map ? [...d.logos].map(([ref, l]) => [ref, l?.state ?? null]) : [],
123
+ followUpKinds: entries(d.followUpKinds) ?? [],
124
+ servedModels: orNull(d.served),
125
+ },
126
+ reviewer: {
127
+ // Each withdrawn finding with its place in the run's list, so a reader can restore the list's order.
128
+ withdrawn: all.flatMap((f, at) => (isWithdrawn(f) ? [{ at, finding: f }] : [])),
129
+ quarantined: d.quarantined ?? [],
130
+ coverageJudgment: orNull(d.coverageJudgment),
131
+ corrections: orNull(d.correctionsDoc),
132
+ // The predelivery checks that failed, with their raw detail, which stays here: the workbook is handed their delivery
133
+ // lines. The run's other review receipts reach no surface, so they are not carried.
134
+ lint: d.reviewReceipts?.lint ?? [],
135
+ droppedConditions: d.droppedConditions ?? [],
136
+ undispatchedProbes: d.undispatchedProbes ?? [],
137
+ withheldFamilies: d.withheldFamilies ?? [],
138
+ releasedFamilies: d.releasedFamilies ?? [],
139
+ setAside: d.setAside ?? [],
140
+ fetchState: orNull(d.fetchState),
141
+ clientGate: orNull(d.clientGate),
142
+ degradedParts: d.degradedRows ?? [],
143
+ commonLawJoinedTerms: members(d.commonLawJoinedTerms),
144
+ // audit.md as parsed: the search log the workbook sets out.
145
+ audit: orNull(d.auditParsed),
146
+ },
147
+ staff: {
148
+ inputsAbsent: d.inputsAbsent ?? [],
149
+ publishParts: d.publishParts ?? [],
150
+ findingsError: orNull(d.findingsError),
151
+ auditError: auditError ?? null,
152
+ },
153
+ // report.md as parsed: its front matter, its sections by heading and the finding cards. Raw, as the page reads it.
154
+ prose: {
155
+ frontMatter: d.parsed?.fm ?? {},
156
+ sections: d.parsed?.secs ?? {},
157
+ cards: d.parsed?.cards ?? [],
158
+ },
159
+ };
160
+ }
161
+
162
+ /**
163
+ * The data file (`report-data/clearance-1`) as the document's client projection: the same producer, handed
164
+ * the document's values. Equal byte for byte to the file publish writes today.
165
+ */
166
+ export function clearanceReportDataOf(doc) {
167
+ const fm = doc.prose.frontMatter;
168
+ const { run, scope, verdict, client } = doc;
169
+ return clearanceReportData({
170
+ runId: run.runId, codename: run.codename, matter: fm.matter, markName: run.markName, title: fm.title,
171
+ customerKey: run.customerKey || 'generic', issued: run.issued, url: run.url, auditFile: run.auditFile,
172
+ // The stage label REGISTRY-FIRST: today's registry's label, the one report.html renders, so a republished
173
+ // pre-renumber run cannot carry one label on its page and another in its data file. The label frozen with the run
174
+ // is the last resort, for a level today's registry no longer knows; meta.json keeps the frozen one by design.
175
+ searchLevel: run.product.level, stageLabel: run.product.stageLabel ?? run.product.frozenStageLabel ?? null,
176
+ engineCommit: doc.build.engineCommit, servedModels: client.servedModels,
177
+ framework: doc.framework.manifest, verdictInfo: verdict.record, findings: client.findings,
178
+ coverage: client.coverage, contextNotes: client.contextNotes, markAssessment: client.markAssessment,
179
+ fourAnswers: client.fourAnswers, askAnswers: client.askAnswers,
180
+ actions: [...client.actions.conditions, ...client.actions.advisories],
181
+ jurisdiction: scope.jurisdiction, searchedJurisdictions: scope.searchedJurisdictions, scopeBasis: scope.scopeBasis,
182
+ caption: fm.overall_caption || null, assessmentNotCompleted: verdict.assessmentNotCompleted,
183
+ });
184
+ }
185
+
186
+ /**
187
+ * The rating a clearance's surfaces state, and its badge: the verdict record's as the page reads it, the report's front
188
+ * matter on a run older than the record, and none where the assessment was not completed. The page, the run record and
189
+ * the cover email read it here, so a saved verdict from an assessment that did not complete rates nothing on any of them.
190
+ */
191
+ export function clearanceRatingOf(doc) {
192
+ const fm = doc.prose.frontMatter, { record, assessmentNotCompleted } = doc.verdict;
193
+ if (assessmentNotCompleted) return { word: undefined, badge: undefined };
194
+ return { word: record?.tier ?? fm.overall_label, badge: record?.badge ?? fm.overall_badge };
195
+ }
196
+
197
+ /** The run's findings in their own order: the withdrawn ones are put back where they were. */
198
+ export function allFindingsOf(doc) {
199
+ const out = [...doc.client.findings];
200
+ for (const { at, finding } of doc.reviewer.withdrawn) out.splice(at, 0, finding);
201
+ return out;
202
+ }
203
+
204
+ /**
205
+ * The document with the workbook publishing wrote, or why there is none. The document is built before the workbook,
206
+ * which reads it, so the workbook's file name is set on it afterwards.
207
+ */
208
+ export const withWorkbook = (doc, { auditFile = null, auditError = null } = {}) => ({
209
+ ...doc, run: { ...doc.run, auditFile: auditFile || null }, staff: { ...doc.staff, auditError: auditError ?? null },
210
+ });
211
+
212
+ /**
213
+ * The audit workbook's inputs from the document: buildAudit's contract, the search log, and the front matter. The failing
214
+ * predelivery checks are handed over as their delivery lines, never their raw detail: the workbook's download link rides
215
+ * in the cover note a client principal reads, so the workbook is a delivery surface under the same rule.
216
+ */
217
+ export function clearanceWorkbookOf(doc) {
218
+ const { run, scope, verdict, client, reviewer } = doc;
219
+ const origins = run.provider.origins;
220
+ return {
221
+ contract: {
222
+ degradedParts: reviewer.degradedParts, droppedConditions: reviewer.droppedConditions,
223
+ undispatchedProbes: reviewer.undispatchedProbes, withheldFamilies: reviewer.withheldFamilies,
224
+ releasedFamilies: reviewer.releasedFamilies, setAside: reviewer.setAside, findings: allFindingsOf(doc),
225
+ frameworkMethod: doc.framework.method, coverage: client.coverage, contextNotes: client.contextNotes,
226
+ coverageJudgment: reviewer.coverageJudgment, markAssessment: client.markAssessment, corrections: reviewer.corrections,
227
+ fetchState: reviewer.fetchState, verdict: verdict.record, jurisdiction: scope.jurisdiction,
228
+ commonLawJoinedTerms: reviewer.commonLawJoinedTerms, registerOnly: scope.registerOnly, clientGate: reviewer.clientGate,
229
+ lintFailures: deliveryFlagLines(reviewer.lint), productName: run.product.name,
230
+ registerPublishesRecordPages: origins == null ? null : origins.length > 0,
231
+ recordLinks: client.recordLinks?.byUri ? new Map(client.recordLinks.byUri) : null,
232
+ assessmentNotCompleted: verdict.assessmentNotCompleted, registerReach: scope.registerReach, registerScope: scope.registerScope,
233
+ },
234
+ audit: reviewer.audit,
235
+ title: doc.prose.frontMatter.title,
236
+ frontMatter: doc.prose.frontMatter,
237
+ };
238
+ }
239
+
240
+ export const KNOCKOUT_DOCUMENT = 'report-document/knockout-1';
241
+
242
+ /**
243
+ * The Knockout run as one document: every name in the batch, with each name's report as publishing wrote it.
244
+ * `d` is readKnockoutDocument's return; `reports` is each name's report ({ mark, slug, file, url, band }), in
245
+ * the order publishing wrote them.
246
+ *
247
+ * The run's findings record is kept whole, under its own names. The data file renames four of a mark's fields
248
+ * (rating, ratingQualifier, bullets, purpleNotes) and goes on doing so in its projection: a rename here would be
249
+ * one more way for the build to fail, and the record is what the page reads.
250
+ */
251
+ export function knockoutReportDocument(d, { runId, codename = null, customerKey = null, findings, framework = null, overall = null, searchPolicy = null, depthNote = null, tokens = null, reports = [], auditFile = null, auditError = null }) {
252
+ const identity = d.identity ?? {};
253
+ return {
254
+ document: KNOCKOUT_DOCUMENT,
255
+ build: { engineCommit: orNull(d.engineCommit), renderedAt: orNull(d.dates?.renderedAt), tokens: orNull(tokens) },
256
+ run: {
257
+ runId: runId ?? null,
258
+ codename: codename ?? null,
259
+ customerKey: customerKey || null,
260
+ organisation: orNull(d.organisation),
261
+ title: orNull(d.title),
262
+ markNames: d.markNames ?? [],
263
+ issued: orNull(d.issued),
264
+ issuedAt: orNull(d.dates?.issuedAt),
265
+ searched: orNull(d.searched),
266
+ origin: orNull(d.origin),
267
+ auditFile: auditFile || null,
268
+ single: Boolean(d.single),
269
+ // Each name's report, with the band it carries: the name's own on a batch, the run's on one name.
270
+ reports: reports.map(({ mark, slug, file, url, band }) => ({ mark, slug, file, url: orNull(url), band: band ?? null })),
271
+ product: {
272
+ name: orNull(identity.identity), stageLabel: orNull(identity.stageLabel), template: orNull(identity.template),
273
+ banner: orNull(identity.banner), level: orNull(searchPolicy?.level), depthNote: orNull(depthNote),
274
+ },
275
+ provenance: {
276
+ recipe: orNull(searchPolicy?.recipe), enqueuedVia: orNull(searchPolicy?.enqueuedVia),
277
+ enqueuedBy: orNull(searchPolicy?.enqueuedBy), parentRunId: orNull(searchPolicy?.parentRunId),
278
+ },
279
+ },
280
+ scope: {
281
+ instructedScope: orNull(d.instructedScope),
282
+ scopeUnreadable: Boolean(d.scopeUnreadable),
283
+ // The frozen policy whole: the page composes "About this request" and the masthead from it.
284
+ policy: orNull(searchPolicy),
285
+ probeRan: Boolean(d.probeRan),
286
+ // The searches that did not complete, which the page's Left open and the workbook's part rows read.
287
+ steps: orNull(d.steps),
288
+ },
289
+ framework: { manifest: orNull(framework), method: orNull(d.frameworkMethod) },
290
+ verdict: { overall: orNull(overall), badge: orNull(d.overallBadge), statement: orNull(d.statement) },
291
+ client: {
292
+ findings: orNull(findings),
293
+ registerCounts: orNull(d.registerCounts),
294
+ registerRecords: orNull(d.registerRecords),
295
+ registerRecordsUnreadable: Boolean(d.registerRecordsUnreadable),
296
+ // By reference: each filing's saved record stays in the run's `_records/` or its record log.
297
+ filingRecords: d.filingRecords instanceof Map ? [...d.filingRecords.keys()] : [],
298
+ logos: d.logos instanceof Map ? [...d.logos].map(([ref, l]) => [ref, l?.state ?? null]) : [],
299
+ ownerChecks: d.ownerChecks ?? [],
300
+ recordLinks: d.officeLinks ? { tally: orNull(d.officeLinks.tally), summary: orNull(d.officeLinks.summary) } : null,
301
+ servedModels: orNull(d.served),
302
+ },
303
+ reviewer: {
304
+ sweepReceipts: d.sweepReceipts ?? [],
305
+ qcFlags: d.qcFlags ?? [],
306
+ machineChecksFailed: orNull(d.machineChecksFailed),
307
+ lookupsNotRun: d.lookupsNotRun ?? [],
308
+ recordsNotKept: d.recordsNotKept ?? [],
309
+ openPoints: d.openPoints ?? [],
310
+ recordLinksDropped: orNull(d.recordLinksDropped),
311
+ registerCountsUnreadable: Boolean(d.registerCountsUnreadable),
312
+ },
313
+ staff: { auditError: auditError ?? null },
314
+ };
315
+ }
316
+
317
+ /**
318
+ * One name's data file (`report-data/knockout-1`) as the document's client projection, by the name's place in
319
+ * the batch. Equal byte for byte to the file publishing writes for that name today.
320
+ */
321
+ export function knockoutReportDataOf(doc, at) {
322
+ const { run, client } = doc;
323
+ const findings = client.findings ?? {};
324
+ const m = (findings.marks ?? [])[at];
325
+ // The name's own slice, as publishing builds it: on a batch, the page opens with the name's own assessment.
326
+ const one = {
327
+ ...findings, marks: [m],
328
+ batch: { ...(findings.batch ?? {}), ...(run.single ? {} : { executiveSummary: String(m.assessment ?? '').trim() }) },
329
+ };
330
+ const report = run.reports[at];
331
+ return knockoutReportData(one, doc.framework.manifest, {
332
+ runId: run.runId, codename: run.codename, overall: report.band, issued: run.issued,
333
+ registerCounts: client.registerCounts, registerRecords: client.registerRecords, ownerChecks: client.ownerChecks,
334
+ auditFile: run.auditFile, customerKey: run.customerKey, matter: run.runId, servedModels: client.servedModels,
335
+ identity: { identity: run.product.name, stageLabel: run.product.stageLabel, level: run.product.level },
336
+ url: report.url,
337
+ });
338
+ }
339
+
340
+ /** The Knockout workbook's inputs from the document, under the names buildKnockoutWorkbook takes them. */
341
+ export function knockoutWorkbookOf(doc) {
342
+ const { client, reviewer, scope } = doc;
343
+ return {
344
+ findings: client.findings, sweepReceipts: reviewer.sweepReceipts, registerCounts: client.registerCounts,
345
+ qcFlags: reviewer.qcFlags, framework: doc.framework.manifest, registerRecords: client.registerRecords,
346
+ frameworkMethod: doc.framework.method, ownerChecks: [...client.ownerChecks, ...reviewer.lookupsNotRun],
347
+ parts: {
348
+ listing: client.registerRecords ? null : scope.steps.listing, reading: scope.steps.reading, review: scope.steps.review,
349
+ machineChecks: reviewer.machineChecksFailed, aboutThisRequest: scope.scopeUnreadable ? { reason: NOT_COMPLETED } : null,
350
+ droppedLinks: reviewer.recordLinksDropped, recordsNotKept: reviewer.recordsNotKept, openPoints: reviewer.openPoints,
351
+ },
352
+ };
353
+ }