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
@@ -17,14 +17,17 @@
17
17
  // vocabulary reaching a lawyer-visible cell) for the driver to log — it never suppresses the deliverable.
18
18
  // exceljs is loaded lazily so this delivery-only dep can never break the driver's import.
19
19
 
20
- import { BRAND } from '../../shared/brand.mjs';
20
+ import { BRAND, WORKBOOK_COLOURS as WB } from '../../shared/brand.mjs';
21
+ import { meterEvidence } from './evidence-words.mjs';
22
+ import { WORKBOOK as W, WORKBOOK_LABELS as LABELS } from './strings.mjs';
21
23
  import { projectAssessmentField } from '../findings-model.mjs';
22
24
  import { inputsLine } from '../framework-method.mjs';
23
25
  import { deliveryVocabViolations } from '../predelivery-lint.mjs';
26
+ import { coverageUnitLabel } from '../coverage-ledger.mjs';
24
27
 
25
- const HEAD_FILL = '11132A';
28
+ const HEAD_FILL = WB.headerFill;
26
29
  // plain-English coverage-state fills (the state words are relabelled for the reader; the fills key off them).
27
- const STATE_FILL = { Clean: 'DEF0DC', Limited: 'FBE7C6', Open: 'FBE7C6', Note: 'EDEDED' };
30
+ const STATE_FILL = { [W.state.clean]: WB.stateClean, [W.state.limited]: WB.stateLimited, [W.state.open]: WB.stateOpen, [W.state.note]: WB.stateNote };
28
31
  const WIDE = {
29
32
  // Summary
30
33
  'Field': 26, 'Value': 96,
@@ -36,6 +39,10 @@ const WIDE = {
36
39
  'Search term / variant': 40, 'Scope': 20, 'Result': 24, 'Outcome': 24, 'Note': 60,
37
40
  // Coverage & gaps
38
41
  'Area': 40, 'State': 12, 'What was done': 60, "What's left": 60,
42
+ // The Knockout's sheets (knockout.mjs), whose long text wrapped in the 16-wide default: Findings, Negative Results,
43
+ // Audit Trail and Working Notes. One table for both workbooks, so a header means one width wherever it appears.
44
+ 'Finding Name': 40, 'Type': 40, 'Net': 60, 'Basis': 60, 'Evidence': 60,
45
+ 'Search Term': 40, 'Source / Context': 40, 'Notes': 60, 'Result Summary': 60,
39
46
  };
40
47
  const width = h => WIDE[h] || 16;
41
48
 
@@ -47,11 +54,12 @@ export const BANNED = /\b(receipts?|lint|tripwires?|composite|quadrants?|scatter
47
54
 
48
55
  // A10 rows are composed by predelivery-lint's projection table. If a caller hands this module a check
49
56
  // object instead of a projected line, the row says nothing rather than saying the engine's words.
50
- const A10_UNPROJECTED = 'A machine check on the report did not pass.';
57
+ const A10_UNPROJECTED = W.checkNotPassed;
51
58
  // The Summary rows A10 owns. validateAudit holds these to a HARD standard (see there) — the general
52
59
  // BANNED scan over every cell stays advisory, because archived model-authored prose legitimately trips
53
60
  // it and a republish must not lose its workbook over a word in a finding.
54
- const A10_FIELD_RE = /^(?:Machine checks flagged|\s+Check \d+)$/;
61
+ const reEscape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
62
+ const A10_FIELD_RE = new RegExp(`^(?:${reEscape(W.summary.checksFlagged)}|\\s+${reEscape(W.summary.check)} \\d+)$`);
55
63
 
56
64
  // plainNote: fold the raw spine/model prose that reaches a reader cell down to plain English — strip markdown
57
65
  // emphasis and rewrite the few engineering phrases that leak through the search log ("has_more:false"). The
@@ -62,9 +70,17 @@ function plainNote(s) {
62
70
  .replace(/has_more\s*:?\s*false/gi, 'completion')
63
71
  .replace(/\bhas_more\b/gi, 'enumeration')
64
72
  .replace(/\s+/g, ' ')
65
- .trim();
73
+ .trim()
74
+ // A note that opens with the ledger's state word opens with the report's instead (2026-11-18).
75
+ .replace(/^coverage-limited — /, 'Partially covered — ')
76
+ .replace(/^deferred — /, 'Not searched — ');
66
77
  }
67
78
 
79
+ // A run stores its slice labels in the words of the build that wrote them, and both workbooks copy them into
80
+ // cells. Every cell says "main register search", as the workbook's own words do (2026-11-18). Lower case
81
+ // only, as readerWords: a capitalised word is a name and stays as written.
82
+ const inCellWords = (v) => (typeof v === 'string' ? v.replace(/\bmain register sweep\b/g, 'main register search') : v);
83
+
68
84
  // a column is "empty" only when NO data row fills it. Dropping such a column honours the spec's
69
85
  // "no dead schema" by construction (a common-law-only run simply omits Class / Registration(s) rather
70
86
  // than shipping them blank) AND means the workbook never carries an empty column to trip a gate on.
@@ -83,20 +99,21 @@ const nonEmptyColumns = (columns, rows) =>
83
99
  columns.filter(h => rows.some(r => !cellEmpty(r[h])));
84
100
 
85
101
  export function addSheet(wb, name, columns, rows, styleRow) {
86
- const ws = wb.addWorksheet(name, { views: [{ state: 'frozen', ySplit: 1 }] });
102
+ // The tab and its headers read as the catalogue says; the code builds the rows on the keys.
103
+ const ws = wb.addWorksheet(LABELS.sheets[name] ?? name, { views: [{ state: 'frozen', ySplit: 1 }] });
87
104
  const cols = nonEmptyColumns(columns, rows);
88
105
  columns = cols.length ? cols : columns; // never drop EVERY column (empty sheet keeps its headers)
89
- ws.columns = columns.map(h => ({ header: h, key: h, width: width(h) }));
106
+ ws.columns = columns.map(h => ({ header: LABELS.columns[h] ?? h, key: h, width: width(h) }));
90
107
  const kept = new Set(columns); // what SURVIVED the drop — the set every styler is held to
91
108
  const hr = ws.getRow(1);
92
109
  hr.eachCell(c => {
93
- c.font = { bold: true, color: { argb: 'FFFFFFFF' } };
110
+ c.font = { bold: true, color: { argb: WB.headerText } };
94
111
  c.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FF' + HEAD_FILL } };
95
112
  c.alignment = { vertical: 'middle', wrapText: true };
96
113
  });
97
114
  hr.height = 26;
98
115
  for (const r of rows) {
99
- const row = ws.addRow(r);
116
+ const row = ws.addRow(Object.fromEntries(Object.entries(r).map(([k, v]) => [k, inCellWords(v)])));
100
117
  row.alignment = { vertical: 'top', wrapText: true };
101
118
  // a styler gets the written row, its SOURCE data, and the surviving columns. Each states its own
102
119
  // precondition against `kept`, so a dropped column makes that one rule a no-op and leaves every
@@ -111,54 +128,51 @@ export function addSheet(wb, name, columns, rows, styleRow) {
111
128
 
112
129
  // source_type -> the plain word a lawyer reads. A register finding never wears a common-law label and back.
113
130
  const sourceWord = st => /^register/.test(st) ? 'Register'
114
- : /^case-law/.test(st) ? 'Case-law'
115
- : /marketplace/.test(st) ? 'Marketplace'
116
- : /^common-law/.test(st) ? 'Web'
117
- : st ? 'Web' : '';
131
+ : /^case-law/.test(st) ? W.sourceLayer.caseLaw
132
+ : /marketplace/.test(st) ? W.sourceLayer.marketplace
133
+ : /^common-law/.test(st) ? W.sourceLayer.web
134
+ : st ? W.sourceLayer.web : '';
118
135
 
119
136
  // /mark/ca/1693383 -> country "CA", number "1693383", "CA 1693383". Absent/odd shapes fall back gracefully.
120
137
  const uriCountry = uri => (String(uri || '').match(/\/mark\/([a-z]{2})\//i)?.[1] || '').toUpperCase();
121
138
  const uriNumber = uri => String(uri || '').match(/\/mark\/[a-z]{2,6}\/(.+)$/i)?.[1] || String(uri || '');
122
139
  const regLabel = uri => { const c = uriCountry(uri); const n = uriNumber(uri); return c ? `${c} ${n}` : n; };
123
140
 
124
- // the four drivers keep their token but wear a PLAIN provenance tag: a value checked against the actual
125
- // register record or live listing reads "from source"; our own inference reads "our read". (This is the
126
- // verified/inferred basis already computed — relabelled, never recomputed.)
127
- const basisTag = b => b === 'verified-from-record' ? 'from source' : b === 'inferred-from-signal' ? 'our read' : '';
128
- const meterCell = m => m && m.token ? `${m.token}${basisTag(m.basis) ? ` · ${basisTag(m.basis)}` : ''}` : '';
141
+ // THE CELL SAYS WHAT THE PAGE SAYS: the token, and the meter's evidence in the report's own words
142
+ // (evidence-words.mjs). An unknown value nobody checked reads "not checked" where the page has no word for it.
143
+ export const meterCell = (m, driver) => {
144
+ if (!m || !m.token) return '';
145
+ const word = meterEvidence(driver, m) || (m.token === 'unknown' && driver !== 'mark_similarity' ? W.notChecked : '');
146
+ return `${m.token}${word ? ` · ${word}` : ''}`;
147
+ };
129
148
 
130
149
  // disposition -> the plain "how we treated it" sentence.
131
- const TREATMENT = {
132
- adversarial: 'On-field — stress-tested as the closest conflict',
133
- 'coexistence-partner': 'Coexistence partner — living alongside, kept manageable',
134
- distinguished: 'Distinguished — weak shared element, kept manageable',
135
- 'off-field': 'Off-field — outside the risk zone',
136
- };
150
+ const TREATMENT = W.treatment;
137
151
  const treatmentCell = f => f?.disposition === 'withdrawn'
138
- ? `Withdrawn on review — ${plainNote(f.withdrawn_reason) || 'no reason recorded'}`
139
- : (f?.isContextNote ? 'Noted for awareness — not a rated conflict' : (TREATMENT[f?.disposition] || ''));
152
+ ? W.withdrawn(plainNote(f.withdrawn_reason) || W.noReasonRecorded)
153
+ : (f?.isContextNote ? W.contextNote : (TREATMENT[f?.disposition] || ''));
140
154
 
141
155
  // Record retrieved? — the plain-English state of the register-record fetch for a finding, from the per-URI
142
156
  // fetch-state map ({retrieved | failed | not-attempted}). A common-law finding (no registrations) is
143
157
  // "n/a — live listing"; a failed fetch is VISIBLY unverified, never presented as confirmed.
144
158
  export function retrievedCell(f, fetchState) { // @internal — driven by its test
145
159
  const regs = f?.owner?.registrations || [];
146
- if (!regs.length) return 'n/a — live listing';
160
+ if (!regs.length) return W.liveListing;
147
161
  const st = uri => (fetchState && fetchState[String(uri || '').toLowerCase()]) || 'not-attempted';
148
162
  const states = regs.map(r => st(r.uri));
149
- if (states.every(s => s === 'retrieved')) return 'Retrieved from the register';
163
+ if (states.every(s => s === 'retrieved')) return W.retrieved;
150
164
  const anyRead = states.some(s => s === 'retrieved');
151
165
  const anyFailed = states.some(s => s === 'failed');
152
166
  // no leg read: a fetch that FAILED (a 404) makes the registry values unverified — say so visibly; a leg
153
167
  // simply never pulled (off-field context) is the softer "not individually retrieved".
154
- if (!anyRead) return anyFailed ? 'Not retrieved — details unverified' : 'Not individually retrieved';
168
+ if (!anyRead) return anyFailed ? W.notRetrievedUnverified : W.notIndividuallyRetrieved;
155
169
  // mixed — spell out which country legs were retrieved and which were not ("CA retrieved; US/AU not retrieved").
156
170
  const read = regs.filter(r => st(r.uri) === 'retrieved').map(r => uriCountry(r.uri)).filter(Boolean);
157
171
  const missing = regs.filter(r => st(r.uri) !== 'retrieved').map(r => uriCountry(r.uri)).filter(Boolean);
158
172
  const parts = [];
159
- if (read.length) parts.push(`${read.join('/')} retrieved`);
160
- if (missing.length) parts.push(`${missing.join('/')} not retrieved`);
161
- return parts.join('; ') || 'Not individually retrieved';
173
+ if (read.length) parts.push(W.countriesRetrieved(read.join('/')));
174
+ if (missing.length) parts.push(W.countriesNotRetrieved(missing.join('/')));
175
+ return parts.join('; ') || W.notIndividuallyRetrieved;
162
176
  }
163
177
 
164
178
  // Status & key dates — a single representative line from the first registration whose record was read.
@@ -191,17 +205,17 @@ function findingRows(findings, fetchState, recordLinks = null, method = null) {
191
205
  'Country': f.owner?.country || '',
192
206
  'Source': sourceWord(f.source?.source_type || ''),
193
207
  'Class': classCell(f),
194
- 'Registration(s)': regs.length ? regs.map(r => recordLinks?.get(String(r.uri || '').toLowerCase())?.label || regLabel(r.uri)).join('; ') : (ctx ? '—' : '— (common-law)'),
208
+ 'Registration(s)': regs.length ? regs.map(r => recordLinks?.get(String(r.uri || '').toLowerCase())?.label || regLabel(r.uri)).join('; ') : (ctx ? '—' : W.commonLawRegistration),
195
209
  'Status & key dates': statusDatesCell(f),
196
- 'Record retrieved?': ctx ? 'n/a — noted only' : retrievedCell(f, fetchState),
210
+ 'Record retrieved?': ctx ? W.notedOnly : retrievedCell(f, fetchState),
197
211
  // where the framework states a method, its inputs ride beside the band, as on the report card
198
212
  'Risk band': f.band ? [f.band, inputsLine(method, f.inputs)].filter(Boolean).join(' · ') : '—',
199
213
  'How we treated it': treatmentCell(f),
200
214
  // context notes are NOT rated conflicts — the four drivers read n/a and the four-drivers gate skips them.
201
- 'Mark similarity': ctx ? 'n/a' : meterCell(f.meters?.mark_similarity),
202
- 'Goods proximity': ctx ? 'n/a' : meterCell(f.meters?.goods_proximity),
203
- 'Use': ctx ? 'n/a' : meterCell(f.meters?.use),
204
- 'Enforcer': ctx ? 'n/a' : meterCell(f.meters?.enforcer),
215
+ 'Mark similarity': ctx ? 'n/a' : meterCell(f.meters?.mark_similarity, 'mark_similarity'),
216
+ 'Goods proximity': ctx ? 'n/a' : meterCell(f.meters?.goods_proximity, 'goods_proximity'),
217
+ 'Use': ctx ? 'n/a' : meterCell(f.meters?.use, 'use'),
218
+ 'Enforcer': ctx ? 'n/a' : meterCell(f.meters?.enforcer, 'enforcer'),
205
219
  'Link': f.source?.resolved_link || linkCellFor(regs, recordLinks), // the office's own page, or why there is none
206
220
  };
207
221
  });
@@ -227,8 +241,8 @@ const EXCL = /excluded|dropped|off-field|out of scope|distribution-partner|relev
227
241
  // SAME WORKBOOK already shows a client on its Coverage & gaps tab: STATE_WORD maps the typed
228
242
  // `not-searched` coverage state to "Open". Reusing it keeps one vocabulary in front of the reader instead
229
243
  // of inventing a second for the same fact.
230
- const NOT_SEARCHED_OUTCOME = 'Open — not searched';
231
- const NOT_SEARCHED_RESULT = 'could not be searched';
244
+ const NOT_SEARCHED_OUTCOME = W.outcome.notSearched;
245
+ const NOT_SEARCHED_RESULT = W.couldNotBeSearched;
232
246
 
233
247
  // A row is not-searched when it SAYS SO IN A FIELD, not when its prose happens to match a pattern.
234
248
  // audit-from-spine.mjs stamps `searched:false` on every gaps[] row, because that function already knows
@@ -247,13 +261,13 @@ const outcomeFor = (result, note, row = null) => {
247
261
  const t = `${result} ${note}`;
248
262
  // Ahead of everything: a query that never ran cannot be a hit, an exclusion, or a clean sweep.
249
263
  if (notSearched(row, result, note)) return NOT_SEARCHED_OUTCOME;
250
- if (HITY.test(t) && !/no (similar|active|products|results|relevant)/i.test(result)) return '→ Findings';
251
- if (EXCL.test(t)) return 'Excluded';
264
+ if (HITY.test(t) && !/no (similar|active|products|results|relevant)/i.test(result)) return W.outcome.findings;
265
+ if (EXCL.test(t)) return W.outcome.excluded;
252
266
  // NO CATCH-ALL. `return 'No conflict'` as a fall-through was the defect: an unknown shape resolved to
253
267
  // the most reassuring answer available, so any Result this file has never seen became a closure claim.
254
268
  // An unrecognised row now says it is unrecognised, and a human reads the Result column beside it.
255
- if (!String(result ?? '').trim()) return 'No conflict';
256
- return /^(0|no |none\b|nothing\b|clean\b)/i.test(String(result).trim()) ? 'No conflict' : 'Recorded — read the Result';
269
+ if (!String(result ?? '').trim()) return W.outcome.noConflict;
270
+ return /^(0|no |none\b|nothing\b|clean\b)/i.test(String(result).trim()) ? W.outcome.noConflict : W.outcome.recorded;
257
271
  };
258
272
 
259
273
  // term -> did it become a surviving finding? A PROVABLE join, never a guessed number: the term shares a
@@ -276,14 +290,14 @@ function joinsFinding(term, findings, joinedTerms) {
276
290
  return false;
277
291
  }
278
292
 
279
- const COMMON_LAW_SECTION = 'COMMON-LAW — web / marketplace / social / product database';
293
+ const COMMON_LAW_SECTION = W.commonLawSection;
280
294
 
281
295
  // register negatives are already one row per term in the spine; common-law negatives arrive per-platform and
282
296
  // collapse to one row per term with a distinct-surface count (the spec's dedup). The full per-surface grid
283
297
  // is the run's own artifact; this is the reader's deduped view, not a claim the surfaces went unrecorded.
284
298
  // Exported for test: the three-state logic is the deliverable's own claim about what was
285
299
  // searched, and it is worth asserting directly rather than only through a rendered xlsx.
286
- export function searchRows(auditParsed, { findings = [], joinedTerms = null, registerOnly = false } = {}) {
300
+ export function searchRows(auditParsed, { findings = [], joinedTerms = null, registerOnly = false, registerReach = null, registerScope = null } = {}) {
287
301
  const negs = (auditParsed?.negatives || []).filter(n => (n.search_term || '').trim() && (n.search_term || '').trim() !== '—');
288
302
  const reg = negs.filter(n => n.source_layer !== 'Common-law');
289
303
  const cl = negs.filter(n => n.source_layer === 'Common-law');
@@ -293,7 +307,13 @@ export function searchRows(auditParsed, { findings = [], joinedTerms = null, reg
293
307
  const push = r => rows.push({ '#': ++i, ...r, Result: readerWords(r.Result), Note: readerWords(r.Note) }); // plain words, after each branch below has classified its row from the engine's own
294
308
 
295
309
  if (reg.length) {
296
- push({ 'Search term / variant': 'REGISTER — vendor register, worldwide', Scope: '', Result: '', Outcome: '', Note: '', _section: true });
310
+ // THE REGISTER'S HEAD STATES THE SERVICE'S REACH, from the answer the run recorded beside its coverage line
311
+ // (`register_reach` in the scope facts), so the two cannot disagree. An order that names its countries reads
312
+ // "REGISTER" alone, and its rows say where (owner, 2026-11-19). A worldwide run that recorded no reach, or a
313
+ // run whose record cannot say, keeps the head it always had.
314
+ const head = registerReach ? W.registerSectionReach(registerReach.service, registerReach.offices)
315
+ : registerScope === 'named' ? W.registerSectionNamed : W.registerSection;
316
+ push({ 'Search term / variant': head, Scope: '', Result: '', Outcome: '', Note: '', _section: true });
297
317
  for (const n of reg) {
298
318
  const note = plainNote(n.notes);
299
319
  push({
@@ -335,7 +355,7 @@ export function searchRows(auditParsed, { findings = [], joinedTerms = null, reg
335
355
  const results = [...g.results];
336
356
  const anyHit = results.some(r => (HITY.test(r) || GRID_HIT.test(String(r).trim())) && !/^no /i.test(r));
337
357
  const n = g.plats.size;
338
- const scope = n ? `~${n} surfaces` : '';
358
+ const scope = n ? W.surfaces(n) : '';
339
359
  // the deduped row lost its per-surface detail (that lives in the run's own grid); the Note states the
340
360
  // honest aggregate — how wide the sweep ran and where any hit went — never one cherry-picked surface
341
361
  // receipt (which, on a hit term, would read as "nothing found" beside a "found" result).
@@ -352,31 +372,26 @@ export function searchRows(auditParsed, { findings = [], joinedTerms = null, reg
352
372
  // a content-policy refusal will refuse again, a query that never ran may simply run.
353
373
  const said = gaps.map((s) => [s, g.gapReasons.get(s)]).filter(([, r]) => r);
354
374
  const silent = gaps.filter((s) => !g.gapReasons.has(s));
355
- const reasonNote = said.length
356
- ? ` The surface${said.length === 1 ? '' : 's'} gave a reason: ${said.map(([s, r]) => `${s} — ${r}`).join('; ')}.`
357
- : '';
358
- const silentNote = silent.length && said.length
359
- ? ` ${silent.length} recorded no reason (${silent.slice(0, 4).join(', ')}${silent.length > 4 ? ', …' : ''}).`
360
- : silent.length ? ' No reason was recorded for any of them.' : '';
361
- const gapNote = gaps.length ? ` ${gaps.length} surface${gaps.length === 1 ? '' : 's'} could not be searched (${gaps.slice(0, 4).join(', ')}${gaps.length > 4 ? ', …' : ''}) — this term is NOT closed across them.${reasonNote}${silentNote}` : '';
362
- const outcome = anyHit ? (joined ? '→ Findings' : 'Reviewed — not carried as a conflict')
375
+ const firstFour = (list) => `${list.slice(0, 4).join(', ')}${list.length > 4 ? ', …' : ''}`;
376
+ const reasonNote = said.length ? W.reasonsGiven(said.length, said.map(([s, r]) => `${s} — ${r}`).join('; ')) : '';
377
+ const silentNote = silent.length && said.length ? W.someGaveNoReason(silent.length, firstFour(silent))
378
+ : silent.length ? W.noneGaveAReason : '';
379
+ const gapNote = gaps.length ? `${W.notClosedAcross(gaps.length, firstFour(gaps))}${reasonNote}${silentNote}` : '';
380
+ const outcome = anyHit ? (joined ? W.outcome.findings : W.outcome.reviewed)
363
381
  : gaps.length && !ran ? NOT_SEARCHED_OUTCOME // nothing ran at all: never a closure claim
364
- : gaps.length ? 'No conflict — partial' // some ran clean, some never ran: say both
365
- : 'No conflict';
382
+ : gaps.length ? W.outcome.partial // some ran clean, some never ran: say both
383
+ : W.outcome.noConflict;
384
+ const across = ran ? `~${ran}` : 'the';
366
385
  const note = (anyHit
367
- ? (joined
368
- ? `Checked across ${ran ? `~${ran}` : 'the'} surfaces; similar listing(s) surfaced → see Findings`
369
- : `Checked across ${ran ? `~${ran}` : 'the'} surfaces; listing(s) reviewed, none carried as a separate conflict`)
370
- : ran
371
- ? `Checked across ~${ran} surface${ran === 1 ? '' : 's'}; no listing found`
372
- : `Not checked on any recorded surface`) + gapNote;
386
+ ? (joined ? W.checkedJoined(across) : W.checkedReviewed(across))
387
+ : ran ? W.checkedClean(ran) : W.checkedNowhere) + gapNote;
373
388
  push({
374
389
  'Search term / variant': plainNote(term), Scope: scope,
375
390
  // The all-clean row is unchanged — a workbook that annotates every clean line teaches the reader to
376
391
  // ignore the annotation. It says "of N" only when some surface did NOT run.
377
- Result: anyHit ? 'similar listing(s) found'
392
+ Result: anyHit ? W.similarFound
378
393
  : !ran ? NOT_SEARCHED_RESULT
379
- : gaps.length ? `0 — clean on ${ran} of ${n}` : '0 — clean',
394
+ : gaps.length ? W.cleanOn(ran, n) : W.clean,
380
395
  Outcome: outcome, Note: note,
381
396
  });
382
397
  }
@@ -391,9 +406,9 @@ export function searchRows(auditParsed, { findings = [], joinedTerms = null, reg
391
406
  // about what ran — only what this run's own search log does and does not hold.
392
407
  push({ 'Search term / variant': COMMON_LAW_SECTION, Scope: '', Result: '', Outcome: '', Note: '', _section: true });
393
408
  push({
394
- 'Search term / variant': "COMMON-LAW — not itemised in this run's search log",
395
- Scope: '', Result: 'no per-term rows recorded', Outcome: 'Not itemised',
396
- Note: 'This run is not recorded as a register-only search, so what this tab lists is not the whole of what it searched. Its search log holds no per-term common-law rows, so the sweep cannot be set out term by term here. Read this tab as an incomplete record of the searching — never as evidence that no common-law search ran — and check any common-law line on "Coverage & gaps" against the run\'s own common-law record.',
409
+ 'Search term / variant': W.unlogged.term,
410
+ Scope: '', Result: W.unlogged.result, Outcome: W.unlogged.outcome,
411
+ Note: W.unlogged.note,
397
412
  _commonLawUnlogged: true,
398
413
  });
399
414
  }
@@ -402,17 +417,17 @@ export function searchRows(auditParsed, { findings = [], joinedTerms = null, reg
402
417
 
403
418
  // ── Coverage & gaps ─────────────────────────────────────────────────────────────────────────────────────
404
419
  const COVERAGE_COLS = ['Area', 'State', 'What was done', "What's left"];
405
- const STATE_WORD = { 'confirmed-clean': 'Clean', 'coverage-limited': 'Limited', open: 'Open', 'not-searched': 'Open', note: 'Note' };
420
+ const STATE_WORD = { 'confirmed-clean': W.state.clean, 'coverage-limited': W.state.limited, open: W.state.open, 'not-searched': W.state.open, note: W.state.note };
406
421
  // A coverage row is open where this tab shows it Open or Limited. The Summary's count and its caveat read the same
407
422
  // rule, so a not-searched row, shown Open here, is never left out of the count the Summary leads with.
408
- const isOpenCoverage = (c) => STATE_WORD[c?.state] === 'Open' || STATE_WORD[c?.state] === 'Limited';
423
+ const isOpenCoverage = (c) => STATE_WORD[c?.state] === W.state.open || STATE_WORD[c?.state] === W.state.limited;
409
424
 
410
425
  // split a coverage note into "what was done" / "what's left" at its natural prose seam. Open/limited areas
411
426
  // describe the residual after a "; " or " — "; a clean area is all done and has nothing left.
412
427
  function splitCoverageNote(note, state) {
413
428
  const n = plainNote(note);
414
429
  if (!n) return { done: '', left: '' };
415
- if (state === 'Clean') return { done: n, left: '—' };
430
+ if (state === W.state.clean) return { done: n, left: '—' };
416
431
  const seam = n.search(/\s—\s|;\s/);
417
432
  if (seam > 0) {
418
433
  const done = n.slice(0, seam).trim();
@@ -420,18 +435,19 @@ function splitCoverageNote(note, state) {
420
435
  return { done, left: left || '—' };
421
436
  }
422
437
  // no clean seam — a residual-describing note reads as "what's left"; a clean note reads as "what was done".
423
- return state === 'Open' || state === 'Limited' ? { done: '', left: n } : { done: n, left: '—' };
438
+ return state === W.state.open || state === W.state.limited ? { done: '', left: n } : { done: n, left: '—' };
424
439
  }
425
440
 
426
441
  function coverageRows(coverage) {
427
442
  return (coverage || []).map(c => {
428
- const state = STATE_WORD[c.state] || 'Note';
443
+ const state = STATE_WORD[c.state] || W.state.note;
429
444
  // A row that says which cell its words belong in is not split: a reading turn's reason is one sentence,
430
445
  // and cut at its first `;` it read as half done and half left.
431
446
  const { done, left } = ('done' in c || 'left' in c)
432
447
  ? { done: plainNote(c.done ?? ''), left: plainNote(c.left ?? '') || '—' }
433
448
  : splitCoverageNote(c.note, state);
434
- return { Area: plainNote(c.area), State: state, 'What was done': done, "What's left": left };
449
+ // An area the engine named by its axis reads the reader's label, as the Summary's slices do.
450
+ return { Area: plainNote(coverageUnitLabel(c.area)), State: state, 'What was done': done, "What's left": left };
435
451
  });
436
452
  }
437
453
 
@@ -445,6 +461,8 @@ function coverageOpen({ coverage = [], coverageJudgment = null, verdict = null,
445
461
  return openState || judgeUnsure || verdictCoverage;
446
462
  }
447
463
 
464
+ // A label under one of the Summary's headings is indented, as a spreadsheet has no other way to nest it.
465
+ const IND = ' ';
448
466
  export function summaryRows(findings, coverage, fm, { mark, coverageJudgment, verdict, jurisdiction, registerOnly = false, commonLawUnlogged = false, clientGate = null, lintFailures = [], productName = null, degradedParts = [], assessmentNotCompleted = false } = {}) {
449
467
  const disp = d => findings.filter(f => f.disposition === d && !f.isContextNote).length;
450
468
  const rated = findings.filter(f => !f.isContextNote);
@@ -460,7 +478,7 @@ export function summaryRows(findings, coverage, fm, { mark, coverageJudgment, ve
460
478
  const caveat = (notCompletedRow && plainNote(notCompletedRow.note)) || plainNote(coverageJudgment?.reason) ||
461
479
  (coverage || []).find(isOpenCoverage)?.note ||
462
480
  (degradedParts || [])[0]?.note ||
463
- 'None — every search unit reached completion.';
481
+ W.summary.nothingOpen;
464
482
 
465
483
  const rows = [
466
484
  // — THE WORKBOOK NAMES THE SAME PRODUCT ITS REPORT DOES. This title was the literal
@@ -468,29 +486,29 @@ export function summaryRows(findings, coverage, fm, { mark, coverageJudgment, ve
468
486
  // search's workbook carried one name between them, and neither matched the masthead of the report
469
487
  // they were downloaded from. The workbook is a delivery surface: its link rides the same cover note
470
488
  // that reaches a client principal. Null ⇒ the neutral title, never a product the run did not run.
471
- { Field: productName ? `${productName} — audit` : 'Search audit', Value: 'The full, downloadable record behind the report — what was searched, and what we concluded about each finding.', _title: true },
489
+ { Field: productName ? W.summary.title(productName) : W.summary.titleWithoutProduct, Value: W.summary.subtitle, _title: true },
472
490
  { Field: '', Value: '' },
473
- { Field: 'Mark', Value: mark || fm.title || '' },
474
- { Field: 'Matter', Value: fm.matter || '' },
475
- { Field: 'Classes', Value: fm.classes || '' },
491
+ { Field: W.summary.mark, Value: mark || fm.title || '' },
492
+ { Field: W.summary.matter, Value: fm.matter || '' },
493
+ { Field: W.summary.classes, Value: fm.classes || '' },
476
494
  // compute-don't-author (PR-4, review issue 2): the driver-computed per-class register-coverage
477
495
  // line (scope-facts.mjs → `coverage_line:` front-matter) renders here so the workbook's headline
478
496
  // carries the honest per-class proportion ("Class 30: 76 of 99 slices fully searched — the
479
497
  // remaining 23 are non-Latin script forms", the spec-B4 plain form) beside the bare class
480
498
  // numbers. Conditional on the fm key: a republished ARCHIVED workbook (whose front-matter never
481
499
  // carried coverage_line) must not grow rows.
482
- ...(fm.coverage_line ? [{ Field: 'Register coverage', Value: fm.coverage_line }] : []),
483
- { Field: 'Jurisdiction', Value: jurisdiction || '' },
484
- { Field: 'Searched', Value: fm.searched || fm.run || '' },
485
- // spec 64 — the old single row printed the severity TIER under the label "Verdict" (a reader saw
500
+ ...(fm.coverage_line ? [{ Field: W.summary.registerCoverage, Value: fm.coverage_line }] : []),
501
+ { Field: W.summary.jurisdiction, Value: jurisdiction || '' },
502
+ { Field: W.summary.searched, Value: fm.searched || fm.run || '' },
503
+ // The old single row printed the severity TIER under the label "Verdict" (a reader saw
486
504
  // "Verdict: High" — vocabulary conflation). With a composed statement the summary carries two
487
505
  // labelled rows: the band word and THE one risk statement. A legacy run (no statement) keeps its
488
506
  // single original row byte-identically — a republished archived workbook must not grow rows.
489
507
  ...(assessmentNotCompleted ? []
490
508
  : verdict && verdict.statement
491
- ? [{ Field: 'Risk band', Value: verdictWord }, { Field: 'Verdict', Value: verdict.statement, _verdict: true }]
492
- : [{ Field: 'Verdict', Value: verdictWord, _verdict: true }]),
493
- { Field: '⚠ One thing to check first', Value: caveat, _caveat: true },
509
+ ? [{ Field: W.summary.riskBand, Value: verdictWord }, { Field: W.summary.verdict, Value: verdict.statement, _verdict: true }]
510
+ : [{ Field: W.summary.verdict, Value: verdictWord, _verdict: true }]),
511
+ { Field: W.summary.checkFirst, Value: caveat, _caveat: true },
494
512
  // The gap "What was searched" had to DECLARE rather than list, said again where the reader starts.
495
513
  // It is set when that sheet found no per-term common-law rows on a run nothing records as
496
514
  // register-only, and it exists because the only signal for this used to be an advisory line on
@@ -505,15 +523,15 @@ export function summaryRows(findings, coverage, fm, { mark, coverageJudgment, ve
505
523
  // exist, because the same defect threw before writeFile, or it silently read as a complete
506
524
  // register-only search. Reproducing that byte-for-byte would be reproducing the defect.
507
525
  ...(commonLawUnlogged
508
- ? [{ Field: '⚠ Common-law searching', Value: 'Not set out term by term in this workbook: this run\'s search log holds no per-term common-law rows, so "What was searched" lists the register terms only. Read that tab as an incomplete record of the searching, not as evidence that no common-law search ran, and check any common-law line on "Coverage & gaps" against the run\'s own common-law record.', _caveat: true }]
526
+ ? [{ Field: W.summary.commonLaw, Value: W.summary.commonLawUnlogged, _caveat: true }]
509
527
  : []),
510
- // ONE report (spec 2026-07-30 §5): the machine-QC checks enumerate their failures HERE — the
528
+ // ONE report: the machine-QC checks enumerate their failures HERE — the
511
529
  // workbook is where they live now, and they decide nothing about who may read the report. The old
512
530
  // "⛔ Not released to the client" delivery language is retired with the split it narrated. Reasons
513
531
  // are the checks' own plain-language lines (no internal vocabulary); plainNote() folds any
514
532
  // engineering residue. No failed checks ⇒ no row, byte-identical workbook (archived republish safe).
515
533
  ...(clientGate && clientGate.released === false
516
- ? [{ Field: '⚠ Machine QC', Value: `${(clientGate.reasons ?? []).length || 'Some'} machine check(s) failed at publish — recorded here for review. ${((clientGate.reasons ?? []).map(r => plainNote(r)).join(' · ')) || 'the checks could not be evaluated'}`, _caveat: true }]
534
+ ? [{ Field: W.summary.machineQc, Value: W.summary.machineQcFailed((clientGate.reasons ?? []).length || W.summary.someChecks, ((clientGate.reasons ?? []).map(r => plainNote(r)).join(' · ')) || W.summary.checksNotEvaluated), _caveat: true }]
517
535
  : []),
518
536
  // A10 (addendum 2026-07-30) — the failing predelivery machine checks, ENUMERATED, whether or not
519
537
  // the gate closed: the workbook is the QC record the reviewing lawyer keeps, and a defect that
@@ -525,39 +543,39 @@ export function summaryRows(findings, coverage, fm, { mark, coverageJudgment, ve
525
543
  // principal — so the raw `detail` may not arrive here at all, and a caller that passes a check
526
544
  // object gets a neutral row rather than that object's prose. validateAudit holds the same line.
527
545
  ...(Array.isArray(lintFailures) && lintFailures.length
528
- ? [{ Field: 'Machine checks flagged', Value: `${lintFailures.length} — enumerated below; the report was delivered as usual.`, _caveat: true },
529
- ...lintFailures.map((f, i) => ({ Field: ` Check ${i + 1}`, Value: plainNote(typeof f === 'string' ? f : A10_UNPROJECTED), _caveat: true }))]
546
+ ? [{ Field: W.summary.checksFlagged, Value: W.summary.checksFlaggedCount(lintFailures.length), _caveat: true },
547
+ ...lintFailures.map((f, i) => ({ Field: `${IND}${W.summary.check} ${i + 1}`, Value: plainNote(typeof f === 'string' ? f : A10_UNPROJECTED), _caveat: true }))]
530
548
  : []),
531
549
  { Field: '', Value: '' },
532
- { Field: 'By the numbers', Value: '', _head: true },
550
+ { Field: W.summary.byTheNumbers, Value: '', _head: true },
533
551
  ...(assessmentNotCompleted ? [] : [
534
- { Field: ' Findings rated', Value: String(rated.length) },
535
- { Field: ' On-field (the one stress-tested as closest)', Value: String(disp('adversarial')) },
536
- { Field: ' Distinguished / manageable', Value: String(disp('distinguished')) },
537
- { Field: ' Off-field (outside the risk zone)', Value: String(disp('off-field')) },
552
+ { Field: `${IND}${W.summary.findingsRated}`, Value: String(rated.length) },
553
+ { Field: `${IND}${W.summary.onField}`, Value: String(disp('adversarial')) },
554
+ { Field: `${IND}${W.summary.distinguished}`, Value: String(disp('distinguished')) },
555
+ { Field: `${IND}${W.summary.offField}`, Value: String(disp('off-field')) },
538
556
  ]),
539
- { Field: ' Coverage areas assessed', Value: String((coverage || []).length) },
540
- { Field: ' Open / limited coverage', Value: String(openCount) },
557
+ { Field: `${IND}${W.summary.areasAssessed}`, Value: String((coverage || []).length) },
558
+ { Field: `${IND}${W.summary.openOrLimited}`, Value: String(openCount) },
541
559
  { Field: '', Value: '' },
542
- { Field: 'How to read this workbook', Value: '', _head: true },
560
+ { Field: W.summary.howToRead, Value: '', _head: true },
543
561
  ...(assessmentNotCompleted ? []
544
- : [{ Field: ' Findings', Value: 'every conflicting mark we surfaced, our call on it, and the evidence behind each call.' }]),
562
+ : [{ Field: `${IND}${W.summary.findingsTab}`, Value: W.summary.findingsTabIs }]),
545
563
  // the third form is not cosmetic. "every search we ran — register and common-law — so you can see
546
564
  // we looked everywhere" is a claim ABOUT THIS SHEET, and on a run whose common-law sweep never
547
565
  // reached the search log the sheet does not carry it, so the sentence was simply false.
548
- { Field: ' What was searched', Value: registerOnly
549
- ? 'every search we ran. This was a REGISTER-ONLY search: trade mark registers were searched, marketplaces and common-law use were not.'
566
+ { Field: `${IND}${W.summary.searchedTab}`, Value: registerOnly
567
+ ? W.summary.searchedTabIsRegisterOnly
550
568
  : commonLawUnlogged
551
- ? 'every register search we ran, term by term. The common-law searching is NOT set out here — see the caveat above — so this tab is not the whole record of what was searched.'
552
- : 'every search we ran — register and common-law — so you can see we looked everywhere.' },
553
- { Field: ' Coverage & gaps', Value: 'what is fully cleared and what is still open — read this first if you have a doubt.' },
554
- { Field: ' Evidence tags', Value: '“from source” = checked against the actual register record or live listing · “our read” = our own assessment.' },
555
- { Field: ' Record retrieved?', Value: 'whether the register entry itself was retrieved; where a record could not be retrieved, its details are shown unverified.' },
569
+ ? W.summary.searchedTabIsRegisterTerms
570
+ : W.summary.searchedTabIsEverything },
571
+ { Field: `${IND}${W.summary.coverageTab}`, Value: W.summary.coverageTabIs },
572
+ { Field: `${IND}${W.summary.evidenceTags}`, Value: W.summary.evidenceTagsAre },
573
+ { Field: `${IND}${W.summary.recordRetrieved}`, Value: W.summary.recordRetrievedIs },
556
574
  ];
557
575
  return rows;
558
576
  }
559
577
 
560
- // ── PR-9 (E9) — the STRUCTURED v5 rows, rendered as rows ────────────────────────────────────────────────
578
+ // ── The STRUCTURED v5 rows, rendered as rows ────────────────────────────────────────────────────────────
561
579
  // The report (frozen renderer) receives the deterministic string projection; the WORKBOOK is the surface
562
580
  // that renders the typed rows themselves — per-class, per-market, the counter-registration list, the
563
581
  // coverage-judgment slices and the corrections attestation. All three helpers are ADDITIVE AND
@@ -566,32 +584,32 @@ export function summaryRows(findings, coverage, fm, { mark, coverageJudgment, ve
566
584
  function assessmentSummaryRows(ma) {
567
585
  if (!ma || (typeof ma.distinctiveness !== 'object' || ma.distinctiveness === null)
568
586
  && (typeof ma.connotation !== 'object' || ma.connotation === null)) return [];
569
- const rows = [{ Field: '', Value: '' }, { Field: 'The mark itself', Value: '', _head: true }];
587
+ const rows = [{ Field: '', Value: '' }, { Field: W.markItself, Value: '', _head: true }];
570
588
  const field = (label, v) => {
571
589
  if (v == null) return;
572
590
  rows.push({ Field: ` ${label}`, Value: plainNote(projectAssessmentField(v)) });
573
591
  if (typeof v !== 'object') return;
574
592
  for (const r of (Array.isArray(v.per_class) ? v.per_class : []))
575
- rows.push({ Field: ` Class ${String(r.class).trim()}`, Value: plainNote(r.note) });
593
+ rows.push({ Field: ` ${W.perClass(String(r.class).trim())}`, Value: plainNote(r.note) });
576
594
  for (const r of (Array.isArray(v.per_market) ? v.per_market : []))
577
595
  rows.push({ Field: ` ${plainNote(r.market)}`, Value: plainNote(r.note) });
578
596
  for (const r of (Array.isArray(v.counter_registrations) ? v.counter_registrations : []))
579
- rows.push({ Field: ' Coexisting registration', Value: plainNote([r.mark, r.uri, r.owner, r.note].filter(Boolean).join(' — ')) });
597
+ rows.push({ Field: ` ${W.coexistingRegistration}`, Value: plainNote([r.mark, r.uri, r.owner, r.note].filter(Boolean).join(' — ')) });
580
598
  };
581
- field('Distinctiveness', ma.distinctiveness);
582
- field('Connotation', ma.connotation);
599
+ field(W.distinctiveness, ma.distinctiveness);
600
+ field(W.connotation, ma.connotation);
583
601
  return rows.length > 2 ? rows : [];
584
602
  }
585
603
  function coverageJudgmentSummaryRows(cj) {
586
604
  const rows = Array.isArray(cj?.rows) ? cj.rows : [];
587
605
  if (!rows.length) return [];
588
- return [{ Field: '', Value: '' }, { Field: 'Coverage judgment — slices considered', Value: '', _head: true },
606
+ return [{ Field: '', Value: '' }, { Field: W.howCoverageWasJudged, Value: '', _head: true },
589
607
  ...rows.map((r) => ({ Field: ` ${plainNote(r.areaLabel || r.area)}`, Value: plainNote(r.note) }))];
590
608
  }
591
609
  function correctionsSummaryRows(c) {
592
610
  const entries = Array.isArray(c?.entries) ? c.entries : [];
593
611
  if (!entries.length) return [];
594
- return [{ Field: '', Value: '' }, { Field: 'Review corrections applied', Value: '', _head: true },
612
+ return [{ Field: '', Value: '' }, { Field: W.correctionsApplied, Value: '', _head: true },
595
613
  ...entries.map((r) => ({ Field: ` ${plainNote(r.entity)}`, Value: plainNote([r.disposition, r.note].filter(Boolean).join(' — ')) }))];
596
614
  }
597
615
 
@@ -635,13 +653,13 @@ export async function buildAudit(contract, auditParsed, outPath, mark = '', fm =
635
653
  const registerOnly = contract?.registerOnly === true;
636
654
  const joinedTerms = contract?.commonLawJoinedTerms instanceof Set ? contract.commonLawJoinedTerms
637
655
  : Array.isArray(contract?.commonLawJoinedTerms) ? new Set(contract.commonLawJoinedTerms.map(s => String(s).toUpperCase())) : null;
638
- const searched = searchRows(auditParsed, { findings: contract?.findings || [], joinedTerms, registerOnly });
656
+ const searched = searchRows(auditParsed, { findings: contract?.findings || [], joinedTerms, registerOnly, registerReach: contract?.registerReach ?? null, registerScope: contract?.registerScope ?? null });
639
657
  const commonLawUnlogged = searched.some(r => r._commonLawUnlogged);
640
658
 
641
659
  // 1 · Summary
642
660
  addSheet(wb, 'Summary', ['Field', 'Value'],
643
661
  [...summaryRows(findings, coverage, fm, { mark, coverageJudgment, verdict, jurisdiction, registerOnly, commonLawUnlogged, clientGate: contract?.clientGate ?? null, lintFailures: contract?.lintFailures ?? [], productName: contract?.productName ?? null, degradedParts, assessmentNotCompleted: contract?.assessmentNotCompleted === true }),
644
- // PR-9 — the structured v5 rows (mark assessment / coverage-judgment slices / corrections
662
+ // The structured v5 rows (mark assessment / coverage-judgment slices / corrections
645
663
  // attestation) render as ROWS here; the report carries only their string projection. All three
646
664
  // are empty on legacy records, so a republished archived workbook never grows rows.
647
665
  ...assessmentSummaryRows(contract?.markAssessment ?? null),
@@ -654,7 +672,7 @@ export async function buildAudit(contract, auditParsed, outPath, mark = '', fm =
654
672
  if (kept.has('Link')) {
655
673
  const link = row.getCell('Link');
656
674
  const url = String(link.value || '').trim();
657
- if (/^https?:\/\//i.test(url)) { link.value = { text: 'View', hyperlink: url }; link.font = { color: { argb: 'FF0563C1' }, underline: true }; }
675
+ if (/^https?:\/\//i.test(url)) { link.value = { text: W.view, hyperlink: url }; link.font = { color: { argb: WB.link }, underline: true }; }
658
676
  }
659
677
  if (kept.has('Risk band')) {
660
678
  const band = row.getCell('Risk band');
@@ -666,7 +684,7 @@ export async function buildAudit(contract, auditParsed, outPath, mark = '', fm =
666
684
  // are identified by the flag the row already carries, not re-derived from three of its cells: the
667
685
  // re-derivation needed Scope and Result to exist, which on a sparse run they do not.
668
686
  addSheet(wb, 'What was searched', SEARCH_COLS, searched, (row, data) => {
669
- if (data?._section) row.eachCell(c => { c.font = { bold: true }; c.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFEDEDED' } }; });
687
+ if (data?._section) row.eachCell(c => { c.font = { bold: true }; c.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: WB.sectionFill } }; });
670
688
  });
671
689
 
672
690
  // 4 · Coverage & gaps — the honest completeness ledger, state coloured.
@@ -690,7 +708,7 @@ export async function buildAudit(contract, auditParsed, outPath, mark = '', fm =
690
708
  addSheet(wb, 'Coverage & gaps', COVERAGE_COLS,
691
709
  [...coverageRows(coverage), ...coverageRows(degradedParts), ...coverageRows(contract?.droppedConditions || []),
692
710
  ...coverageRows(contract?.undispatchedProbes || []), ...coverageRows(contract?.withheldFamilies || []),
693
- ...coverageRows(contract?.releasedFamilies || []), ...(contract?.setAside || []).map((s) => ({ Area: plainNote(s.area), State: 'Note', 'What was done': plainNote(s.note) || '—', "What's left": '—' }))], (row, _d, kept) => {
711
+ ...coverageRows(contract?.releasedFamilies || []), ...(contract?.setAside || []).map((s) => ({ Area: plainNote(coverageUnitLabel(s.area)), State: 'Note', 'What was done': plainNote(s.note) || '—', "What's left": '—' }))], (row, _d, kept) => {
694
712
  if (!kept.has('State')) return;
695
713
  const st = row.getCell('State'); const f = STATE_FILL[String(st.value).trim()];
696
714
  if (f) { st.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FF' + f } }; st.font = { bold: true }; }
@@ -708,7 +726,7 @@ export async function buildAudit(contract, auditParsed, outPath, mark = '', fm =
708
726
  sheets: wb.worksheets.map(w => w.name),
709
727
  findings: findings.length,
710
728
  coverage: coverage.length,
711
- searched: wb.getWorksheet('What was searched')?.rowCount - 1 || 0,
729
+ searched: wb.getWorksheet(LABELS.sheets['What was searched'])?.rowCount - 1 || 0,
712
730
  gateViolations: gate.violations,
713
731
  };
714
732
  }
@@ -726,13 +744,7 @@ export async function buildAudit(contract, auditParsed, outPath, mark = '', fm =
726
744
  // name. A web address loses its scheme in any case and keeps its host and path. has_more is plainNote's.
727
745
  //
728
746
  // Kept down here, below every line the rest of the tree cites in this file by number.
729
- export const READER_WORDS = Object.freeze({
730
- receipt: 'record', receipts: 'records',
731
- lint: 'check', tripwire: 'check', tripwires: 'checks',
732
- composite: 'combined', scatter: 'chart', cache: 'stored copy',
733
- quadrant: 'position', quadrants: 'positions', coordinate: 'position', coordinates: 'positions',
734
- meter: 'measure', meters: 'measures',
735
- });
747
+ export const READER_WORDS = W.readerWords;
736
748
  const READER_WORD = new RegExp(`\\b(?:${Object.keys(READER_WORDS).join('|')})\\b`, 'gi');
737
749
 
738
750
  function readerWords(s) {
@@ -755,7 +767,7 @@ export function validateAudit(wb, { findings = [], coverage = [], coverageJudgme
755
767
  const sheets = wb.worksheets.map(w => w.name);
756
768
 
757
769
  // 1 — exactly four tabs, the four plain names, none saying "receipts".
758
- const EXPECT = ['Summary', 'Findings', 'What was searched', 'Coverage & gaps'];
770
+ const EXPECT = ['Summary', 'Findings', 'What was searched', 'Coverage & gaps'].map((n) => LABELS.sheets[n]);
759
771
  if (sheets.length !== 4) v.push(`expected 4 tabs, got ${sheets.length} (${sheets.join(', ')})`);
760
772
  for (const name of EXPECT) if (!sheets.includes(name)) v.push(`missing tab "${name}"`);
761
773
 
@@ -784,7 +796,7 @@ export function validateAudit(wb, { findings = [], coverage = [], coverageJudgme
784
796
  // green while `HTTP 404 for uri=/mark/ch/06198` shipped in Summary r12. These rows are held to the
785
797
  // delivery house rules (predelivery-lint's list) AND to BANNED, and a hit is reported as a
786
798
  // violation the A10 tests assert to be empty.
787
- const summaryWs = wb.getWorksheet('Summary');
799
+ const summaryWs = wb.getWorksheet(LABELS.sheets['Summary']);
788
800
  if (summaryWs) {
789
801
  summaryWs.eachRow((row, rn) => {
790
802
  const cellText = (c) => { const val = c.value; return val && typeof val === 'object' ? (val.text ?? val.hyperlink ?? (val.richText || []).map(r => r.text).join('')) : val; };
@@ -810,8 +822,8 @@ export function validateAudit(wb, { findings = [], coverage = [], coverageJudgme
810
822
  }
811
823
  }
812
824
 
813
- const findWs = wb.getWorksheet('Findings');
814
- const col = (ws, name) => { let idx = 0; ws.getRow(1).eachCell((c, i) => { if (c.value === name) idx = i; }); return idx; };
825
+ const findWs = wb.getWorksheet(LABELS.sheets['Findings']);
826
+ const col = (ws, name) => { let idx = 0; ws.getRow(1).eachCell((c, i) => { if (c.value === (LABELS.columns[name] ?? name)) idx = i; }); return idx; };
815
827
  // A column addSheet DROPPED has no index here — col() returns 0, and exceljs refuses column 0 as hard
816
828
  // as it refuses column 16385, so the gate threw on exactly the workbooks it exists to judge. Reading a
817
829
  // dropped column as an EMPTY cell is not a softening: every check below already treats "" as the
@@ -893,11 +905,18 @@ export function validateAudit(wb, { findings = [], coverage = [], coverageJudgme
893
905
  if (/not retrieved/i.test(ret) && !/unverified/i.test(ret) && !/n\/a/i.test(ret) && !/read/i.test(ret)) {
894
906
  // "Not individually retrieved" is allowed; only a fetch-FAILURE must carry "unverified"
895
907
  }
896
- // 5 — rated findings: four drivers each tagged from-source/our-read (context notes exempt).
908
+ // 5 — rated findings: each driver says how its value is evidenced in the report's words, as the page does
909
+ // (context notes exempt). Similarity carries no evidence word; Use carries only "inferred" or "not checked"; the
910
+ // other two carry one of the four words or none; an unknown value nobody checked reads "not checked".
897
911
  if (!isCtx) {
912
+ const WORDS = { 'mark similarity': null, 'goods proximity': /^(?:verified|not yet verified|inferred|not checked)$/i,
913
+ use: /^(?:inferred|not checked)$/i, enforcer: /^(?:verified|not yet verified|inferred|not checked)$/i };
898
914
  for (const [cc, label] of [[cMs, 'mark similarity'], [cGp, 'goods proximity'], [cUse, 'use'], [cEnf, 'enforcer']]) {
899
915
  const t = cellText(cc);
900
- if (!/from source|our read/i.test(t)) v.push(`Findings "${mark}": ${label} driver not tagged from-source/our-read (got "${t}")`);
916
+ const word = t.includes(' · ') ? t.slice(t.lastIndexOf(' · ') + 3) : '';
917
+ if (label === 'mark similarity') { if (word) v.push(`Findings "${mark}": the similarity driver carries an evidence word the report does not print (got "${t}")`); }
918
+ else if (/^unknown\b/i.test(t) && !word) v.push(`Findings "${mark}": ${label} driver is unknown but says nothing about its evidence (got "${t}")`);
919
+ else if (word && !WORDS[label].test(word)) v.push(`Findings "${mark}": ${label} driver's evidence word is not the report's (got "${t}")`);
901
920
  }
902
921
  }
903
922
  }
@@ -920,7 +939,7 @@ export function validateAudit(wb, { findings = [], coverage = [], coverageJudgme
920
939
  // gate is EXPORTED and a caller can hand it a workbook this builder did not assemble — a missing
921
940
  // block is still the right thing to say about such a workbook. Do not read its absence from the
922
941
  // build path as the check having been retired.
923
- const searchWs = wb.getWorksheet('What was searched');
942
+ const searchWs = wb.getWorksheet(LABELS.sheets['What was searched']);
924
943
  if (searchWs) {
925
944
  const cTerm = col(searchWs, 'Search term / variant') || 2;
926
945
  let inCommon = false, sawCommon = false, commonTerms = 0;
@@ -937,7 +956,7 @@ export function validateAudit(wb, { findings = [], coverage = [], coverageJudgme
937
956
  }
938
957
 
939
958
  // 8/9 — Summary leads with verdict + caveat; and the headline is never clean while a unit did not finish.
940
- const sumWs = wb.getWorksheet('Summary');
959
+ const sumWs = wb.getWorksheet(LABELS.sheets['Summary']);
941
960
  if (sumWs) {
942
961
  let hasVerdict = false, hasCaveat = false;
943
962
  sumWs.eachRow(row => {
@@ -949,7 +968,7 @@ export function validateAudit(wb, { findings = [], coverage = [], coverageJudgme
949
968
  if (!hasVerdict && !assessmentNotCompleted) v.push('Summary: no Verdict row');
950
969
  if (coverageOpen({ coverage, coverageJudgment, verdict, degradedParts })) {
951
970
  if (!hasCaveat) v.push('Summary: coverage is open but no caveat row (headline-honesty)');
952
- const covWs = wb.getWorksheet('Coverage & gaps');
971
+ const covWs = wb.getWorksheet(LABELS.sheets['Coverage & gaps']);
953
972
  let openRow = false;
954
973
  // by header, not by position: a dropped column shifts the second column to a different question,
955
974
  // and this check must read the State word or read nothing (and then say the caveat is missing).