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.
- package/INSTALL.md +7 -4
- package/QUICKSTART.md +1 -0
- package/README.md +5 -2
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/bin/clearotron.mjs +4 -2
- package/bin/onboard.mjs +158 -29
- package/build-info.json +2 -2
- package/docs/CLIENT-MCP.md +3 -1
- package/docs/DELIVERY.md +6 -3
- package/docs/architecture/02-architecture.md +1 -1
- package/docs/architecture/04-configuration-reference.md +105 -8
- package/docs/branding.md +4 -4
- package/docs/report-data/clearance-1.schema.json +320 -0
- package/docs/report-data/knockout-1.schema.json +268 -0
- package/driver/CHANGELOG.md +77 -0
- package/driver/cancel.mjs +19 -0
- package/driver/connotation-search.mjs +1 -1
- package/driver/contract-e3-backlog.mjs +41 -41
- package/driver/contract-vocabulary.mjs +1 -1
- package/driver/coverage-ledger.mjs +18 -2
- package/driver/deferral-row.mjs +1 -1
- package/driver/degraded-parts.mjs +1 -0
- package/driver/driver.config.mjs +5 -5
- package/driver/effective-scope.mjs +3 -1
- package/driver/engagement-receipt.mjs +3 -3
- package/driver/engine/anthropic-agent.mjs +15 -1
- package/driver/engine/common.mjs +7 -0
- package/driver/engine/mcp/band-server.mjs +7 -16
- package/driver/engine/mcp/codex-config.mjs +3 -0
- package/driver/engine/mcp/recording-server.mjs +45 -34
- package/driver/engine/openai-agent.mjs +74 -7
- package/driver/engine/session-record.mjs +44 -2
- package/driver/findings-model.mjs +14 -2
- package/driver/follow-up-twins.mjs +86 -0
- package/driver/gateway.mjs +77 -12
- package/driver/jx-units.mjs +3 -1
- package/driver/jx.mjs +13 -5
- package/driver/manuals-inline.mjs +98 -0
- package/driver/manuals-seen.mjs +134 -0
- package/driver/mark-logos.mjs +174 -0
- package/driver/methodology-witness.mjs +2 -1
- package/driver/owner-use-check.mjs +8 -4
- package/driver/package.json +1 -1
- package/driver/pipeline-knockout.mjs +23 -4
- package/driver/pipeline.mjs +128 -15
- package/driver/portal-local-auth.mjs +6 -2
- package/driver/portal-report.mjs +45 -14
- package/driver/portal-routes/me.mjs +4 -1
- package/driver/portal-runs.mjs +19 -16
- package/driver/predelivery-lint.mjs +7 -5
- package/driver/profiles.mjs +4 -4
- package/driver/publish/README.md +9 -7
- package/driver/publish/email-conditions.mjs +22 -5
- package/driver/publish/evidence-words.mjs +21 -0
- package/driver/publish/index.mjs +304 -211
- package/driver/publish/knockout.mjs +297 -247
- package/driver/publish/office-record-links.mjs +11 -9
- package/driver/publish/page-shell.mjs +98 -0
- package/driver/publish/pool-admin.mjs +2 -2
- package/driver/publish/publish-inputs.mjs +4 -0
- package/driver/publish/regions.mjs +28 -3
- package/driver/publish/register-record-html.mjs +105 -0
- package/driver/publish/register-record.mjs +165 -0
- package/driver/publish/render-knockout.mjs +299 -671
- package/driver/publish/render.mjs +561 -492
- package/driver/publish/report-data.mjs +226 -13
- package/driver/publish/report-document.mjs +353 -0
- package/driver/publish/search-depth.mjs +88 -7
- package/driver/publish/shell.mjs +41 -1
- package/driver/publish/strings.mjs +810 -0
- package/driver/publish/templates/clearance-print.css +23 -0
- package/driver/publish/templates/knockout.css +224 -0
- package/driver/publish/templates/report.css +112 -53
- package/driver/publish/xlsx.mjs +158 -139
- package/driver/record-goods.mjs +42 -0
- package/driver/reference-score.mjs +4 -1
- package/driver/register-count.mjs +5 -1
- package/driver/register-reach.mjs +39 -0
- package/driver/registry-fidelity.mjs +155 -37
- package/driver/repair-composers.mjs +7 -3
- package/driver/repair-targets.mjs +4 -1
- package/driver/replay-archive.mjs +4 -3
- package/driver/run-delivered.mjs +14 -8
- package/driver/run-record.mjs +1 -0
- package/driver/runner.mjs +73 -29
- package/driver/scope-facts.mjs +27 -6
- package/driver/search-policy.mjs +9 -4
- package/driver/skills/clearance-search/report-prose.md +3 -0
- package/driver/skills/knockout-assess/SKILL.md +8 -0
- package/driver/stage-freshness.mjs +8 -5
- package/driver/stages.mjs +69 -43
- package/driver/steps/delivery.mjs +9 -5
- package/driver/steps/overview-and-cards.mjs +54 -15
- package/driver/steps/register-sweep.mjs +5 -4
- package/driver/steps/skeptic-and-follow-up.mjs +3 -2
- package/driver/steps/verdict-gate.mjs +35 -14
- package/driver/suite-census.json +579 -87
- package/driver/synthesis-record.mjs +4 -3
- package/driver/terminal-clamp.mjs +6 -1
- package/driver/withdrawn-rating.mjs +72 -0
- package/mcp-server/CHANGELOG.md +8 -0
- package/mcp-server/lib/audit-view.mjs +5 -2
- package/mcp-server/lib/brief.mjs +6 -2
- package/mcp-server/lib/evidence.mjs +94 -23
- package/mcp-server/lib/findings.mjs +19 -2
- package/mcp-server/lib/knockout.mjs +13 -4
- package/mcp-server/lib/scrub.mjs +1 -1
- package/mcp-server/package.json +1 -1
- package/mcp-server/server.mjs +22 -3
- package/package.json +4 -1
- package/portal-ui/dist/assets/{index-CYaO2ygd.js → index-BBlN4CYq.js} +238 -80
- package/portal-ui/dist/assets/{index-izLa9apq.css → index-CxAkJXIT.css} +25 -5
- package/portal-ui/dist/index.html +2 -2
- package/portal-ui/package.json +3 -3
- package/providers/_shared/ledger.mjs +30 -2
- package/providers/_shared/record-uri.mjs +15 -0
- package/providers/clarivate/src/adapter.js +11 -0
- package/providers/clarivate/src/core.js +17 -1
- package/providers/jx/src/core.js +4 -4
- package/providers/jx/src/judge.js +1 -3
- package/providers/jx/src/nativeread.js +1 -3
- package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/scripts/README.md +147 -3
- package/scripts/added-reference-check.mjs +35 -7
- package/scripts/e2e-first-time.mjs +4 -4
- package/scripts/env-audit.mjs +16 -9
- package/scripts/freeze-example-run.mjs +3 -3
- package/scripts/mint-public-residue.mjs +3 -3
- package/scripts/mint-search-level-tags.mjs +61 -0
- package/scripts/mint-source-pin-census.mjs +89 -0
- package/scripts/release-note-required.mjs +65 -6
- package/scripts/test-durations-reporter.mjs +25 -0
- package/scripts/test-full.mjs +72 -18
- package/scripts/test-run.mjs +18 -1
- package/shared/brand.mjs +93 -6
- package/shared/inline-markdown.mjs +53 -0
- package/shared/names-in-force.mjs +0 -1
- package/shared/portal-tokens.mjs +2 -1
- package/shared/reference-guard-classes.mjs +43 -2
- package/shared/register-selection.mjs +8 -3
- package/shared/search-level-tags.json +25 -0
- package/shared/source-spans.mjs +91 -0
- package/shared/tools/derive-band-pairs.mjs +10 -0
- package/driver/own-rights.mjs +0 -83
- package/driver/use-check.mjs +0 -85
|
@@ -8,18 +8,21 @@
|
|
|
8
8
|
// palette (TONE_TIER, resolved against the run's FROZEN framework) so driver and interactive output
|
|
9
9
|
// can never drift and a knockout never reads the clearance composer's module state.
|
|
10
10
|
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
11
|
-
import {
|
|
11
|
+
import { publishRun } from './shell.mjs';
|
|
12
12
|
import { plainDeferralReason, plainCause } from '../deferral-row.mjs'; import { knockoutStepFailures, PART_NAMES, RULED_WORDS, NOT_COMPLETED, linkNotOnRegisterSite } from '../degraded-parts.mjs'; import { ownersOwedACheck, composeOwnerQuery } from '../owner-use-check.mjs'; import { KNOCKOUT_WEB } from '../stages-knockout.mjs'; // — the reader's words for a search left open; and the parts that failed as a whole
|
|
13
13
|
import { join } from 'node:path';
|
|
14
|
+
import { EMAIL_TIER } from '../../shared/brand.mjs';
|
|
14
15
|
import { riskTier, TONE_TIER, regenIndex, regenSurfaces, auditRouteFor, markReportRouteFor, reportRouteFor } from './index.mjs';
|
|
15
16
|
import { runKnockoutLint, deliveryFlagLines } from '../predelivery-lint.mjs';
|
|
16
17
|
import { note } from '../log.mjs';
|
|
17
18
|
import { addSheet } from './xlsx.mjs';
|
|
19
|
+
import { KNOCKOUT_EMAIL as KO, KNOCKOUT_WORKBOOK as KW, KNOCKOUT_PAGE as KP } from './strings.mjs';
|
|
18
20
|
import { COUNT_PREDICATES, COUNT_BASIS, countsForMark, countLine, countedMarks, variantFormsLine, disclosedFloor, moreThan, countNote } from '../register-count.mjs';
|
|
19
21
|
import { noneCarriedForward, recordsForMark, recordsLine, normalizeRegisterRecordLinks } from '../register-records.mjs';
|
|
20
22
|
import { reportIdentityFor, productCoverageNote, kebab } from '../search-policy.mjs';
|
|
21
23
|
import { batchMarkName } from '../mark-name.mjs';
|
|
22
|
-
import {
|
|
24
|
+
import { renderKnockoutDocument, DEGRADED_NOTE } from './render-knockout.mjs';
|
|
25
|
+
import { knockoutReportDocument, knockoutReportDataOf, knockoutWorkbookOf } from './report-document.mjs'; // the run's report as one document, and what it carries
|
|
23
26
|
import { readFrozenMethod, inputsLine, FROZEN_METHOD_FILE } from '../framework-method.mjs';
|
|
24
27
|
import { resolveDemoData, demoBannerMd } from './demo-marking.mjs'; //
|
|
25
28
|
import { engineCommit } from '../engine-build.mjs';
|
|
@@ -39,7 +42,7 @@ const esc = (s) => String(s ?? '').replace(/&/g, '&').replace(/</g, '<').
|
|
|
39
42
|
export function bandTier(framework, word) {
|
|
40
43
|
const tone = framework?.bands?.find((b) => String(b.label).toLowerCase() === String(word ?? '').trim().toLowerCase())?.tone;
|
|
41
44
|
if (tone && TONE_TIER[tone]) return { ...TONE_TIER[tone], label: String(word) };
|
|
42
|
-
return riskTier(word) ?? {
|
|
45
|
+
return riskTier(word) ?? { ...EMAIL_TIER.unrated, label: String(word ?? '—') };
|
|
43
46
|
}
|
|
44
47
|
// The email body is inline-styled and self-contained by contract (docs/DELIVERY.md: the courier sends
|
|
45
48
|
// `emailBodyHtml` verbatim), so it keeps a mail-safe font stack. The report does not — it has a stylesheet.
|
|
@@ -63,7 +66,7 @@ const bandCounts = (framework, marks) => {
|
|
|
63
66
|
return [...counts].filter(([, n]) => n > 0);
|
|
64
67
|
};
|
|
65
68
|
export const knockoutStatement = (framework, marks) =>
|
|
66
|
-
|
|
69
|
+
KP.statement(marks.length, bandCounts(framework, marks).map(([l, n]) => `${n} ${l}`).join(', ') || KP.noRatedMarks);
|
|
67
70
|
|
|
68
71
|
// The MSO review table and its bare-<div> page wrapper are DELETED (2026-07-28). They were a
|
|
69
72
|
// byte-faithful port of the interactive skill's Word template — `border:solid windowtext 1pt`, Calibri
|
|
@@ -97,6 +100,9 @@ export const knockoutStatement = (framework, marks) =>
|
|
|
97
100
|
// than "never asked for". 'Impact' goes with them: it was the second rating scale. What replaces them is
|
|
98
101
|
// what the typed record actually carries. A `—` means the shape that produced the row never had the
|
|
99
102
|
// field (an archived prose finding), which is a different fact from an empty cell.
|
|
103
|
+
// What a Knockout left open is drawn by the page (render-knockout.mjs), which reads it from the run's report document.
|
|
104
|
+
export { knockoutLeftOpen } from './render-knockout.mjs';
|
|
105
|
+
|
|
100
106
|
export async function buildKnockoutWorkbook(findings, receipts, outPath, registerCounts = null, qcFlags = [], framework = null, registerRecords = null, frameworkMethod = null, ownerChecks = [], degraded = {}) {
|
|
101
107
|
const ExcelJS = (await import('exceljs')).default;
|
|
102
108
|
const wb = new ExcelJS.Workbook();
|
|
@@ -116,7 +122,7 @@ export async function buildKnockoutWorkbook(findings, receipts, outPath, registe
|
|
|
116
122
|
});
|
|
117
123
|
}
|
|
118
124
|
for (const n of m.negatives ?? []) {
|
|
119
|
-
negativeRows.push({ 'Mark': m.name, 'Search Term': n.term ?? '', 'Source / Context': n.source ?? '', 'Result': n.note ??
|
|
125
|
+
negativeRows.push({ 'Mark': m.name, 'Search Term': n.term ?? '', 'Source / Context': n.source ?? '', 'Result': n.note ?? KW.noResults, 'Notes': '' });
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
128
|
// EACH CELL'S QUERY, not just its spelling. Since the knockout's cells search the spelling followed by
|
|
@@ -134,10 +140,9 @@ export async function buildKnockoutWorkbook(findings, receipts, outPath, registe
|
|
|
134
140
|
// was searched on. An archived run's rows print as they were delivered: the mark as the term, and on
|
|
135
141
|
// its second web question the kinds of use it asked about, in the frame's words.
|
|
136
142
|
'Mark': r.mark, 'Search Term': searchedTerms(r),
|
|
137
|
-
'Source / Context': `${r.executor ?? 'perplexity'} (${r.preset ?? ''})${Array.isArray(r.places) && r.places.length ? ` — ${r.places.join(', ')}` : r.question && r.inUseAs ?
|
|
138
|
-
'Result Summary': r.ok ?
|
|
143
|
+
'Source / Context': `${r.executor ?? 'perplexity'} (${r.preset ?? ''})${Array.isArray(r.places) && r.places.length ? ` — ${r.places.join(', ')}` : r.question && r.inUseAs ? KW.inUseAs(r.inUseAs) : ''}`,
|
|
144
|
+
'Result Summary': r.ok ? KW.callOk(r.bytes ?? 0) : KW.failed(plainCause(r.cause)),
|
|
139
145
|
'Finding Reference': r.ok && refByMark.has(r.mark) ? refByMark.get(r.mark) : '',
|
|
140
|
-
'Sweep Call #': r.callNo ?? '', 'Wall-time (s)': r.took_ms != null ? Math.round(r.took_ms / 1000) : '', 'OK/Degraded': r.ok ? 'OK' : 'Degraded',
|
|
141
146
|
}));
|
|
142
147
|
// AN OWNER LOOKUP THAT GOT NO ANSWER (ruling 498): the card still prints its use-check line, so the
|
|
143
148
|
// failure is recorded here, in the trail's own columns and words, beside the web searches. Only a failed
|
|
@@ -147,15 +152,15 @@ export async function buildKnockoutWorkbook(findings, receipts, outPath, registe
|
|
|
147
152
|
if (!c || c.ok) continue;
|
|
148
153
|
trailRows.push({
|
|
149
154
|
'Mark': c.mark, 'Search Term': c.query ?? '', 'Source / Context': `perplexity (${c.preset ?? ''})`,
|
|
150
|
-
'Result Summary':
|
|
151
|
-
'Finding Reference': '',
|
|
155
|
+
'Result Summary': KW.failed(plainCause(c.cause)),
|
|
156
|
+
'Finding Reference': '',
|
|
152
157
|
});
|
|
153
158
|
}
|
|
154
159
|
// THE PARTS THAT FAILED AS A WHOLE (ruled 2026-09-25, 537 and 539), in the trail's own columns: the
|
|
155
160
|
// part's name where a search would be named, the reader's line for a part left open, and every other
|
|
156
161
|
// cell `—`. A run with none of them builds the workbook it built before.
|
|
157
162
|
const partRow = (name, reason) => ({ 'Mark': '—', 'Search Term': '—', 'Source / Context': name,
|
|
158
|
-
'Result Summary':
|
|
163
|
+
'Result Summary': KW.failed(plainDeferralReason(reason)), 'Finding Reference': '—' });
|
|
159
164
|
if (degraded.reading) trailRows.push(partRow(PART_NAMES.register, degraded.reading.reason));
|
|
160
165
|
if (degraded.review) trailRows.push(partRow(RULED_WORDS.plainLanguageReview, degraded.review.reason));
|
|
161
166
|
if (degraded.machineChecks) trailRows.push(partRow(PART_NAMES.machineChecks, degraded.machineChecks.reason));
|
|
@@ -164,7 +169,7 @@ export async function buildKnockoutWorkbook(findings, receipts, outPath, registe
|
|
|
164
169
|
// says the record was not kept, and never that the search failed.
|
|
165
170
|
for (const r of degraded.recordsNotKept ?? []) {
|
|
166
171
|
trailRows.push({ 'Mark': r.mark, 'Search Term': '—', 'Source / Context': `perplexity (${r.preset ?? ''})`,
|
|
167
|
-
'Result Summary': RULED_WORDS.recordNotKept, 'Finding Reference': '—'
|
|
172
|
+
'Result Summary': RULED_WORDS.recordNotKept, 'Finding Reference': '—' });
|
|
168
173
|
}
|
|
169
174
|
// WHAT THE SEARCH RETURNED AND THE RATING DID NOT CARRY, each with the ground the rater wrote (ruled
|
|
170
175
|
// 2026-09-26). Set-aside reasons live in the audit workbook and never in the report, so this sheet is
|
|
@@ -192,14 +197,16 @@ export async function buildKnockoutWorkbook(findings, receipts, outPath, registe
|
|
|
192
197
|
// A row with no url has nothing to name and nothing to look up, so it is the one shape that
|
|
193
198
|
// cannot be printed at all.
|
|
194
199
|
if (!url) continue;
|
|
195
|
-
trailRows.push({ 'Mark': m.name, 'Search Term':
|
|
200
|
+
trailRows.push({ 'Mark': m.name, 'Search Term': KW.setAside(url), 'Source / Context': '—',
|
|
196
201
|
'Result Summary': ground,
|
|
197
|
-
'Finding Reference': '—'
|
|
202
|
+
'Finding Reference': '—' });
|
|
198
203
|
}
|
|
199
204
|
}
|
|
200
205
|
addSheet(wb, 'Findings', ['Mark', 'Finding Reference', 'Finding Name', 'Owner', 'Band', 'Type', 'Net', 'Basis', 'Evidence'], findingRows);
|
|
201
206
|
addSheet(wb, 'Negative Results', ['Mark', 'Search Term', 'Source / Context', 'Result', 'Notes'], negativeRows);
|
|
202
|
-
|
|
207
|
+
// The sweep's call number, its wall time and OK/Degraded are the engine's, not the lawyer's: they stay in the run
|
|
208
|
+
// record and leave this sheet (2026-11-18).
|
|
209
|
+
addSheet(wb, 'Audit Trail', ['Mark', 'Search Term', 'Source / Context', 'Result Summary', 'Finding Reference'], trailRows);
|
|
203
210
|
// ── Depth 2: an EXTRA sheet, only when counts were taken ────────────────────────────────────────
|
|
204
211
|
// Additive by design: the three sheets above are the interactive skill's exact contract and a
|
|
205
212
|
// knockout without counts produces a byte-identical workbook. A count that could not be taken says
|
|
@@ -213,37 +220,37 @@ export async function buildKnockoutWorkbook(findings, receipts, outPath, registe
|
|
|
213
220
|
const noteRows = [];
|
|
214
221
|
// WHAT THE LOOK AT THE CORRECTED RECORD STILL FOUND, for the reviewing lawyer, in its own words. Not on the client's report.
|
|
215
222
|
// Where the run could not close it, the note says why, so the lawyer can tell a repair that failed from a look that did not run.
|
|
216
|
-
const OPEN_BECAUSE =
|
|
217
|
-
for (const p of degraded.openPoints ?? []) noteRows.push({ 'Mark': p.mark, 'Type':
|
|
223
|
+
const OPEN_BECAUSE = KW.openBecause;
|
|
224
|
+
for (const p of degraded.openPoints ?? []) noteRows.push({ 'Mark': p.mark, 'Type': KW.internalNote, 'Note': `${OPEN_BECAUSE[p.state] ?? ''}${p.problem}` });
|
|
218
225
|
for (const m of findings.marks ?? []) {
|
|
219
|
-
for (const n of m.purpleNotes ?? []) noteRows.push({ 'Mark': m.name, 'Type':
|
|
220
|
-
if (m.registerEstimate) noteRows.push({ 'Mark': m.name, 'Type':
|
|
226
|
+
for (const n of m.purpleNotes ?? []) noteRows.push({ 'Mark': m.name, 'Type': KW.internalNote, 'Note': n });
|
|
227
|
+
if (m.registerEstimate) noteRows.push({ 'Mark': m.name, 'Type': KW.registerEstimate, 'Note': m.registerEstimate });
|
|
221
228
|
}
|
|
222
229
|
if (noteRows.length) addSheet(wb, 'Working Notes', ['Mark', 'Type', 'Note'], noteRows);
|
|
223
230
|
|
|
224
231
|
if (registerCounts?.marks?.length) {
|
|
225
232
|
// A floor the register disclosed is its own figure, printed as the report prints it.
|
|
226
|
-
const cell = (c) => (Number.isFinite(c?.total) ? c.total : disclosedFloor(c) !== null ? moreThan(disclosedFloor(c)) :
|
|
233
|
+
const cell = (c) => (Number.isFinite(c?.total) ? c.total : disclosedFloor(c) !== null ? moreThan(disclosedFloor(c)) : KW.notAvailable);
|
|
227
234
|
const countRows = (findings.marks ?? []).map((m) => {
|
|
228
235
|
const e = countsForMark(registerCounts, m.name);
|
|
229
236
|
const row = {
|
|
230
237
|
'Mark': m.name,
|
|
231
|
-
'Classes counted': (e?.classes ?? []).join(', ') ||
|
|
232
|
-
'Territories': (registerCounts.scope?.regions ?? []).join(', ') ||
|
|
238
|
+
'Classes counted': (e?.classes ?? []).join(', ') || KW.allClasses,
|
|
239
|
+
'Territories': (registerCounts.scope?.regions ?? []).join(', ') || KW.worldwide,
|
|
233
240
|
};
|
|
234
241
|
for (const p of COUNT_PREDICATES) row[p.column] = cell(e?.counts?.[p.key]);
|
|
235
242
|
// WHICH FORMS the close column was counted over. Without it the aggregate is a number nobody can
|
|
236
243
|
// check: two runs of the same mark under different rule tables produce different figures and the
|
|
237
244
|
// sheet would show no reason why. An archived schema-1 row (no expansion cell) says so in words
|
|
238
245
|
// rather than showing a blank, which on this sheet reads as "none".
|
|
239
|
-
row['Close variation forms'] = variantFormsLine(e) ??
|
|
246
|
+
row['Close variation forms'] = variantFormsLine(e) ?? KW.formsNotRecorded;
|
|
240
247
|
row['Register'] = registerCounts.providerLabel ?? registerCounts.provider ?? '';
|
|
241
248
|
row['Basis'] = COUNT_BASIS;
|
|
242
249
|
// The reader's line for anything missing. The provider's own reason, or an exception's message, stays
|
|
243
250
|
// in the counts record where it was written (register-count.mjs, countNote).
|
|
244
251
|
row['Notes'] = COUNT_PREDICATES
|
|
245
252
|
.filter((p) => !Number.isFinite(e?.counts?.[p.key]?.total) && disclosedFloor(e?.counts?.[p.key]) === null)
|
|
246
|
-
.map((p) => `${p.label}: ${countNote(e?.counts?.[p.key]) ??
|
|
253
|
+
.map((p) => `${p.label}: ${countNote(e?.counts?.[p.key]) ?? KW.noCountRecorded}`)
|
|
247
254
|
.join(' · ');
|
|
248
255
|
return row;
|
|
249
256
|
});
|
|
@@ -271,15 +278,15 @@ export async function buildKnockoutWorkbook(findings, receipts, outPath, registe
|
|
|
271
278
|
const recordRows = [];
|
|
272
279
|
// The cell says which question found the filing: `default` is the register's containing search. An owner search is no
|
|
273
280
|
// question about the name, so it gets no word here. An archived listing names no predicate, so it reads as it did.
|
|
274
|
-
const basisCell = (basis, predicate) => (predicate === 'default' ?
|
|
275
|
-
: predicate === 'owner' ? '—' : basis === 'close' ?
|
|
281
|
+
const basisCell = (basis, predicate) => (predicate === 'default' ? KW.containingSearch : predicate === 'phonetic' ? KW.soundAlikeSearch
|
|
282
|
+
: predicate === 'owner' ? '—' : basis === 'close' ? KW.closeVariation : KW.identical);
|
|
276
283
|
for (const m of findings.marks ?? []) {
|
|
277
284
|
const e = recordsForMark(registerRecords, m.name);
|
|
278
285
|
if (!e) {
|
|
279
286
|
recordRows.push({
|
|
280
|
-
'Mark': m.name, 'Matched form': '—', 'Basis': '—', 'Trademark':
|
|
287
|
+
'Mark': m.name, 'Matched form': '—', 'Basis': '—', 'Trademark': KW.notListed,
|
|
281
288
|
'Owner': '—', 'Status': '—', 'Classes': '—', 'Territory': '—', 'Filed': '—', 'Registered': '—',
|
|
282
|
-
'Record': '—', 'Note': registerRecords.unavailable ??
|
|
289
|
+
'Record': '—', 'Note': registerRecords.unavailable ?? KW.noListingRecorded,
|
|
283
290
|
});
|
|
284
291
|
continue;
|
|
285
292
|
}
|
|
@@ -305,30 +312,30 @@ export async function buildKnockoutWorkbook(findings, receipts, outPath, registe
|
|
|
305
312
|
if (t.ok) continue;
|
|
306
313
|
recordRows.push({
|
|
307
314
|
'Mark': m.name, 'Matched form': t.term, 'Basis': basisCell(t.basis, t.predicate),
|
|
308
|
-
'Trademark':
|
|
315
|
+
'Trademark': KW.notAvailable, 'Owner': '—', 'Status': '—', 'Classes': '—', 'Territory': '—',
|
|
309
316
|
'Filed': '—', 'Registered': '—', 'Record': '—',
|
|
310
|
-
'Note': !t.reason ?
|
|
317
|
+
'Note': !t.reason ? KW.searchDidNotRun : t.notAsked ? t.reason : plainCause(t.reason),
|
|
311
318
|
});
|
|
312
319
|
}
|
|
313
320
|
// An added class's question that has no answer is on the sheet as what it is, with the reason where one was given.
|
|
314
321
|
for (const t of e.terms ?? []) {
|
|
315
322
|
if (!t.unresolved) continue;
|
|
316
323
|
recordRows.push({
|
|
317
|
-
'Mark': m.name, 'Matched form': t.term, 'Basis':
|
|
318
|
-
'Filed': '—', 'Registered': '—', 'Record': '—', 'Note': t.reason ??
|
|
324
|
+
'Mark': m.name, 'Matched form': t.term, 'Basis': KW.identical, 'Trademark': KW.notAvailable, 'Owner': '—', 'Status': '—', 'Classes': (t.classes ?? []).join(', ') || '—', 'Territory': '—',
|
|
325
|
+
'Filed': '—', 'Registered': '—', 'Record': '—', 'Note': t.reason ?? KW.searchDidNotRun,
|
|
319
326
|
});
|
|
320
327
|
}
|
|
321
328
|
if (!(e.records ?? []).length && (e.terms ?? []).every((t) => t.ok)) {
|
|
322
329
|
// A count above zero that nothing read is not none: the register holds filings under it.
|
|
323
330
|
recordRows.push({
|
|
324
|
-
'Mark': m.name, 'Matched form': '—', 'Basis': '—', 'Trademark': noneCarriedForward(e) ?
|
|
331
|
+
'Mark': m.name, 'Matched form': '—', 'Basis': '—', 'Trademark': noneCarriedForward(e) ? KW.noneCarriedForward : (e.terms ?? []).some((t) => t.setAside) ? KW.notAvailable : KW.noneFound,
|
|
325
332
|
'Owner': '—', 'Status': '—', 'Classes': '—', 'Territory': '—', 'Filed': '—', 'Registered': '—',
|
|
326
333
|
'Record': '—', 'Note': recordsLine(e) ?? '',
|
|
327
334
|
});
|
|
328
335
|
}
|
|
329
336
|
if (e.capped) {
|
|
330
337
|
recordRows.push({
|
|
331
|
-
'Mark': m.name, 'Matched form': '—', 'Basis': '—', 'Trademark':
|
|
338
|
+
'Mark': m.name, 'Matched form': '—', 'Basis': '—', 'Trademark': KW.cappedAt(e.cap),
|
|
332
339
|
'Owner': '—', 'Status': '—', 'Classes': '—', 'Territory': '—', 'Filed': '—', 'Registered': '—',
|
|
333
340
|
'Record': '—', 'Note': recordsLine(e) ?? '',
|
|
334
341
|
});
|
|
@@ -343,7 +350,7 @@ export async function buildKnockoutWorkbook(findings, receipts, outPath, registe
|
|
|
343
350
|
addSheet(wb, 'Register Filings',
|
|
344
351
|
['Mark', 'Matched form', 'Basis', 'Trademark', 'Owner', 'Status', 'Classes', 'Territory', 'Filed', 'Registered', 'Record', 'Note'],
|
|
345
352
|
(findings.marks ?? []).map((m) => ({
|
|
346
|
-
'Mark': m.name, 'Matched form': '—', 'Basis': '—', 'Trademark':
|
|
353
|
+
'Mark': m.name, 'Matched form': '—', 'Basis': '—', 'Trademark': KW.notAvailable, 'Owner': '—', 'Status': '—',
|
|
347
354
|
'Classes': '—', 'Territory': '—', 'Filed': '—', 'Registered': '—', 'Record': '—', 'Note': plainDeferralReason(degraded.listing.reason),
|
|
348
355
|
})));
|
|
349
356
|
}
|
|
@@ -358,8 +365,8 @@ export async function buildKnockoutWorkbook(findings, receipts, outPath, registe
|
|
|
358
365
|
const qcLines = (Array.isArray(qcFlags) ? qcFlags : []).filter((l) => typeof l === 'string' && l.trim());
|
|
359
366
|
if (qcLines.length) {
|
|
360
367
|
addSheet(wb, 'Machine Checks', ['Check', 'What it found'], [
|
|
361
|
-
{ 'Check':
|
|
362
|
-
...qcLines.map((l, i) => ({ 'Check':
|
|
368
|
+
{ 'Check': KW.checksFlagged, 'What it found': KW.checksFlaggedCount(qcLines.length) },
|
|
369
|
+
...qcLines.map((l, i) => ({ 'Check': KW.check(i + 1), 'What it found': l })),
|
|
363
370
|
]);
|
|
364
371
|
}
|
|
365
372
|
await wb.xlsx.writeFile(outPath);
|
|
@@ -391,6 +398,23 @@ export const knockoutName = (searchPolicy) => reportIdentityFor(searchPolicy ??
|
|
|
391
398
|
export const knockoutRecordTitle = (searchPolicy, runId) =>
|
|
392
399
|
`${[knockoutName(searchPolicy)?.toUpperCase(), 'REPORT'].filter(Boolean).join(' ')} — ${runId}`;
|
|
393
400
|
|
|
401
|
+
/**
|
|
402
|
+
* The Knockout's cover email as the delivery sends it: the findings, the band ladder, the batch's band, the machine-check
|
|
403
|
+
* lines, the register counts and the product's name from the run's report document where it has one, and as the lane holds
|
|
404
|
+
* them where it has none (a run published before the document existed). The counts are the ones the page states, from the
|
|
405
|
+
* run's saved count record, so the email cannot state figures the page does not, and a count the record lacks is left out
|
|
406
|
+
* rather than read as none.
|
|
407
|
+
*/
|
|
408
|
+
export function composeKnockoutCoverNote(runDir, { findings, framework, overall, reports, auditUrl, job, registerCounts, qcFlags, productName }) {
|
|
409
|
+
let document = null;
|
|
410
|
+
try { document = readJson(paths(runDir).reportDocument); } catch { /* a run published before the document */ }
|
|
411
|
+
if (!document) return composeKnockoutEmail({ findings, framework, overall, reports, auditUrl, job, registerCounts, qcFlags, productName });
|
|
412
|
+
return composeKnockoutEmail({
|
|
413
|
+
findings: document.client.findings, framework: document.framework.manifest, overall: document.verdict.overall,
|
|
414
|
+
reports, auditUrl, job, registerCounts: document.client.registerCounts, qcFlags: document.reviewer.qcFlags, productName: document.run.product.name,
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
|
|
394
418
|
export function composeKnockoutEmail({ findings, framework, overall, reports = [], auditUrl = null, job, registerCounts = null, qcFlags = [], productName = null }) {
|
|
395
419
|
const t = bandTier(framework, overall);
|
|
396
420
|
const n = (findings.marks ?? []).length;
|
|
@@ -401,24 +425,24 @@ export function composeKnockoutEmail({ findings, framework, overall, reports = [
|
|
|
401
425
|
const only = n === 1 ? urlByMark.get((findings.marks ?? [])[0]?.name) ?? null : null;
|
|
402
426
|
// The product's name and the reference, each where there is one: a part left out leaves no dash or colon behind it.
|
|
403
427
|
const lead = [productName, job?.ref].filter(Boolean).map((p) => esc(p)).join(' — ');
|
|
404
|
-
const head = `<p style="${FONT}">${lead ? `${lead}: ` : ''}<b>${n}
|
|
405
|
-
+ (only ? ` <a href="${esc(only)}"
|
|
406
|
-
+ (!only && n > 1 ? `
|
|
428
|
+
const head = `<p style="${FONT}">${lead ? `${lead}: ` : ''}<b>${KO.marks(n)}</b>, ${n === 1 ? KO.rating : KO.highestRating} <b style="color:${t.txt}">${esc(overall ?? '')}</b>.`
|
|
429
|
+
+ (only ? ` <a href="${esc(only)}">${KO.openReport}</a>${auditUrl ? ` · <a href="${esc(auditUrl)}">${KO.auditWorkbook}</a>` : ''}.` : '')
|
|
430
|
+
+ (!only && n > 1 ? ` ${KO.onePerName}${auditUrl ? KO.batchWorkbook(`<a href="${esc(auditUrl)}">${KO.auditWorkbook}</a>`) : ''}.` : '') + `</p>`;
|
|
407
431
|
// — THE FIRST NON-BLANK, never element 0. `?? fallback` catches null and undefined
|
|
408
432
|
// and not "", so an array whose first entry was an empty string put an empty italic line at the top of
|
|
409
433
|
// the requester's email. That array shape reaches here now that the lint no longer refuses it, and the
|
|
410
434
|
// fallback exists precisely so this line is never blank.
|
|
411
435
|
const firstCaveat = (findings.batch?.standardCaveats ?? []).map((c) => String(c ?? "").trim()).find(Boolean);
|
|
412
|
-
const caveat = `<p style="${FONT}"><i>${esc(firstCaveat ||
|
|
436
|
+
const caveat = `<p style="${FONT}"><i>${esc(firstCaveat || KO.defaultCaveat)}</i></p>`;
|
|
413
437
|
// One band and the classes behind it, or where the evidence divides them, each group's band and classes.
|
|
414
|
-
const oneBand = (band, qualifier, classes) => `<b style="color:${bandTier(framework, band).txt ?? 'black'}">${esc(band)}${qualifier ? ` (${esc(qualifier)})` : ''}</b>${classes?.length ? ` —
|
|
438
|
+
const oneBand = (band, qualifier, classes) => `<b style="color:${bandTier(framework, band).txt ?? 'black'}">${esc(band)}${qualifier ? ` (${esc(qualifier)})` : ''}</b>${classes?.length ? ` — ${KO.classes} ${esc(classes.join(', '))}` : ''}`;
|
|
415
439
|
const bandLine = (m) => (Array.isArray(m.classGroups) && m.classGroups.length
|
|
416
440
|
? m.classGroups.map((g) => oneBand(g.band, g.ratingQualifier, g.classes)).join('; ')
|
|
417
441
|
: oneBand(m.rating, m.ratingQualifier, m.classesDriving));
|
|
418
442
|
const lines = (findings.marks ?? []).map((m) => {
|
|
419
443
|
const counted = registerCounts ? countLine(countsForMark(registerCounts, m.name)) : null;
|
|
420
444
|
const href = n > 1 ? urlByMark.get(m.name) ?? null : null;
|
|
421
|
-
return `<li><b>${esc(m.name)}</b>: ${bandLine(m)}${counted ? ` — ${esc(counted)}` : ''}${m.degraded ?
|
|
445
|
+
return `<li><b>${esc(m.name)}</b>: ${bandLine(m)}${counted ? ` — ${esc(counted)}` : ''}${m.degraded ? ` — <i>${KO.manualCheck}</i>` : ''}${href ? ` — <a href="${esc(href)}">${KO.openThisReport}</a>` : ''}</li>`;
|
|
422
446
|
}).join('');
|
|
423
447
|
// A10, extended to this lane 2026-07-31 — the surviving machine-check flags reach the reviewing
|
|
424
448
|
// lawyer WITH the report, in the projection's own words, or they reach nobody. The gate stays a gate:
|
|
@@ -504,6 +528,9 @@ export async function readKnockoutDocument({ runId, runDir, findings, plan, fram
|
|
|
504
528
|
let registerRecords = null, registerRecordsUnreadable = false;
|
|
505
529
|
try { registerRecords = readJson(paths(runDir).registerRecords); }
|
|
506
530
|
catch { registerRecords = null; registerRecordsUnreadable = existsSync(paths(runDir).registerRecords); }
|
|
531
|
+
// Each listed filing's saved record, which its register record drop-down is built from, and each one's saved logo.
|
|
532
|
+
// A run that saved no records, or fetched no logos, has none, and its table renders as before.
|
|
533
|
+
const filingRecords = filingRecordBodies(runDir, registerRecords), logos = logosForReport(runDir);
|
|
507
534
|
// The owner lookups this run made, read the same tolerant way as the records above:
|
|
508
535
|
// an archived run that predates the lane has no file, and its cards then render exactly as they were
|
|
509
536
|
// delivered. The source line the report prints comes from HERE, not from anything the seat typed.
|
|
@@ -704,7 +731,7 @@ export async function readKnockoutDocument({ runId, runDir, findings, plan, fram
|
|
|
704
731
|
const organisation = (() => { try { const f = readJson(paths(runDir).profile); return typeof f?.organisation === 'string' && f.organisation ? f.organisation : undefined; } catch { return undefined; } })();
|
|
705
732
|
return {
|
|
706
733
|
receipts, dates, issued, searched, sweepReceipts, registerCounts, registerCountsUnreadable, registerRecords,
|
|
707
|
-
registerRecordsUnreadable, ownerChecks, instructedScope, scopeUnreadable, frameworkMethod, recordLinksDropped,
|
|
734
|
+
registerRecordsUnreadable, filingRecords, logos, ownerChecks, instructedScope, scopeUnreadable, frameworkMethod, recordLinksDropped,
|
|
708
735
|
officeLinks, qcFlags, machineChecksFailed, steps, lookupsNotRun, recordsNotKept, openPoints, identity, probeRan,
|
|
709
736
|
markRows, single, origin, reportUrlFor, demoData, served, statement, markNames, organisation,
|
|
710
737
|
// WHICH BUILD produced this, read once for every surface that records it. null off a git checkout.
|
|
@@ -736,206 +763,125 @@ export async function readKnockoutDocument({ runId, runDir, findings, plan, fram
|
|
|
736
763
|
// SAME three-state confidentiality rule the clearance does. It defaults to null — the no-opinion state,
|
|
737
764
|
// which renders the plain marking this template always printed — so the ~15 fixtures in
|
|
738
765
|
// knockout-units.test.mjs that call this without one are unaffected by its arrival.
|
|
739
|
-
export async function publishKnockout(
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
const { receipts, dates, issued, searched, sweepReceipts, registerCounts, registerRecords, registerRecordsUnreadable,
|
|
743
|
-
ownerChecks, instructedScope, scopeUnreadable, frameworkMethod, recordLinksDropped, officeLinks, qcFlags,
|
|
744
|
-
machineChecksFailed, steps, lookupsNotRun, recordsNotKept, openPoints, identity, probeRan, markRows, single, origin,
|
|
745
|
-
reportUrlFor, demoData, served, statement, markNames, organisation, issuedDateUtc, title, overallBadge } = doc;
|
|
746
|
-
const { poolRunDir, writeRO, copyRO, buildWorkbook, writeDataFile } = openPoolRun(poolRoot, runId, { runDir });
|
|
766
|
+
export async function publishKnockout(input) {
|
|
767
|
+
return publishRun(KNOCKOUT_SHAPE, input);
|
|
768
|
+
}
|
|
747
769
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
770
|
+
// The Knockout's parts of the publishing order (shell.mjs publishRun).
|
|
771
|
+
const KNOCKOUT_SHAPE = {
|
|
772
|
+
regenIndex, regenSurfaces,
|
|
773
|
+
async read({ runId, codename, runDir, findings, plan, framework, overall, poolRoot, poolUrl, customerKey, searchPolicy, tokens, registerCounts: givenCounts = null, delivery = null }) {
|
|
774
|
+
// `givenCounts`: counts the lane already holds; the document reads the run's own when none are given.
|
|
775
|
+
const doc = await readKnockoutDocument({ runId, runDir, findings, plan, framework, overall, poolRoot, poolUrl, customerKey, searchPolicy, registerCounts: givenCounts });
|
|
776
|
+
const { markRows, single, reportUrlFor } = doc;
|
|
777
|
+
// Each name's report: its file, its address, and its band. `overall` on a one-mark document is that mark's rating,
|
|
778
|
+
// never the batch's worst, or a clean name would inherit a blocking name's colour.
|
|
779
|
+
const named = markRows.map((m) => {
|
|
780
|
+
const slug = kebab(m.name);
|
|
781
|
+
return { mark: m.name, slug, file: single ? 'report.html' : `report-${slug}.html`, url: reportUrlFor(slug), band: single ? overall : worstBand(framework, [m]) };
|
|
782
|
+
});
|
|
783
|
+
return { doc, named, runId, codename, runDir, findings, framework, overall, customerKey, searchPolicy, tokens, delivery };
|
|
784
|
+
},
|
|
785
|
+
keep({ copyRO }, { runDir }) {
|
|
786
|
+
// ── THE RUN'S WORKING RECORD TRAVELS WITH THE REPORT ──────────────────────────────────────────────
|
|
787
|
+
//
|
|
788
|
+
// The delivered directory held the report, its data and the workbook, and nothing the engine itself
|
|
789
|
+
// wrote. That is what a check of the delivered report needs to tell a line the ENGINE wrote from a line
|
|
790
|
+
// the RENDERER invented: without it the check can still place a line as report text or as a sanctioned
|
|
791
|
+
// label, so it passes — and cannot fail in the way it exists to fail. A clearance run's record is
|
|
792
|
+
// `audit.md` and `findings.json`; this lane's own names are these two, and they are copied rather
|
|
793
|
+
// than rebuilt so the pool carries the bytes the stages wrote.
|
|
794
|
+
//
|
|
795
|
+
// AN ABSENT ONE IS SAID, NOT SKIPPED. A run whose stage never wrote its assessment is a different
|
|
796
|
+
// thing from a run that wrote one, and a publisher that copies what it finds and says nothing about
|
|
797
|
+
// what it does not makes the two look identical to the next reader — which is the whole defect this
|
|
798
|
+
// closes, one directory along.
|
|
799
|
+
for (const name of ['knockout-findings.json', 'knockout-assessment.md']) {
|
|
800
|
+
const src = join(runDir, name);
|
|
801
|
+
if (existsSync(src)) {
|
|
802
|
+
copyRO(src, name);
|
|
803
|
+
} else {
|
|
804
|
+
note(`knockout working record: ${name} is not in the run directory, so the delivered report has no engine text to be checked against`);
|
|
805
|
+
}
|
|
767
806
|
}
|
|
768
|
-
}
|
|
807
|
+
},
|
|
808
|
+
document: ({ doc, named, runId, codename, customerKey, findings, framework, overall, searchPolicy, tokens }) => knockoutReportDocument(doc, {
|
|
809
|
+
runId, codename, customerKey, findings, framework, overall, searchPolicy: searchPolicy ?? null,
|
|
810
|
+
depthNote: productCoverageNote(searchPolicy ?? null), tokens, reports: named,
|
|
811
|
+
}),
|
|
812
|
+
warn: (what, e) => note(what === 'not built'
|
|
813
|
+
? `knockout report document not built (non-fatal): ${e?.message ?? e}`
|
|
814
|
+
: `knockout report document not written (non-fatal): ${e?.message ?? e}`),
|
|
769
815
|
// A workbook that cannot be built no longer stops the batch: every name's report ships, and nothing names the workbook.
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
})
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
//
|
|
785
|
-
//
|
|
786
|
-
//
|
|
787
|
-
//
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
//
|
|
805
|
-
// `
|
|
806
|
-
|
|
807
|
-
//
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
//
|
|
821
|
-
//
|
|
822
|
-
//
|
|
823
|
-
//
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
`matter: "${runId}"`,
|
|
840
|
-
`overall_label: "${overall ?? ''}"`,
|
|
841
|
-
`overall_badge: "${overallBadge}"`,
|
|
842
|
-
'---',
|
|
843
|
-
'',
|
|
844
|
-
// — THE CROSS-MARK SURFACE, MARKED. Acceptance 3 asks for the banner on "the
|
|
845
|
-
// grouped knockout page"; there is no such page — this file's own header states that a multi-mark
|
|
846
|
-
// run "writes no `report.html` AT ALL" and that report.md "is the ONLY file that names every mark
|
|
847
|
-
// together". It is served from the pool and reachable by URL, so it is the cross-mark document a
|
|
848
|
-
// reader actually meets. The criterion's intent is met on the file that holds that role; its letter
|
|
849
|
-
// cannot be, because its subject is not built. Recorded on the issue, not just here.
|
|
850
|
-
...(demoBannerMd(demoData) ? [demoBannerMd(demoData).trimEnd(), ''] : []),
|
|
851
|
-
`# Summary`,
|
|
852
|
-
'',
|
|
853
|
-
String(findings.batch?.executiveSummary ?? ''),
|
|
854
|
-
...routes,
|
|
855
|
-
].join('\n'));
|
|
856
|
-
const total = finishPoolRun({ writeRO, poolRoot, skipRegen, regenIndex, meta: {
|
|
857
|
-
runId, codename: codename ?? '', matter: runId,
|
|
858
|
-
title, // the product's name and how many names (readKnockoutDocument)
|
|
859
|
-
markName: batchMarkName(markNames) ?? undefined,
|
|
860
|
-
engineCommit: doc.engineCommit,
|
|
861
|
-
// The models that served the batch, named as a client may read them (tokens.mjs servedModels). Absent when
|
|
862
|
-
// nothing was read, so a meta from before the record keeps its shape; [] when turns ran and named none a client may read.
|
|
863
|
-
servedModels: served ?? undefined,
|
|
864
|
-
client: null, customerKey: customerKey || 'generic',
|
|
865
|
-
// WHICH ORGANISATION'S GENERIC this batch was filed under (readKnockoutDocument).
|
|
866
|
-
organisation,
|
|
867
|
-
issuedAt: dates.issuedAt,
|
|
868
|
-
renderedAt: dates.renderedAt,
|
|
869
|
-
kind: 'knockout-batch',
|
|
870
|
-
marks: (findings.marks ?? []).map((m) => ({ name: m.name, band: m.rating })),
|
|
871
|
-
searchLevel: searchPolicy?.level ?? 'knockout',
|
|
872
|
-
// The level's DISPLAY identity, stamped at publish exactly as the clearance lane stamps it. The
|
|
873
|
-
// portal re-derived this from the level word because the knockout meta never carried it; a reader of
|
|
874
|
-
// an archived meta had to know the registry by heart to tell Depth 1 from Depth 2.
|
|
875
|
-
stageLabel: identity.stageLabel ?? undefined,
|
|
876
|
-
// `reportIdentity` WAS written here and read NOWHERE — one occurrence in the whole repository, this
|
|
877
|
-
// one. A stored display label with no reader is not harmless: it is a second answer to "what is this
|
|
878
|
-
// product called", frozen at publish, that would have started disagreeing with the registry the first
|
|
879
|
-
// time a product was renamed — and nothing would have noticed, because nothing looks at it. The name
|
|
880
|
-
// is derived on every render from `searchLevel`, which is right below and IS read. Deleted.
|
|
881
|
-
// Depth 2 provenance — WHICH register was counted and when, so a reader of an archived run can
|
|
882
|
-
// tell a screen that counted from one that did not without opening the workbook.
|
|
883
|
-
registerCounts: registerCounts
|
|
884
|
-
? { provider: registerCounts.provider, takenAt: registerCounts.takenAt, marks: registerCounts.marks?.length ?? 0, counted: countedMarks(registerCounts) }
|
|
885
|
-
: undefined,
|
|
886
|
-
recordLinks: officeLinks?.tally ?? undefined, // per office: linked, or cited by number and why; only where the register has no record pages
|
|
887
|
-
recipe: searchPolicy?.recipe ?? undefined,
|
|
888
|
-
enqueuedVia: searchPolicy?.enqueuedVia ?? undefined,
|
|
889
|
-
parentRunId: searchPolicy?.parentRunId ?? undefined,
|
|
890
|
-
tokens: tokens && (tokens.input || tokens.output) ? tokens : undefined,
|
|
891
|
-
template: 'knockout',
|
|
892
|
-
// `run` IS GONE. It carried the literal 'Knockout screen (Depth 1)' — a product name that is not the
|
|
893
|
-
// product's name, at a rung of a ladder retired — into report-data.json, where nothing has ever
|
|
894
|
-
// read it. The one `.run` reader in the tree parses report.html front matter and uses it as a DATE
|
|
895
|
-
// fallback, so had this field ever been joined to that one it would have printed a product name where
|
|
896
|
-
// a date belongs. The product is `meta.product`, written from the run's own frozen policy.
|
|
897
|
-
overall: overall ?? '', badge: overallBadge, date: issuedDateUtc,
|
|
898
|
-
auditFile, statement,
|
|
899
|
-
// WHY THERE IS NO WORKBOOK, when the build threw. Absent when it built, so such a meta is unchanged.
|
|
900
|
-
auditError: auditError ?? undefined,
|
|
901
|
-
framework: framework ? { key: framework.framework_key, title: framework.title, custom: framework.framework_key !== 'house-triage', bands: framework.bands.map((b) => ({ label: b.label, tone: b.tone })) } : undefined,
|
|
902
|
-
// Present ⇒ this run has a report-data.json beside its report. The portal reads this to tell a run it
|
|
903
|
-
// could render natively from a legacy one; the field had readers long before it had a writer.
|
|
904
|
-
// Stamped only when every name's data file wrote, as the clearance stamps it only when its one file wrote.
|
|
905
|
-
reportSchema: reports.every((r) => r.dataFile) ? 'report-data/1' : undefined,
|
|
906
|
-
// WHICH DOCUMENTS THIS RUN PUBLISHED, and for which name. Every reader that has to open,
|
|
907
|
-
// serve or link a knockout's reports takes the list from here rather than deriving a filename: the
|
|
908
|
-
// naming rule (one mark ⇒ `report.html`, several ⇒ `report-<slug>.html`) is written ONCE, above, and
|
|
909
|
-
// nobody re-implements it. Absent on every pre-change meta, which is exactly the run that has one
|
|
910
|
-
// report at `report.html` — so a reader that falls back to that name on absence is reading the
|
|
911
|
-
// archive correctly, not guessing.
|
|
912
|
-
// — `slug` RIDES. It was destructured away here while being computed twenty lines up, and
|
|
913
|
-
// everything that links a batch's per-mark report needs it: reportsOf() reads it, the portal
|
|
914
|
-
// builds `/portal/report/<runId>/<slug>/` from it, and resolveReportFile() matches on it. Without
|
|
915
|
-
// it BOTH marks of a batch resolved to the run-level URL, which resolveReportFile answers null
|
|
916
|
-
// for by design (a batch has no run-level document) — so every per-mark link 404'd, and the
|
|
917
|
-
// clearances row printed a fallback saying the report was with us for a final read.
|
|
918
|
-
reports: reports.map(({ mark, slug, file, dataFile, band, url }) => ({ mark, slug, file, dataFile, band, url })),
|
|
919
|
-
} });
|
|
920
|
-
await refreshStaffPages({ regenSurfaces, poolRoot, skipRegen, runDir });
|
|
921
|
-
// `url` IS NULL FOR A BATCH, and that is the honest answer rather than a convenient one. A multi-name
|
|
922
|
-
// knockout has no single report, so any one URL here would be the first name standing for all of them —
|
|
923
|
-
// the defect exists to end, re-entering through the delivery packet. Readers take `reports`; a
|
|
924
|
-
// reader that only knows `url` gets null and fails visibly instead of linking one name in eight.
|
|
925
|
-
const url = single ? reports[0]?.url ?? null : null;
|
|
926
|
-
// qcFlags rides the result so the cover note enumerates the SAME projected lines the workbook does —
|
|
927
|
-
// one projection, two surfaces (never a second one composed at the mail).
|
|
928
|
-
// Composed HERE, from the pool URL this function already holds, so the mail never does string surgery
|
|
929
|
-
// on a report URL to guess where the workbook is. One workbook per RUN — the batch's audit trail is one
|
|
930
|
-
// document by design (it carries a Mark column), which is not the same question as the reports.
|
|
931
|
-
//
|
|
932
|
-
// `auditRouteFor`, not a pool path. Removing the string surgery fixed the DERIVATION and left the
|
|
933
|
-
// DESTINATION exactly as dead — `<pool>/<runId>/<auditFile>` reaches no handler, on a batch and on a
|
|
934
|
-
// single alike, which is every knockout ever delivered. `audit.xlsx` is the route literal; the portal
|
|
935
|
-
// reads the run's real filename out of meta.json and sends it as the download name.
|
|
936
|
-
const auditUrl = auditFile ? auditRouteFor(origin, runId) : null;
|
|
937
|
-
return { runId, auditFile, auditError, auditUrl, url, reports, poolRunDir, statement, total, qcFlags, receipts: receipts.checked };
|
|
938
|
-
}
|
|
816
|
+
workbook: ({ buildWorkbook }, reportDocument, { codename, runId }) => buildWorkbook(`knockout-audit-${codename ?? runId}.xlsx`, (at) => {
|
|
817
|
+
const w = knockoutWorkbookOf(reportDocument);
|
|
818
|
+
return buildKnockoutWorkbook(w.findings, w.sweepReceipts, at, w.registerCounts, w.qcFlags, w.framework, w.registerRecords, w.frameworkMethod, w.ownerChecks, w.parts);
|
|
819
|
+
}),
|
|
820
|
+
surfaces({ writeRO, writeDataFile }, reportDocument, { doc: { markRows, single, reportUrlFor, filingRecords, logos, demoData, origin, overallBadge }, named, runId, findings, overall, searchPolicy, delivery }, _kept, { auditFile }) {
|
|
821
|
+
const reports = markRows.map((m, at) => {
|
|
822
|
+
const { slug, file, band: markBand } = named[at];
|
|
823
|
+
// The page reads the run's report document as written, for this name, with its surface beside it.
|
|
824
|
+
writeRO(file, renderKnockoutDocument(pageDocument(reportDocument), at, {
|
|
825
|
+
filingRecords, logos, demoData, delivery,
|
|
826
|
+
// The page's workbook control links the portal's audit route, the one the cover note links: the pool path to the
|
|
827
|
+
// file reaches no handler. Null when the workbook could not be written, and then no control is drawn.
|
|
828
|
+
auditHref: auditFile ? auditRouteFor(origin, runId) : null,
|
|
829
|
+
}));
|
|
830
|
+
// The run as data — what the assistant drafts client-facing mail from. One per report, so a per-mark
|
|
831
|
+
// document's data is that mark's and not the batch's. A data file that cannot be written leaves this
|
|
832
|
+
// name's report in place and the other names publishing; `dataFile` is null for it, so nothing points
|
|
833
|
+
// at a file that is not there.
|
|
834
|
+
const dataFile = writeDataFile(single ? 'report-data.json' : `report-data-${slug}.json`, () => knockoutReportDataOf(reportDocument, at));
|
|
835
|
+
return { mark: m.name, slug, file, dataFile, url: reportUrlFor(slug), band: markBand ?? null };
|
|
836
|
+
});
|
|
837
|
+
// report.md — front-matter compatible with archive greps (title/matter/overall_label)
|
|
838
|
+
//
|
|
839
|
+
// — AND IT NAMES THE DOCUMENTS (knockoutDocumentRoutes, below).
|
|
840
|
+
const routes = knockoutDocumentRoutes(reports, { auditFile });
|
|
841
|
+
writeRO('report.md', [
|
|
842
|
+
'---',
|
|
843
|
+
`title: "${knockoutRecordTitle(searchPolicy, runId)}"`,
|
|
844
|
+
`matter: "${runId}"`,
|
|
845
|
+
`overall_label: "${overall ?? ''}"`,
|
|
846
|
+
`overall_badge: "${overallBadge}"`,
|
|
847
|
+
'---',
|
|
848
|
+
'',
|
|
849
|
+
// — THE CROSS-MARK SURFACE, MARKED. The demo banner belongs on the page that groups every mark,
|
|
850
|
+
// and there is no such page — this file's own header states that a multi-mark
|
|
851
|
+
// run "writes no `report.html` AT ALL" and that report.md "is the ONLY file that names every mark
|
|
852
|
+
// together". It is served from the pool and reachable by URL: it is the cross-mark document a
|
|
853
|
+
// reader actually meets, and the banner goes on it.
|
|
854
|
+
...(demoBannerMd(demoData) ? [demoBannerMd(demoData).trimEnd(), ''] : []),
|
|
855
|
+
`# Summary`,
|
|
856
|
+
'',
|
|
857
|
+
String(findings.batch?.executiveSummary ?? ''),
|
|
858
|
+
...routes,
|
|
859
|
+
].join('\n'));
|
|
860
|
+
return { reports };
|
|
861
|
+
},
|
|
862
|
+
// The batch's record, from the document. A document that could not be built fails the publish here, after the pages
|
|
863
|
+
// and before the record, as a throw in the record always has.
|
|
864
|
+
meta: (reportDocument, { reports }) => knockoutMetaOf(reportDocument, { reports }),
|
|
865
|
+
result({ read: { doc: { single, origin, statement, qcFlags, receipts }, runId }, pool: { poolRunDir }, workbook: { auditFile, auditError }, surfaces: { reports }, total }) {
|
|
866
|
+
// `url` IS NULL FOR A BATCH, and that is the honest answer rather than a convenient one. A multi-name
|
|
867
|
+
// knockout has no single report, so any one URL here would be the first name standing for all of them —
|
|
868
|
+
// the very defect `reports` ended, re-entering through the delivery packet. Readers take `reports`; a
|
|
869
|
+
// reader that only knows `url` gets null and fails visibly instead of linking one name in eight.
|
|
870
|
+
const url = single ? reports[0]?.url ?? null : null;
|
|
871
|
+
// qcFlags rides the result so the cover note enumerates the SAME projected lines the workbook does —
|
|
872
|
+
// one projection, two surfaces (never a second one composed at the mail).
|
|
873
|
+
// Composed HERE, from the pool URL this function already holds, so the mail never does string surgery
|
|
874
|
+
// on a report URL to guess where the workbook is. One workbook per RUN — the batch's audit trail is one
|
|
875
|
+
// document by design (it carries a Mark column), which is not the same question as the reports.
|
|
876
|
+
//
|
|
877
|
+
// `auditRouteFor`, not a pool path. Removing the string surgery fixed the DERIVATION and left the
|
|
878
|
+
// DESTINATION exactly as dead — `<pool>/<runId>/<auditFile>` reaches no handler, on a batch and on a
|
|
879
|
+
// single alike, which is every knockout ever delivered. `audit.xlsx` is the route literal; the portal
|
|
880
|
+
// reads the run's real filename out of meta.json and sends it as the download name.
|
|
881
|
+
const auditUrl = auditFile ? auditRouteFor(origin, runId) : null;
|
|
882
|
+
return { runId, auditFile, auditError, auditUrl, url, reports, poolRunDir, statement, total, qcFlags, receipts: receipts.checked };
|
|
883
|
+
},
|
|
884
|
+
};
|
|
939
885
|
|
|
940
886
|
/**
|
|
941
887
|
* THE ROUTE FROM THE SUMMARY TO THE DOCUMENTS.
|
|
@@ -976,14 +922,13 @@ export function knockoutDocumentRoutes(reports, { auditFile = null } = {}) {
|
|
|
976
922
|
// boundary by heading DEPTH instead of reading one. That guess is what broke the moment the summary
|
|
977
923
|
// gained sub-headers of its own — it terminated the client's entry point at the first of them.
|
|
978
924
|
// Promoted, the boundary is the section boundary, and both readers stop in the right place.
|
|
979
|
-
'',
|
|
980
|
-
...rows.map((r) => `- **${r.mark ??
|
|
925
|
+
'', `# ${KP.documents}`, '',
|
|
926
|
+
...rows.map((r) => `- **${r.mark ?? KP.unnamedMark}**${r.band ? ` — ${r.band}` : ''}: \`${r.file}\``),
|
|
981
927
|
'',
|
|
982
928
|
rows.length === 1
|
|
983
|
-
?
|
|
984
|
-
:
|
|
985
|
-
|
|
986
|
-
...(auditFile ? [`The receipts are in the audit workbook: \`${auditFile}\`.`] : []),
|
|
929
|
+
? KP.oneDocument
|
|
930
|
+
: KP.manyDocuments,
|
|
931
|
+
...(auditFile ? [KP.receiptsIn(auditFile)] : []),
|
|
987
932
|
];
|
|
988
933
|
}
|
|
989
934
|
|
|
@@ -993,3 +938,108 @@ import { addressListedFilings, reasonCellFor } from './office-record-links.mjs';
|
|
|
993
938
|
import { reportDates, zurichStamp } from './report-dates.mjs'; // the dates a report prints, from its record
|
|
994
939
|
import { declaredRecordOrigins } from '../record-origins.mjs';
|
|
995
940
|
import { driverDir, ensureDriverDir, paths, readJson } from "../run-record.mjs";
|
|
941
|
+
import { readRecordArtifacts, normalizeRecordUri } from "../registry-fidelity.mjs";
|
|
942
|
+
import { recordBodyFromLog } from "../../providers/_shared/ledger.mjs"; // the run record log's own index
|
|
943
|
+
import { logosForReport } from "../mark-logos.mjs"; // the saved logo of each listed filing, embedded in the report
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* The saved record of each filing the Knockout lists, by its normalised record id: the run's `_records/` copy where
|
|
947
|
+
* there is one, else the body the run's record log holds. A filing whose record the run never saved is absent, and
|
|
948
|
+
* its table row draws no register record. IMPURE: it reads the run.
|
|
949
|
+
*/
|
|
950
|
+
/**
|
|
951
|
+
* The batch's record in the pool (meta.json), from the report document. `reports` is what publishing wrote for each
|
|
952
|
+
* name, its data file included, which is publishing's own fact and not the run's.
|
|
953
|
+
*/
|
|
954
|
+
function knockoutMetaOf(document, { reports }) {
|
|
955
|
+
if (!document) throw new Error('the report document could not be built, so the run record cannot be written');
|
|
956
|
+
const { run, verdict, client, staff, build } = document;
|
|
957
|
+
const { runId, codename, title, markNames, customerKey } = run;
|
|
958
|
+
const served = client.servedModels, registerCounts = client.registerCounts, framework = document.framework.manifest;
|
|
959
|
+
const tokens = build.tokens;
|
|
960
|
+
return {
|
|
961
|
+
runId, codename: codename ?? '', matter: runId,
|
|
962
|
+
title, // the product's name and how many names (readKnockoutDocument)
|
|
963
|
+
markName: batchMarkName(markNames) ?? undefined,
|
|
964
|
+
engineCommit: build.engineCommit,
|
|
965
|
+
// The models that served the batch, named as a client may read them (tokens.mjs servedModels). Absent when
|
|
966
|
+
// nothing was read, so a meta from before the record keeps its shape; [] when turns ran and named none a client may read.
|
|
967
|
+
servedModels: served ?? undefined,
|
|
968
|
+
client: null, customerKey: customerKey || 'generic',
|
|
969
|
+
// WHICH ORGANISATION'S GENERIC this batch was filed under (readKnockoutDocument).
|
|
970
|
+
organisation: run.organisation ?? undefined,
|
|
971
|
+
issuedAt: run.issuedAt,
|
|
972
|
+
renderedAt: build.renderedAt,
|
|
973
|
+
kind: 'knockout-batch',
|
|
974
|
+
marks: (client.findings?.marks ?? []).map((m) => ({ name: m.name, band: m.rating })),
|
|
975
|
+
searchLevel: run.product.level ?? 'knockout',
|
|
976
|
+
// The level's DISPLAY identity, stamped at publish exactly as the clearance lane stamps it. The
|
|
977
|
+
// portal re-derived this from the level word because the knockout meta never carried it; a reader of
|
|
978
|
+
// an archived meta had to know the registry by heart to tell Depth 1 from Depth 2.
|
|
979
|
+
stageLabel: run.product.stageLabel ?? undefined,
|
|
980
|
+
// `reportIdentity` WAS written here and read NOWHERE — one occurrence in the whole repository, this
|
|
981
|
+
// one. A stored display label with no reader is not harmless: it is a second answer to "what is this
|
|
982
|
+
// product called", frozen at publish, that would have started disagreeing with the registry the first
|
|
983
|
+
// time a product was renamed — and nothing would have noticed, because nothing looks at it. The name
|
|
984
|
+
// is derived on every render from `searchLevel`, which is right below and IS read. Deleted.
|
|
985
|
+
// Depth 2 provenance — WHICH register was counted and when, so a reader of an archived run can
|
|
986
|
+
// tell a screen that counted from one that did not without opening the workbook.
|
|
987
|
+
registerCounts: registerCounts
|
|
988
|
+
? { provider: registerCounts.provider, takenAt: registerCounts.takenAt, marks: registerCounts.marks?.length ?? 0, counted: countedMarks(registerCounts) }
|
|
989
|
+
: undefined,
|
|
990
|
+
recordLinks: client.recordLinks?.tally ?? undefined, // per office: linked, or cited by number and why; only where the register has no record pages
|
|
991
|
+
recipe: run.provenance.recipe ?? undefined,
|
|
992
|
+
enqueuedVia: run.provenance.enqueuedVia ?? undefined,
|
|
993
|
+
parentRunId: run.provenance.parentRunId ?? undefined,
|
|
994
|
+
tokens: tokens && (tokens.input || tokens.output) ? tokens : undefined,
|
|
995
|
+
template: 'knockout',
|
|
996
|
+
// `run` IS GONE. It carried the literal 'Knockout screen (Depth 1)' — a product name that is not the
|
|
997
|
+
// product's name, at a rung of a ladder retired — into report-data.json, where nothing has ever
|
|
998
|
+
// read it. The one `.run` reader in the tree parses report.html front matter and uses it as a DATE
|
|
999
|
+
// fallback, so had this field ever been joined to that one it would have printed a product name where
|
|
1000
|
+
// a date belongs. The product is `meta.product`, written from the run's own frozen policy.
|
|
1001
|
+
overall: verdict.overall ?? '', badge: verdict.badge, date: run.issuedAt.slice(0, 10),
|
|
1002
|
+
auditFile: run.auditFile, statement: verdict.statement,
|
|
1003
|
+
// WHY THERE IS NO WORKBOOK, when the build threw. Absent when it built, so such a meta is unchanged.
|
|
1004
|
+
auditError: staff.auditError ?? undefined,
|
|
1005
|
+
framework: framework ? { key: framework.framework_key, title: framework.title, custom: framework.framework_key !== 'house-triage', bands: framework.bands.map((b) => ({ label: b.label, tone: b.tone })) } : undefined,
|
|
1006
|
+
// Present ⇒ this run has a report-data.json beside each name's report, in the Knockout's shape.
|
|
1007
|
+
// Stamped only when every name's data file wrote, as the clearance stamps it only when its one file wrote.
|
|
1008
|
+
reportSchema: reports.every((r) => r.dataFile) ? 'report-data/knockout-1' : undefined,
|
|
1009
|
+
// WHICH DOCUMENTS THIS RUN PUBLISHED, and for which name. Every reader that has to open,
|
|
1010
|
+
// serve or link a knockout's reports takes the list from here rather than deriving a filename: the
|
|
1011
|
+
// naming rule (one mark ⇒ `report.html`, several ⇒ `report-<slug>.html`) is written ONCE, above, and
|
|
1012
|
+
// nobody re-implements it. Absent on every pre-change meta, which is exactly the run that has one
|
|
1013
|
+
// report at `report.html` — so a reader that falls back to that name on absence is reading the
|
|
1014
|
+
// archive correctly, not guessing.
|
|
1015
|
+
// — `slug` RIDES. It was destructured away here while being computed twenty lines up, and
|
|
1016
|
+
// everything that links a batch's per-mark report needs it: reportsOf() reads it, the portal
|
|
1017
|
+
// builds `/portal/report/<runId>/<slug>/` from it, and resolveReportFile() matches on it. Without
|
|
1018
|
+
// it BOTH marks of a batch resolved to the run-level URL, which resolveReportFile answers null
|
|
1019
|
+
// for by design (a batch has no run-level document) — so every per-mark link 404'd, and the
|
|
1020
|
+
// clearances row printed a fallback saying the report was with us for a final read.
|
|
1021
|
+
reports: reports.map(({ mark, slug, file, dataFile, band, url }) => ({ mark, slug, file, dataFile, band, url })),
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
function filingRecordBodies(runDir, registerRecords) {
|
|
1026
|
+
const out = new Map();
|
|
1027
|
+
if (!runDir || !registerRecords) return out;
|
|
1028
|
+
const saved = readRecordArtifacts(runDir);
|
|
1029
|
+
for (const m of Array.isArray(registerRecords.marks) ? registerRecords.marks : []) {
|
|
1030
|
+
for (const r of Array.isArray(m?.records) ? m.records : []) {
|
|
1031
|
+
const key = normalizeRecordUri(r?.recordId);
|
|
1032
|
+
if (!key || out.has(key)) continue;
|
|
1033
|
+
const body = saved.get(key) ?? recordBodyFromLog(paths(runDir).registerRecordBodies, r.recordId);
|
|
1034
|
+
if (body && typeof body === 'object' && !Array.isArray(body)) out.set(key, body);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
return out;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
// THE PAGE READS THE RUN'S REPORT DOCUMENT AS WRITTEN: the JSON the run keeps, parsed back, so a page can read nothing
|
|
1041
|
+
// the file does not hold. A document that could not be built leaves the pages nothing to read, and the publish stops.
|
|
1042
|
+
function pageDocument(doc) {
|
|
1043
|
+
if (!doc) throw new Error('[report-document] not built, so the Knockout pages have nothing to read');
|
|
1044
|
+
return JSON.parse(JSON.stringify(doc));
|
|
1045
|
+
}
|