clearotron 0.6.0 → 0.7.0-beta.0
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/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 +39 -0
- package/driver/connotation-search.mjs +1 -1
- package/driver/contract-e3-backlog.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 +4 -3
- 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/gateway.mjs +67 -10
- package/driver/jx.mjs +13 -5
- package/driver/manuals-seen.mjs +146 -0
- package/driver/mark-logos.mjs +144 -0
- package/driver/methodology-witness.mjs +2 -1
- package/driver/owner-use-check.mjs +3 -3
- package/driver/package.json +1 -1
- package/driver/pipeline-knockout.mjs +4 -0
- package/driver/pipeline.mjs +92 -7
- package/driver/portal-local-auth.mjs +6 -2
- package/driver/portal-report.mjs +43 -12
- package/driver/portal-routes/me.mjs +4 -1
- package/driver/portal-runs.mjs +6 -9
- package/driver/profiles.mjs +4 -4
- package/driver/publish/README.md +9 -7
- package/driver/publish/email-conditions.mjs +2 -2
- package/driver/publish/evidence-words.mjs +21 -0
- package/driver/publish/index.mjs +104 -90
- package/driver/publish/knockout.mjs +75 -49
- package/driver/publish/office-record-links.mjs +11 -9
- package/driver/publish/page-shell.mjs +98 -0
- package/driver/publish/publish-inputs.mjs +4 -0
- package/driver/publish/regions.mjs +24 -3
- package/driver/publish/register-record.mjs +150 -0
- package/driver/publish/render-knockout.mjs +195 -642
- package/driver/publish/render.mjs +270 -363
- package/driver/publish/report-data.mjs +225 -12
- package/driver/publish/strings.mjs +662 -0
- package/driver/publish/templates/knockout.css +200 -0
- package/driver/publish/templates/report.css +72 -52
- package/driver/publish/xlsx.mjs +148 -125
- package/driver/record-goods.mjs +42 -0
- package/driver/reference-score.mjs +4 -1
- package/driver/register-reach.mjs +39 -0
- package/driver/registry-fidelity.mjs +3 -8
- package/driver/repair-composers.mjs +6 -2
- package/driver/repair-targets.mjs +4 -1
- package/driver/run-delivered.mjs +6 -1
- package/driver/runner.mjs +73 -29
- package/driver/scope-facts.mjs +27 -6
- package/driver/search-policy.mjs +9 -4
- package/driver/stages.mjs +3 -3
- package/driver/steps/overview-and-cards.mjs +50 -14
- package/driver/steps/verdict-gate.mjs +33 -13
- package/driver/suite-census.json +368 -68
- package/driver/terminal-clamp.mjs +6 -1
- package/mcp-server/CHANGELOG.md +4 -0
- package/mcp-server/lib/audit-view.mjs +5 -2
- package/mcp-server/lib/brief.mjs +2 -1
- package/mcp-server/lib/evidence.mjs +31 -4
- package/mcp-server/lib/knockout.mjs +1 -1
- package/mcp-server/lib/scrub.mjs +1 -1
- package/mcp-server/package.json +1 -1
- package/mcp-server/server.mjs +5 -3
- package/package.json +4 -1
- package/portal-ui/dist/assets/{index-CYaO2ygd.js → index-CtkllKJ2.js} +225 -77
- 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/oauth-mcp-bridge/CHANGELOG.md +4 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/scripts/README.md +147 -3
- package/scripts/e2e-first-time.mjs +3 -3
- package/scripts/freeze-example-run.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 +85 -5
- package/shared/inline-markdown.mjs +53 -0
- package/shared/portal-tokens.mjs +2 -1
- package/shared/register-selection.mjs +8 -3
- package/shared/search-level-tags.json +25 -0
- package/shared/tools/derive-band-pairs.mjs +10 -0
- package/driver/own-rights.mjs +0 -83
- package/driver/use-check.mjs +0 -85
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
3
|
-
// publish/report-data.mjs —
|
|
4
|
-
// report-data
|
|
5
|
-
//
|
|
3
|
+
// publish/report-data.mjs — the run as data, one producer per shape: clearanceReportData writes
|
|
4
|
+
// `report-data/clearance-1` and knockoutReportData (at the end of this file) `report-data/knockout-1`.
|
|
5
|
+
// Each shape's JSON Schema is under docs/report-data/.
|
|
6
6
|
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
7
|
+
// The assistant drafts client-facing mail from it. The portal does not read it: every report the portal
|
|
8
|
+
// shows is the stored HTML. The Knockout's shape is a different one, `report-data/knockout-1`; the two
|
|
9
|
+
// schemas are under docs/report-data/.
|
|
9
10
|
//
|
|
10
11
|
// THE TWO LANES DIVERGED ON 2026-09-07 AND THIS FILE DID NOT MOVE. The owner ruled
|
|
11
12
|
// that the KNOCKOUT report carries the reviewer's notes, on the ground that one report is read by the
|
|
@@ -31,7 +32,10 @@
|
|
|
31
32
|
// PURE — no IO, no config: publishReport gathers the stores and passes them in, so the producer is unit-
|
|
32
33
|
// testable offline and a republished archived run reproduces its file deterministically.
|
|
33
34
|
import { stripInternal, dropLabelledInternals, stripEngineInternals } from './parse.mjs';
|
|
34
|
-
import { DISPOSITION_GROUP, deriveActionConditions, projectAssessmentField } from '../findings-model.mjs';
|
|
35
|
+
import { DISPOSITION_GROUP, deriveActionConditions, projectAssessmentField, knockoutFindingViews } from '../findings-model.mjs';
|
|
36
|
+
import { COUNT_BASIS, COUNT_PREDICATES, countsForMark, countLine, variantFormsLine, disclosedFloor } from '../register-count.mjs';
|
|
37
|
+
import { recordBasisOf, recordsForMark, recordsLine } from '../register-records.mjs';
|
|
38
|
+
import { registerCardViews, ownerCheckFor, ownerCheckText, ownerCheckOutcome, NOT_WEIGHED_LINE as NOT_WEIGHED } from './render-knockout.mjs';
|
|
35
39
|
import { clientConditions } from '../terminal-clamp.mjs'; // the reader's clause per condition — one definition, shared with the email
|
|
36
40
|
|
|
37
41
|
// The client scrub choke point: the three existing rules, in the order the client HTML applies them.
|
|
@@ -81,7 +85,7 @@ export function clearanceReportData({
|
|
|
81
85
|
deadline: a.deadline?.date ? { kind: a.deadline.kind ?? null, date: a.deadline.date } : null,
|
|
82
86
|
});
|
|
83
87
|
return {
|
|
84
|
-
schema: 'report-data/1',
|
|
88
|
+
schema: 'report-data/clearance-1',
|
|
85
89
|
kind: 'clearance',
|
|
86
90
|
runId,
|
|
87
91
|
codename: codename || null,
|
|
@@ -200,11 +204,10 @@ export function clearanceReportData({
|
|
|
200
204
|
// ADVISORY_TAG rather than a named filter. then wrote a watch group for "monitoring and
|
|
201
205
|
// filing-routine" and neither copy was told. Ruling 2026-08-19: the kind renders.
|
|
202
206
|
//
|
|
203
|
-
// This surface is the one
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
// advisories and nothing else.
|
|
207
|
+
// This surface is the one an outside reader of the data takes the asks from, so a fix that reached
|
|
208
|
+
// only the markdown renderer would have left the kind unreachable here, while the tests around the
|
|
209
|
+
// other copy went green. All four ADVISORY_KINDS travel; the partition is conditions vs advisories and
|
|
210
|
+
// nothing else.
|
|
208
211
|
actions: {
|
|
209
212
|
conditions: conditionActions.map(action),
|
|
210
213
|
advisories: advisoryActions.map(action),
|
|
@@ -214,3 +217,213 @@ export function clearanceReportData({
|
|
|
214
217
|
})).filter((a) => a.ask && a.answer),
|
|
215
218
|
};
|
|
216
219
|
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* The KNOCKOUT run as data: report-data.json beside each name's report, in the shape
|
|
223
|
+
* `report-data/knockout-1` (docs/report-data/knockout-1.schema.json). It moved here from the Knockout
|
|
224
|
+
* renderer so both producers sit together; its output did not change but for that string.
|
|
225
|
+
*
|
|
226
|
+
* The assistant drafts a client-facing email from it (which is why the retired per-customer email template
|
|
227
|
+
* does not need to come back as config: formatting is judgement, and this is the input judgement works from).
|
|
228
|
+
*
|
|
229
|
+
* It carries what the REPORT says, plus the level identity, and nothing internal: the audit workbook is
|
|
230
|
+
* where the working notes live, and a data file that quietly re-admitted them would reopen exactly the
|
|
231
|
+
* leak this series closed.
|
|
232
|
+
*/
|
|
233
|
+
export function knockoutReportData(findings, framework, { runId, codename, overall, issued, identity, registerCounts, registerRecords = null, ownerChecks = [], url, auditFile, customerKey, matter, servedModels = null }) {
|
|
234
|
+
const marks = findings?.marks ?? [];
|
|
235
|
+
return {
|
|
236
|
+
schema: 'report-data/knockout-1',
|
|
237
|
+
runId,
|
|
238
|
+
codename: codename || null,
|
|
239
|
+
matter: matter || runId,
|
|
240
|
+
customerKey: customerKey || 'generic',
|
|
241
|
+
issued: issued || null,
|
|
242
|
+
url: url || null,
|
|
243
|
+
auditFile: auditFile || null,
|
|
244
|
+
// The models that served the run, in first-use order, as tokens.mjs servedModels names them for a
|
|
245
|
+
// client: a deployment's own name never, its tier instead. null when nothing was read.
|
|
246
|
+
servedModels: Array.isArray(servedModels) ? servedModels : null,
|
|
247
|
+
level: {
|
|
248
|
+
searchLevel: identity?.level ?? null,
|
|
249
|
+
stageLabel: identity?.stageLabel ?? null,
|
|
250
|
+
identity: identity?.identity ?? null,
|
|
251
|
+
// `banner` is NOT projected. It is stageLabel joined to identity, so on a retired row it carries a
|
|
252
|
+
// depth rung — and report-data.json is a CLIENT surface (the portal's native render and the MCP
|
|
253
|
+
// brief read it). The two fields it is made of are both here already; a consumer that wants the
|
|
254
|
+
// internal face takes `stageLabel`, and nothing gets a pre-joined string that leaks one.
|
|
255
|
+
},
|
|
256
|
+
framework: framework ? { key: framework.framework_key, title: framework.title, bands: framework.bands.map((b) => ({ label: b.label, tone: b.tone })) } : null,
|
|
257
|
+
overall: overall ?? null,
|
|
258
|
+
summary: findings?.batch?.executiveSummary ?? null,
|
|
259
|
+
productContext: findings?.batch?.productContext ?? null,
|
|
260
|
+
caveats: findings?.batch?.standardCaveats ?? [],
|
|
261
|
+
marks: marks.map((m) => {
|
|
262
|
+
const counted = registerCounts ? countsForMark(registerCounts, m.name) : null;
|
|
263
|
+
return {
|
|
264
|
+
name: m.name,
|
|
265
|
+
band: m.rating ?? null,
|
|
266
|
+
qualifier: m.ratingQualifier ?? null,
|
|
267
|
+
// WHAT THIS NAME IS FOR. Per MARK, not per batch — a character name and a
|
|
268
|
+
// franchise title can sit at different bands on identical evidence, and the manner-of-use
|
|
269
|
+
// calibration in the firm-wide reasoning turns on exactly this. It reached the plan and the
|
|
270
|
+
// rater and stopped there: this projection is an explicit whitelist, so a field nobody adds is
|
|
271
|
+
// a field the assistant drafting client mail never sees, however faithfully the rater carried
|
|
272
|
+
// it. Null on an archived run that predates the frame carrying it.
|
|
273
|
+
contextFraming: m.contextFraming ?? null,
|
|
274
|
+
classesSearched: m.classesSearched ?? [],
|
|
275
|
+
classesDriving: m.classesDriving ?? [],
|
|
276
|
+
...(Array.isArray(m.classGroups) && m.classGroups.length ? { classGroups: m.classGroups } : {}),
|
|
277
|
+
degraded: Boolean(m.degraded),
|
|
278
|
+
points: m.bullets ?? [],
|
|
279
|
+
// ── THE ASSESSMENT THE RUN ALREADY WROTE ──────────────────────────────────────────────────
|
|
280
|
+
//
|
|
281
|
+
// Seven keys the assess stage writes into knockout-findings.json reached this file as nothing.
|
|
282
|
+
// They were not withheld by a rule — no code decided against them; this projection is an explicit
|
|
283
|
+
// whitelist and nobody had added them, so an assistant drafting from this file could not see the
|
|
284
|
+
// reasoning behind a rating it was drafting about.
|
|
285
|
+
//
|
|
286
|
+
// `assessment` is the sharpest case: publish substitutes it into `batch.executiveSummary` ONLY on
|
|
287
|
+
// a multi-mark batch, so on a single-mark run — the common knockout — the mark's own opening read
|
|
288
|
+
// was written, validated, and then dropped by both surfaces at once.
|
|
289
|
+
//
|
|
290
|
+
// `purpleNotes` is the reviewer's notes, and it is here by the owner's ruling of 2026-09-07: one
|
|
291
|
+
// report, read by the person who ran Clearotron, because keeping material off it "just adds
|
|
292
|
+
// confusion for where data is lost". They are LABELLED on the page rather than merged into the
|
|
293
|
+
// client-voiced body — see reviewerNotesBlock — so a reader can tell whose voice they are in.
|
|
294
|
+
assessment: (() => { const t = String(m.assessment ?? '').trim(); return t || null; })(),
|
|
295
|
+
counterFactors: m.counterFactors ?? [],
|
|
296
|
+
mitigation: (() => { const t = String(m.mitigation ?? '').trim(); return t || null; })(),
|
|
297
|
+
// `null`, not `false`, when the rater said nothing: a crowded field is a mitigant the reasoning
|
|
298
|
+
// turns on, and an unstated one must not read as a stated "no".
|
|
299
|
+
crowdedField: typeof m.crowdedField === 'boolean' ? m.crowdedField : null,
|
|
300
|
+
reviewerNotes: m.purpleNotes ?? [],
|
|
301
|
+
// The proof-of-search rows — the same defensibility record list_searches answers from.
|
|
302
|
+
negatives: (m.negatives ?? []).map((n) => ({
|
|
303
|
+
term: n?.term ?? null, source: n?.source ?? null, note: n?.note ?? null,
|
|
304
|
+
})),
|
|
305
|
+
// The rater's read of a filing it weighed, keyed by the record id the card prints, so a consumer
|
|
306
|
+
// can join a read to its filing without matching on prose.
|
|
307
|
+
registerReads: (m.registerReads ?? []).map((x) => ({
|
|
308
|
+
recordId: x?.recordId ?? null,
|
|
309
|
+
read: x?.read ?? null,
|
|
310
|
+
band: String(x?.band ?? '').trim() || null,
|
|
311
|
+
// the framework's own inputs, where it states a method — absent otherwise, so every other run's data is unchanged
|
|
312
|
+
...(x?.inputs ? { inputs: x.inputs } : {}),
|
|
313
|
+
})),
|
|
314
|
+
// — the typed finding, ranked, with the reference the report prints. The old key was
|
|
315
|
+
// `evidence[]` and it was `(m.findings ?? []).filter((f) => f?.url)`: a typed finding has no
|
|
316
|
+
// `url`, so this file — the one the assistant drafts client mail from — silently carried zero
|
|
317
|
+
// conflicts for a mark that had several. `shape` says which record each row came from, so a
|
|
318
|
+
// reader can tell a typed run from an archived prose one without guessing at the blanks.
|
|
319
|
+
findings: [
|
|
320
|
+
...knockoutFindingViews(m, { manifest: framework }).map((v) => ({
|
|
321
|
+
ref: v.ref, ordinal: v.ordinal, name: v.name, owner: v.owner, band: v.band, type: v.type,
|
|
322
|
+
net: v.lead, basis: v.detail, evidence: v.evidence, shape: v.shape,
|
|
323
|
+
...(v.inputs ? { inputs: v.inputs } : {}),
|
|
324
|
+
})),
|
|
325
|
+
// — the promoted register filings, in the SAME array, from the SAME projection the page
|
|
326
|
+
// renders from (registerCardViews). Two reasons it cannot live under its own key:
|
|
327
|
+
//
|
|
328
|
+
// 1. THE FLAG. portal-service.mjs resolves per-finding feedback as
|
|
329
|
+
// `data.marks[markIndex].findings.find(f => f.ordinal === ordinal)`, against the
|
|
330
|
+
// `data-ko-ord` the card carries. A card in the DOM with no row here resolves NOTHING and
|
|
331
|
+
// logs `resolved:false` — the reader's correction is captured against no facts, silently.
|
|
332
|
+
// 2. THE BRIEF. mcp-server/lib/brief.mjs walks this array to write "Each name screened".
|
|
333
|
+
// A promoted filing the brief omitted would be the report and the brief disagreeing about
|
|
334
|
+
// what the run found.
|
|
335
|
+
//
|
|
336
|
+
// `shape: 'register'` is the load-bearing field: a consumer can tell a weighed conflict from a
|
|
337
|
+
// pointed-at filing without parsing prose.
|
|
338
|
+
//
|
|
339
|
+
// `band` AND `basis` NOW CARRY THE RATER'S READ WHEN IT SENT ONE. Before
|
|
340
|
+
// this, both were constants — `band: null` and the not-weighed sentence — on every filing of
|
|
341
|
+
// every run, including runs where the seat had written a full read of that exact filing and the
|
|
342
|
+
// HTML card was already printing it. The page and this file disagreed, and this file is the one
|
|
343
|
+
// the MCP brief answers from, so the surface a reader asks "what did you make of that
|
|
344
|
+
// registration?" was the surface that had dropped the answer.
|
|
345
|
+
//
|
|
346
|
+
// The unmatched case is unchanged and must stay that way: no row for this recordId ⇒ `band:
|
|
347
|
+
// null` and the not-weighed line, which describes the card and claims nothing.
|
|
348
|
+
...registerCardViews(m, framework, registerRecords).cards.map((v) => {
|
|
349
|
+
const row = (Array.isArray(m?.registerReads) ? m.registerReads : [])
|
|
350
|
+
.find((x) => String(x?.recordId ?? '').trim() && String(x?.recordId ?? '').trim() === String(v.record?.recordId ?? '').trim());
|
|
351
|
+
const read = String(row?.read ?? '').trim() || null;
|
|
352
|
+
const band = String(row?.band ?? '').trim() || null;
|
|
353
|
+
// The driver's own record of where this filing's proprietor was looked up, joined by
|
|
354
|
+
// recordId. `null` where the run owed no check — the same three states the
|
|
355
|
+
// card has, so a consumer can tell "searched and found nothing" from "never searched".
|
|
356
|
+
const oc = ownerCheckFor(ownerChecks, v.record?.recordId);
|
|
357
|
+
return {
|
|
358
|
+
ref: v.ref, ordinal: v.ordinal, name: v.record.mark, owner: v.record.owner, band,
|
|
359
|
+
...(band && row?.inputs ? { inputs: row.inputs } : {}),
|
|
360
|
+
type: 'Register filing',
|
|
361
|
+
net: read ? v.statement : `${v.statement} It was ${NOT_WEIGHED}.`,
|
|
362
|
+
basis: read ?? NOT_WEIGHED,
|
|
363
|
+
useCheckSource: ownerCheckText(ownerCheckOutcome(oc)),
|
|
364
|
+
evidence: v.evidence, shape: 'register',
|
|
365
|
+
};
|
|
366
|
+
}),
|
|
367
|
+
],
|
|
368
|
+
registerCounts: counted?.counts
|
|
369
|
+
? {
|
|
370
|
+
classScope: counted.classScope ?? null,
|
|
371
|
+
classes: counted.classes ?? [],
|
|
372
|
+
...Object.fromEntries(COUNT_PREDICATES.map((p) => [p.key, Number.isFinite(counted.counts[p.key]?.total) ? counted.counts[p.key].total : null])),
|
|
373
|
+
// The figure stays null for a floor — a floor is never a count to be summed — and the floor
|
|
374
|
+
// rides beside it, so a reader of this file has the register's own figure and not only a null.
|
|
375
|
+
...(COUNT_PREDICATES.some((p) => disclosedFloor(counted.counts[p.key]) !== null)
|
|
376
|
+
? { floors: Object.fromEntries(COUNT_PREDICATES.filter((p) => disclosedFloor(counted.counts[p.key]) !== null)
|
|
377
|
+
.map((p) => [p.key, disclosedFloor(counted.counts[p.key])])) }
|
|
378
|
+
: {}),
|
|
379
|
+
// The close column is an aggregate, so the forms under it ride with it — a consumer that
|
|
380
|
+
// got the number and not the forms could restate the figure but never explain it, and this
|
|
381
|
+
// file is what the assistant drafts client mail from.
|
|
382
|
+
closeVariationForms: (counted.counts.close?.forms ?? []).map((f) => f.form),
|
|
383
|
+
closeVariationsLine: variantFormsLine(counted),
|
|
384
|
+
line: countLine(counted),
|
|
385
|
+
}
|
|
386
|
+
: null,
|
|
387
|
+
// part 5 — the filings behind the narrow counts, as data. The assistant drafts client mail
|
|
388
|
+
// from this file, so it gets the SAME three states the report gets: rows, an answered nothing,
|
|
389
|
+
// or a stated reason. `records: []` with no line beside it would be read as "no filings".
|
|
390
|
+
registerFilings: (() => {
|
|
391
|
+
const listed = registerRecords ? recordsForMark(registerRecords, m.name) : null;
|
|
392
|
+
if (registerRecords?.unavailable) return { available: false, line: registerRecords.unavailable, records: [] };
|
|
393
|
+
if (!listed) return null;
|
|
394
|
+
return {
|
|
395
|
+
available: true,
|
|
396
|
+
line: recordsLine(listed),
|
|
397
|
+
fetched: listed.fetched ?? (listed.records ?? []).length,
|
|
398
|
+
capped: Boolean(listed.capped),
|
|
399
|
+
// THE CAP THE RUN RECORDED, beside the flag that says it bit. `capped: true` on its own cannot
|
|
400
|
+
// tell a listing truncated at fifty from one a cap of zero stopped before it began: the first
|
|
401
|
+
// is a register outcome and the second is a configuration, and a consumer reading the flag
|
|
402
|
+
// alone reports them the same way. The run has always written `cap` per mark; nothing read it.
|
|
403
|
+
//
|
|
404
|
+
// NULL IS NOT ZERO and the two are kept apart all the way out, the way the portal's allowance
|
|
405
|
+
// contract keeps them. Null is a sidecar that recorded no cap at all, which is every run
|
|
406
|
+
// archived before the field existed; zero is a cap that was set to zero. Folding them together
|
|
407
|
+
// would put an archived run and a misconfigured one on the same line.
|
|
408
|
+
cap: Number.isFinite(listed.cap) ? listed.cap : null,
|
|
409
|
+
records: (listed.records ?? []).map((r) => ({
|
|
410
|
+
mark: r.mark, owner: r.owner, status: r.status, classes: r.classes ?? [],
|
|
411
|
+
territory: r.territory, matchedForm: r.matchedForm, matchedBasis: r.matchedBasis,
|
|
412
|
+
recordId: r.recordId, url: r.url,
|
|
413
|
+
// The office's page for the filing, or its office and number and why it is not a link: the
|
|
414
|
+
// report's own cell, as data. Only where the run's register has no record pages of its own.
|
|
415
|
+
...(r.officeLink ? { officeRecord: { label: r.officeLink.label, href: r.officeLink.href, reason: r.officeLink.reason } } : {}),
|
|
416
|
+
})),
|
|
417
|
+
// Which searches did NOT answer, by name. A consumer that lists only `records` would report
|
|
418
|
+
// a partial listing as a complete one. A form the cap stopped keeps its sentence; a failed
|
|
419
|
+
// search's own text stays in the run's filings record, never in this file.
|
|
420
|
+
unanswered: (listed.terms ?? []).filter((t) => !t.ok).map((t) => ({ form: t.term, basis: t.basis, reason: t.notAsked ? t.reason ?? null : null })),
|
|
421
|
+
};
|
|
422
|
+
})(),
|
|
423
|
+
};
|
|
424
|
+
}),
|
|
425
|
+
registerCountBasis: registerCounts ? COUNT_BASIS : null,
|
|
426
|
+
registerFilingsBasis: registerRecords && !registerRecords.unavailable ? recordBasisOf(registerRecords) : null,
|
|
427
|
+
registerProvider: registerCounts ? (registerCounts.providerLabel ?? registerCounts.provider ?? null) : null,
|
|
428
|
+
};
|
|
429
|
+
}
|