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
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
--accent-gradient: linear-gradient(90deg, #860F09, #4E030F, #AE5B58); /* JUDGED: composed from the three locked palette crimsons — no new hue */
|
|
42
42
|
--border-hairline: #E4DACA; /* brand --line */
|
|
43
43
|
--border-strong: #D8CCB8; /* brand --line2 */
|
|
44
|
-
--focus-ring: #860F09; /* brand --crimson */
|
|
44
|
+
--focus-ring: #860F09; /* brand --crimson; dark takes the dark --text-accent, since crimson on the dark page is too faint to see a focus by */
|
|
45
45
|
--font-body: 'Plus Jakarta Sans','Helvetica Neue',system-ui,sans-serif; /* brand --font */
|
|
46
46
|
--font-mono: 'Fira Code',ui-monospace,monospace; /* brand --mono */
|
|
47
47
|
--shadow-lg: 0 1px 2px rgba(37,9,2,.05), 0 10px 30px rgba(37,9,2,.07); /* brand --shadow */
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
--accent-gradient: linear-gradient(90deg, #860F09, #4E030F, #AE5B58); /* JUDGED: composed from the three locked palette crimsons — no new hue */
|
|
80
80
|
--border-hairline: #322c24; /* brand --line */
|
|
81
81
|
--border-strong: #3d362c; /* brand --line2 */
|
|
82
|
-
--focus-ring: #
|
|
82
|
+
--focus-ring: #e0736b; /* brand --crimson; dark takes the dark --text-accent, since crimson on the dark page is too faint to see a focus by */
|
|
83
83
|
--font-body: 'Plus Jakarta Sans','Helvetica Neue',system-ui,sans-serif; /* brand --font */
|
|
84
84
|
--font-mono: 'Fira Code',ui-monospace,monospace; /* brand --mono */
|
|
85
85
|
--shadow-lg: 0 1px 2px rgba(0,0,0,.4),0 10px 30px rgba(0,0,0,.55); /* brand --shadow */
|
|
@@ -771,7 +771,7 @@ button.twisty:focus {
|
|
|
771
771
|
}
|
|
772
772
|
|
|
773
773
|
button.twisty:focus-visible {
|
|
774
|
-
outline: 2px solid var(--
|
|
774
|
+
outline: 2px solid var(--focus-ring);
|
|
775
775
|
outline-offset: 1px;
|
|
776
776
|
}
|
|
777
777
|
|
|
@@ -886,6 +886,17 @@ table.data td.nest-2 {
|
|
|
886
886
|
@media (max-width: 560px) {
|
|
887
887
|
.names-wrap { overflow-x: auto; position: relative; }
|
|
888
888
|
}
|
|
889
|
+
/* THE EMPTY-LIST SENTENCE STAYS INSIDE THE FRAME. Its cell spans every column, so below 560px it is as
|
|
890
|
+
wide as the table's 860px floor, and the sentence ran past the wrapper's right edge: measured at 390 to
|
|
891
|
+
400px it read "… Pick another company" until the reader dragged the table. It now wraps at the
|
|
892
|
+
wrapper's width (the container measured above) and holds the wrapper's left edge while the table
|
|
893
|
+
scrolls under it. At desktop widths the table fits its wrapper and neither rule moves anything. */
|
|
894
|
+
.names-wrap .list-empty {
|
|
895
|
+
display: block;
|
|
896
|
+
position: sticky;
|
|
897
|
+
left: 12px;
|
|
898
|
+
max-width: calc(100cqi - 24px);
|
|
899
|
+
}
|
|
889
900
|
/* Eight pixels either side instead of twelve, on every column but the two narrow ones at the left: the
|
|
890
901
|
actions column takes a quarter of the table, and the text columns keep their words on one line by
|
|
891
902
|
giving up padding rather than width. The date and the actions give up a little more. */
|
|
@@ -1040,7 +1051,7 @@ button.row-open:hover {
|
|
|
1040
1051
|
}
|
|
1041
1052
|
button.row-open:focus-visible,
|
|
1042
1053
|
button.row-menu-btn:focus-visible {
|
|
1043
|
-
outline: 2px solid var(--
|
|
1054
|
+
outline: 2px solid var(--focus-ring);
|
|
1044
1055
|
outline-offset: 1px;
|
|
1045
1056
|
}
|
|
1046
1057
|
.row-menu {
|
|
@@ -1133,6 +1144,15 @@ button.row-menu-item {
|
|
|
1133
1144
|
color: var(--text-muted);
|
|
1134
1145
|
}
|
|
1135
1146
|
|
|
1147
|
+
/* The Clearances list's tags under a name: one small pill per kind of search behind it, on a line of their
|
|
1148
|
+
own so they never crowd the name, wrapping inside the Name cell at every width. */
|
|
1149
|
+
.level-tags {
|
|
1150
|
+
display: flex;
|
|
1151
|
+
flex-wrap: wrap;
|
|
1152
|
+
gap: 4px;
|
|
1153
|
+
margin-top: 5px;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1136
1156
|
/* The larger pill, for a control that is a card's closing action rather than a label — and an anchor
|
|
1137
1157
|
drawn as one, which is what opening a document in a new tab is. */
|
|
1138
1158
|
.pill-lg {
|
|
@@ -1261,7 +1281,7 @@ input[type='checkbox'].pickbox {
|
|
|
1261
1281
|
}
|
|
1262
1282
|
|
|
1263
1283
|
input[type='checkbox'].pickbox:focus-visible {
|
|
1264
|
-
outline: 2px solid var(--
|
|
1284
|
+
outline: 2px solid var(--focus-ring);
|
|
1265
1285
|
outline-offset: 2px;
|
|
1266
1286
|
}
|
|
1267
1287
|
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
chosen anywhere in the product holds everywhere in it.
|
|
37
37
|
-->
|
|
38
38
|
<script>(function(){try{var t=localStorage.getItem('cordillera-theme');if(t==='dark'||t==='light')document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
|
|
39
|
-
<script type="module" crossorigin src="/portal/assets/index-
|
|
40
|
-
<link rel="stylesheet" crossorigin href="/portal/assets/index-
|
|
39
|
+
<script type="module" crossorigin src="/portal/assets/index-BBlN4CYq.js"></script>
|
|
40
|
+
<link rel="stylesheet" crossorigin href="/portal/assets/index-CxAkJXIT.css">
|
|
41
41
|
</head>
|
|
42
42
|
<body>
|
|
43
43
|
<div id="root"></div>
|
package/portal-ui/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "portal-ui",
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.7.0-beta.1",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"description": "The unified trademark portal UI. One address, one login: who you are decides what you see. Built as a static bundle, served by driver/portal-service.mjs — the browser never reaches profile-service or recipe-service.",
|
|
8
8
|
"engines": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/react": "^19.3.0",
|
|
24
24
|
"@types/react-dom": "^19.3.0",
|
|
25
|
-
"@vitejs/plugin-react": "^6.
|
|
25
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
26
26
|
"typescript": "^7.0.2",
|
|
27
|
-
"vite": "^8.3.
|
|
27
|
+
"vite": "^8.3.8"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -33,6 +33,7 @@ import { appendFileSync, mkdirSync, statSync, openSync, readSync, closeSync, rea
|
|
|
33
33
|
import { dirname, basename } from "node:path";
|
|
34
34
|
import { createHash } from "node:crypto";
|
|
35
35
|
import { ledgerPath, RUN_RECORD_LOG_FILE } from "./ledger-path.mjs";
|
|
36
|
+
import { normalizeRecordUri } from "./record-uri.mjs";
|
|
36
37
|
|
|
37
38
|
export const CALL_LOG_PATH = ledgerPath("call");
|
|
38
39
|
// Spec A1 (citation fidelity): every fetched record's BODY is persisted alongside the call ledger, so the
|
|
@@ -135,7 +136,7 @@ export function makeLedger(provider) {
|
|
|
135
136
|
//
|
|
136
137
|
// Run-scoped ledgers only. The box-wide fallback file holds many runs, and a record one run fetched is not
|
|
137
138
|
// a record another run holds.
|
|
138
|
-
const RUN_INDEXES = new Map(); // dest → { offset, byTarget: Map<key, { hash, refreshed, ts, start, len }>, byGuid: Map<guid, key> }
|
|
139
|
+
const RUN_INDEXES = new Map(); // dest → { offset, byTarget: Map<key, { hash, refreshed, ts, start, len }>, byGuid: Map<guid, key>, withBody: Map<record key, { start, len }> }
|
|
139
140
|
const targetKey = (t) => String(t ?? "").toLowerCase(); // the key every reader of this file matches on
|
|
140
141
|
const bodyHash = (b) => createHash("sha1").update(JSON.stringify(b ?? null)).digest("hex");
|
|
141
142
|
// The record's own id: the last segment of `/mark/<office>/<id>`. The office segment is a hint that can
|
|
@@ -150,6 +151,9 @@ function indexRow(ix, line, start = null, len = null) {
|
|
|
150
151
|
const key = targetKey(r?.target);
|
|
151
152
|
ix.byTarget.set(key, { hash: bodyHash(r?.body), refreshed: r?.refreshed === true, ts: r?.ts ?? null, start, len });
|
|
152
153
|
if (key) ix.byGuid.set(guidOf(key), key);
|
|
154
|
+
// THE LAST LINE THAT CARRIES A BODY, under the record key a lookup by record id uses (recordBodyFromLog). Kept
|
|
155
|
+
// apart from `byTarget`, whose rule is the last line of any kind: a later line with no body must not hide a body.
|
|
156
|
+
if (r?.body) ix.withBody.set(normalizeRecordUri(r.target) || key, { start, len });
|
|
153
157
|
} catch { /* a torn or foreign line indexes nothing, and is left where it is */ }
|
|
154
158
|
}
|
|
155
159
|
|
|
@@ -160,7 +164,7 @@ function indexOf(dest) {
|
|
|
160
164
|
let ix = RUN_INDEXES.get(dest);
|
|
161
165
|
// A replacement elsewhere renames a NEW file over this one: same path, different inode, and an offset
|
|
162
166
|
// into the old file means nothing in the new one. Re-read from the start.
|
|
163
|
-
if (!ix || size < ix.offset || ix.ino !== ino) { ix = { offset: 0, ino, byTarget: new Map(), byGuid: new Map() }; RUN_INDEXES.set(dest, ix); }
|
|
167
|
+
if (!ix || size < ix.offset || ix.ino !== ino) { ix = { offset: 0, ino, byTarget: new Map(), byGuid: new Map(), withBody: new Map() }; RUN_INDEXES.set(dest, ix); }
|
|
164
168
|
if (size <= ix.offset) return ix;
|
|
165
169
|
const fd = openSync(dest, "r");
|
|
166
170
|
try {
|
|
@@ -219,6 +223,30 @@ export function heldRecordBodies(dest, ids) {
|
|
|
219
223
|
return out;
|
|
220
224
|
}
|
|
221
225
|
|
|
226
|
+
/**
|
|
227
|
+
* The body this run's record log holds for one record, or null: the last line naming it, by its record key, that
|
|
228
|
+
* carries a body. The same answer as reading the whole log and keeping the last such line, served from the index
|
|
229
|
+
* above, so a lookup costs the lines appended since the last one and one line's read, not a parse of the whole log.
|
|
230
|
+
* Measured on production's 0.4.x clearances before this existed: a whole-log lookup took a median 0.80 s and up to
|
|
231
|
+
* 147 s, inside serial stages whose model waited for each answer.
|
|
232
|
+
*
|
|
233
|
+
* A run-scoped log only, like `heldRecordBodies`. A line still being written is not yet in the index, as it is not
|
|
234
|
+
* yet a whole line. Anything that cannot be read is null, which the caller reports as not fetched yet.
|
|
235
|
+
*/
|
|
236
|
+
export function recordBodyFromLog(dest, uri) {
|
|
237
|
+
if (typeof dest !== "string" || basename(dest) !== RUN_RECORD_LOG_FILE) return null;
|
|
238
|
+
const want = normalizeRecordUri(uri) || targetKey(uri);
|
|
239
|
+
let fd;
|
|
240
|
+
try {
|
|
241
|
+
const at = indexOf(dest).withBody.get(want);
|
|
242
|
+
if (!at || !Number.isInteger(at.start) || !Number.isInteger(at.len)) return null;
|
|
243
|
+
fd = openSync(dest, "r");
|
|
244
|
+
const buf = Buffer.alloc(at.len);
|
|
245
|
+
if (readSync(fd, buf, 0, at.len, at.start) !== at.len) return null;
|
|
246
|
+
return JSON.parse(buf.toString("utf8"))?.body || null;
|
|
247
|
+
} catch { return null; } finally { if (fd !== undefined) try { closeSync(fd); } catch { /* closed */ } }
|
|
248
|
+
}
|
|
249
|
+
|
|
222
250
|
const sleepMs = (ms) => { try { Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms); } catch { /* no sleep available */ } };
|
|
223
251
|
|
|
224
252
|
/** Run `fn` holding the ledger's lock; false (and `fn` not run) when the lock could not be had in time. */
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
3
|
+
//
|
|
4
|
+
// record-uri.mjs — the one key a register record is looked up by, wherever a reader stands. A leaf with no imports, so
|
|
5
|
+
// the run record log's index (`ledger.mjs`) and the driver's record joins (`driver/registry-fidelity.mjs`) key a
|
|
6
|
+
// record the same way: two readers of one log must not disagree about which row is the record's.
|
|
7
|
+
|
|
8
|
+
// WP-receipts W2 (the VENZY join defect): meter sources sometimes arrive as FULL provider URLs
|
|
9
|
+
// (https://tm.corsearch.com/mark/ae/229552) while the record set keys on /mark/ paths — without
|
|
10
|
+
// normalization a genuinely FETCHED record demotes to "assumed" at render, with a false integrity
|
|
11
|
+
// flag on top. Same broad id shape as pipeline.mjs CITED_URI_RE.
|
|
12
|
+
export function normalizeRecordUri(src) {
|
|
13
|
+
const m = String(src ?? "").trim().match(/\/mark\/[a-z]{2,6}\/[a-z0-9][a-z0-9_-]*/i);
|
|
14
|
+
return m ? m[0].toLowerCase() : "";
|
|
15
|
+
}
|
|
@@ -26,6 +26,17 @@ export const adapter = {
|
|
|
26
26
|
return err ? { ok: false, cause: err.slice(0, 140) } : { ok: true };
|
|
27
27
|
} catch (e) { return { ok: false, cause: `fetch threw: ${e.message}` }; }
|
|
28
28
|
},
|
|
29
|
+
// One cited registration's logo, for the report: one image request, ledgered like every other call.
|
|
30
|
+
async markImage(uri, { agentId, sessionKey, recordLog = null }) {
|
|
31
|
+
if (!process.env.CLARIVATE_API_KEY) return { ok: false, cause: "CLARIVATE_API_KEY absent from driver env" };
|
|
32
|
+
let doMarkImage, DEFAULT_BASE;
|
|
33
|
+
try { ({ doMarkImage, DEFAULT_BASE } = await import("./core.js")); }
|
|
34
|
+
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
35
|
+
const base = process.env.CLARIVATE_API_BASE || DEFAULT_BASE;
|
|
36
|
+
try {
|
|
37
|
+
return await doMarkImage(process.env.CLARIVATE_API_KEY, base, uri, { kind: "image", agentId, sessionKey, sessionId: null, recordLog });
|
|
38
|
+
} catch (e) { return { ok: false, cause: `fetch threw: ${e.message}` }; }
|
|
39
|
+
},
|
|
29
40
|
// Depth 2's count, same contract as corsearch's (see above). A TRUE count-only call here: POST
|
|
30
41
|
// /count fetches no records and works at any magnitude. regions[] is mandatory on this provider,
|
|
31
42
|
// so a worldwide count is a disclosed capability gap rather than a number — register-count.mjs
|
|
@@ -1766,7 +1766,23 @@ export async function doImageFetch(apiKey, base, params, tctx) {
|
|
|
1766
1766
|
return { type: "text", text: JSON.stringify({ test_mode: useTest, count: results.length, results }, null, 2) };
|
|
1767
1767
|
}
|
|
1768
1768
|
|
|
1769
|
-
// ──
|
|
1769
|
+
// ── One cited registration's logo, for the report ───────────────────────────────────────────────────────────────
|
|
1770
|
+
// The live image of one record: one image request, on the same `/image` call as the metadata fetch above and through
|
|
1771
|
+
// the same ledger. The answer's `image` field is a string; read here as base64, and the caller keeps the bytes only when
|
|
1772
|
+
// they open as a PNG, JPEG, GIF or WebP file, so a different encoding is reported rather than saved. `{ ok, bytes,
|
|
1773
|
+
// contentType }`, or `{ ok: false, cause }` for a call that did not land or held no image.
|
|
1774
|
+
export async function doMarkImage(apiKey, base, ref, tctx) {
|
|
1775
|
+
const guid = refToGuid(ref);
|
|
1776
|
+
const r = await clarivateFetch(apiKey, base, "/image", { body: { id: guid }, tctx: { ...tctx, target: guid } });
|
|
1777
|
+
if (!r.ok) return { ok: false, cause: `HTTP ${r.status}: ${String(errText(r)).slice(0, 120)}` };
|
|
1778
|
+
if (r.parseError) return { ok: false, cause: `unparseable body (HTTP ${r.status})` };
|
|
1779
|
+
const imgs = Array.isArray(r.body?.images) ? r.body.images : Array.isArray(r.body) ? r.body : null;
|
|
1780
|
+
const img = imgs?.find((i) => typeof i?.image === "string" && i.image.length > 0) ?? null;
|
|
1781
|
+
if (!img) return { ok: false, cause: imgs ? "the answer held no image" : `not an image response (HTTP ${r.status})` };
|
|
1782
|
+
return { ok: true, bytes: Buffer.from(img.image, "base64"), contentType: img.contentType ?? img.mimeType ?? null };
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
// ── Filing date (per-register data freshness)─────────────────────────────────────────────────────
|
|
1770
1786
|
// POST /filingdate — how CURRENT each register's data is (recordLastUpdated yyyyMMdd + the office's own
|
|
1771
1787
|
// currency notes). A coverage claim is only as good as the freshness of the register behind it.
|
|
1772
1788
|
export async function doFilingDate(apiKey, base, params, tctx) {
|
package/providers/jx/src/core.js
CHANGED
|
@@ -22,9 +22,10 @@
|
|
|
22
22
|
// `callMessagesAPI` — with its own MESSAGES_API_URL, x-api-key header and retry ladder — is DELETED
|
|
23
23
|
// rather than left exported. It had no caller after e49868e3, and an exported function that POSTs to
|
|
24
24
|
// a hardcoded vendor endpoint on a hardcoded key is one `import` away from reintroducing the mix.
|
|
25
|
-
//
|
|
25
|
+
// THE BODY NAMES NO MODEL. A turn reads only the body's message and its tool (`promptFromRequest` in
|
|
26
|
+
// turn-envelope.mjs), and runs on the model the run's engine resolves; the receipt records that one. A
|
|
27
|
+
// dated id here read as the model in use, and it was not.
|
|
26
28
|
|
|
27
|
-
export const DEFAULT_MODEL = "claude-haiku-4-5-20251001"; // cheap, structured task; JX_MODEL overrides upstream
|
|
28
29
|
export const MAX_CANDIDATES = 8;
|
|
29
30
|
|
|
30
31
|
import { runJxTurn } from "./turn-envelope.mjs";
|
|
@@ -111,12 +112,11 @@ const LANE_PROMPTS = {
|
|
|
111
112
|
};
|
|
112
113
|
|
|
113
114
|
/** Assemble the Messages API body (pure). Throws on an unknown lane — callers route lanes, not this. */
|
|
114
|
-
export function buildCandidateRequest({ mark, productContext = "", lane = "zh"
|
|
115
|
+
export function buildCandidateRequest({ mark, productContext = "", lane = "zh" }) {
|
|
115
116
|
const promptFor = LANE_PROMPTS[lane];
|
|
116
117
|
if (!promptFor) throw new Error(`jx-completions: no prompt for lane "${lane}"`);
|
|
117
118
|
if (!String(mark ?? "").trim()) throw new Error("jx-completions: mark is required");
|
|
118
119
|
return {
|
|
119
|
-
model,
|
|
120
120
|
max_tokens: 2048, // 8 Han candidates + rationales need headroom; truncation is checked either way
|
|
121
121
|
tools: [CANDIDATE_TOOL],
|
|
122
122
|
messages: [{ role: "user", content: promptFor({ mark: String(mark).trim(), productContext: String(productContext ?? "").trim() }) }],
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
// guarantee that "a register record page never classifies as use" is enforced by exclusion, not by
|
|
13
13
|
// trusting a model to follow an instruction.
|
|
14
14
|
|
|
15
|
-
import { DEFAULT_MODEL } from "./core.js";
|
|
16
15
|
import { runJxTurn } from "./turn-envelope.mjs";
|
|
17
16
|
|
|
18
17
|
export const JUDGE_BATCH = 40; // hits per call — bounded input, bounded output
|
|
@@ -46,7 +45,7 @@ export const JUDGE_TOOL = {
|
|
|
46
45
|
|
|
47
46
|
/** Assemble the Messages API body (pure). `hits` = [{id, term, platform, title, url, snippet}] —
|
|
48
47
|
* already mirror-filtered by the caller; ids are the caller's, echoed back for the merge. */
|
|
49
|
-
export function buildJudgeRequest({ mark, hits
|
|
48
|
+
export function buildJudgeRequest({ mark, hits }) {
|
|
50
49
|
if (!String(mark ?? "").trim()) throw new Error("jx-judge: mark is required");
|
|
51
50
|
const rows = Array.isArray(hits) ? hits.slice(0, JUDGE_BATCH) : [];
|
|
52
51
|
if (!rows.length) throw new Error("jx-judge: hits are required — an empty batch has nothing to judge");
|
|
@@ -76,7 +75,6 @@ export function buildJudgeRequest({ mark, hits, model = DEFAULT_MODEL }) {
|
|
|
76
75
|
].join("\n")),
|
|
77
76
|
].join("\n");
|
|
78
77
|
return {
|
|
79
|
-
model,
|
|
80
78
|
max_tokens: 4096, // 40 one-clause judgments fit well inside; truncation checked either way
|
|
81
79
|
tools: [JUDGE_TOOL],
|
|
82
80
|
messages: [{ role: "user", content: prompt }],
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
// enforces record_uri ∈ the fetched set upstream (an ungrounded flag downgrades to a lead) — this
|
|
12
12
|
// module only shapes and clamps; it grounds nothing itself.
|
|
13
13
|
|
|
14
|
-
import { DEFAULT_MODEL } from "./core.js";
|
|
15
14
|
import { runJxTurn } from "./turn-envelope.mjs";
|
|
16
15
|
|
|
17
16
|
export const MAX_ITEMS = 12;
|
|
@@ -52,7 +51,7 @@ export const NATIVEREAD_TOOL = {
|
|
|
52
51
|
/** Assemble the Messages API body (pure). `payload` is the code-inlined evidence slice the DRIVER
|
|
53
52
|
* assembled (register rows, candidates, sub-class notes, grid findings) — this module never decides
|
|
54
53
|
* what the model may see. */
|
|
55
|
-
export function buildNativereadRequest({ mark, lane = "zh", payload
|
|
54
|
+
export function buildNativereadRequest({ mark, lane = "zh", payload }) {
|
|
56
55
|
if (lane !== "zh") throw new Error(`jx-nativeread: no prompt for lane "${lane}"`);
|
|
57
56
|
if (!String(mark ?? "").trim()) throw new Error("jx-nativeread: mark is required");
|
|
58
57
|
if (!String(payload ?? "").trim()) throw new Error("jx-nativeread: payload (the evidence slice) is required");
|
|
@@ -77,7 +76,6 @@ export function buildNativereadRequest({ mark, lane = "zh", payload, model = DEF
|
|
|
77
76
|
String(payload),
|
|
78
77
|
].join("\n");
|
|
79
78
|
return {
|
|
80
|
-
model,
|
|
81
79
|
max_tokens: 4096, // 12 grounded items with grounds quotes need headroom; truncation checked either way
|
|
82
80
|
tools: [NATIVEREAD_TOOL],
|
|
83
81
|
messages: [{ role: "user", content: prompt }],
|
package/scripts/README.md
CHANGED
|
@@ -19,7 +19,7 @@ The axis is *what the script assumes exists*, not where it happens to be run.
|
|
|
19
19
|
| `clearances-render-check.mjs` | Checks the `/portal/clearances` columns hold together. Run by CI. |
|
|
20
20
|
| `report-print-check.mjs` | Shows what the exported PDF actually renders under print media. Run by CI. |
|
|
21
21
|
| `report-offline-render-check.mjs` | Opens every demo report, from disk and served under the portal's report policy, and every pool index, and fails on any request to another machine or an embedded font that did not load. Run by CI. |
|
|
22
|
-
| `report-overflow-check.mjs` | Checks the same two kinds of report for sideways overflow on screen — the print check cannot see a width, because print sets the watermark to `display:none` and the watermark was the overflow.
|
|
22
|
+
| `report-overflow-check.mjs` | Checks the same two kinds of report for sideways overflow on screen — the print check cannot see a width, because print sets the watermark to `display:none` and the watermark was the overflow. Kept outside this repository. |
|
|
23
23
|
| `portal-lifecycle-check.mjs` | Asks whether the portal names a brand owner and whether a person can manage their searches. Run by CI. |
|
|
24
24
|
| `portal-strings.mjs` | Reads every string the portal can show out of its source, as a reader meets it. `--check <approved list>` refuses a string on a screen that is neither approved nor in `portal-ui/strings-backlog.json`; `--backlog-shrinks --base <ref>` refuses a backlog line the base did not have. The approved list is kept with the designs, outside this repository. CI runs the backlog half. |
|
|
25
25
|
| `validate-profiles.mjs` | Validates a customer-config store's profile bundles. Read-only. |
|
|
@@ -30,7 +30,7 @@ The axis is *what the script assumes exists*, not where it happens to be run.
|
|
|
30
30
|
| `score.mjs` | Scores a completed run against a reference answer. |
|
|
31
31
|
| `compare.mjs` | Lays the E2E product-comparison scenarios side by side — the depth dial, the config layers, fan-out, native language, the deep end. Reads files only, prints no verdict, always exits 0. |
|
|
32
32
|
| `feedback-mint.mjs` | The one file in the feedback feature that touches the network. |
|
|
33
|
-
| `publication-scan.mjs` | Reads every blob in a repository's history and asks whether all of it can be public: retired identities, operator identity, secrets, withheld paths, the licence. Portable, but it needs the private roster to say anything real — a check it could not run fails the scan rather than passing. |
|
|
33
|
+
| `publication-scan.mjs` | Reads every blob in a repository's history and asks whether all of it can be public: retired identities, operator identity, secrets, withheld paths, the licence. Portable, but it needs the private roster to say anything real — a check it could not run fails the scan rather than passing. Kept outside this repository. |
|
|
34
34
|
| `mint-suite-census.mjs` | Re-stamps `driver/suite-census.json` — the persisted expectation that makes a DELETED, RENAMED or GUTTED test file visible. Dry-run by default;`--apply` writes it, and it prints removals and shrinkage first because a silently lowered ceiling is how a gutting gets laundered into a green suite. |
|
|
35
35
|
| `merge-presence-check.mjs` | Re-states every merge in a window against the tree: did the merged content reach `main` and is it STILL there (proved by content, never by ancestry), and did the branch carry work the merge never took. Deliberately not a CI gate — it reads the forge. A branch that is simply gone makes the second question unanswerable, which is a non-zero exit, waived only by an explicit dated flag that is itself invalid once it covers nothing. |
|
|
36
36
|
|
|
@@ -88,7 +88,8 @@ or declared, with a reason, as one that cannot run in CI.
|
|
|
88
88
|
|
|
89
89
|
**Three are declared**, and all three need something CI does not have: `live-surface-check.mjs` (a
|
|
90
90
|
running deployment), `merge-presence-check.mjs` (a range that does not exist before the merge) and
|
|
91
|
-
`deploy-drift-check.mjs` (a deployed host to compare against). Everything
|
|
91
|
+
`deploy-drift-check.mjs` (a deployed host to compare against; kept outside this repository). Everything
|
|
92
|
+
else runs.
|
|
92
93
|
|
|
93
94
|
That includes `render-check.mjs`, which joined the blocking browser step, and `report-frame-check.mjs`.
|
|
94
95
|
**This paragraph said the opposite until 2026-08-27** — it had them both on the declared list, left over
|
|
@@ -120,3 +121,146 @@ contributor tier, on machines where a `ulimit -v` makes Chrome dump core.
|
|
|
120
121
|
these needs a path, it takes it as an argument or an environment variable and **refuses when it is
|
|
121
122
|
absent**. Falling back to the production value means an unset variable — a fresh shell, a clone, a
|
|
122
123
|
CI job — silently aims a real operation at live client matter.
|
|
124
|
+
|
|
125
|
+
## Every script, by how it runs
|
|
126
|
+
|
|
127
|
+
One row for every file in this folder, so a CI guard can be told from a tool somebody runs and from a
|
|
128
|
+
one-off. What each does is in its own header. A test fails on a file this table does not list, and on a
|
|
129
|
+
row that names a file this folder does not hold.
|
|
130
|
+
|
|
131
|
+
- **CI**: a workflow runs it, directly or through an npm script.
|
|
132
|
+
- **by hand**: something in the repository names it, a document, a test or another script, and a person runs it.
|
|
133
|
+
- **one-off, named nowhere**: nothing in the repository refers to it. Ask whoever wrote it before retiring it.
|
|
134
|
+
|
|
135
|
+
| Script | Runs |
|
|
136
|
+
|---|---|
|
|
137
|
+
| `added-reference-check.mjs` | CI |
|
|
138
|
+
| `ai-page-render-check.mjs` | CI |
|
|
139
|
+
| `ask-ai-render-check.mjs` | CI |
|
|
140
|
+
| `authority-boundary-probe.mjs` | by hand, `npm run authority-probe` |
|
|
141
|
+
| `backfill-started-at.mjs` | by hand |
|
|
142
|
+
| `backup-recall-stores.mjs` | by hand |
|
|
143
|
+
| `band-shape-probe.mjs` | by hand |
|
|
144
|
+
| `bench-replay-request.mjs` | CI |
|
|
145
|
+
| `carry-through.mjs` | by hand |
|
|
146
|
+
| `census-merge-driver.mjs` | by hand |
|
|
147
|
+
| `changelog-plain-language.mjs` | by hand |
|
|
148
|
+
| `citation-anchor-report.mjs` | one-off, named nowhere |
|
|
149
|
+
| `citation-drift-report.mjs` | by hand |
|
|
150
|
+
| `citation-line-check.mjs` | CI |
|
|
151
|
+
| `clearances-render-check.mjs` | CI |
|
|
152
|
+
| `clone-recipe-check.mjs` | CI |
|
|
153
|
+
| `compare.mjs` | by hand |
|
|
154
|
+
| `composer-render-check.mjs` | CI |
|
|
155
|
+
| `contract-dictation-scan.mjs` | by hand, `npm run contract-dictation` |
|
|
156
|
+
| `count-manual-pins.mjs` | by hand |
|
|
157
|
+
| `dead-names.mjs` | by hand, `npm run retired-settings` |
|
|
158
|
+
| `demo-evidence.mjs` | CI |
|
|
159
|
+
| `deprecate-below.mjs` | CI |
|
|
160
|
+
| `doctrine-report.mjs` | by hand, `npm run doctrine-report` |
|
|
161
|
+
| `drain-preflight.mjs` | by hand, `npm run drain-preflight` |
|
|
162
|
+
| `drive-env-check.mjs` | CI |
|
|
163
|
+
| `e2e-first-time.mjs` | by hand |
|
|
164
|
+
| `e2e-scenario-ops.mjs` | by hand |
|
|
165
|
+
| `e2e-unread-terminals.mjs` | by hand |
|
|
166
|
+
| `e2e.mjs` | by hand |
|
|
167
|
+
| `engine-pins.mjs` | CI |
|
|
168
|
+
| `engine-probe.mjs` | by hand, `npm run engine-probe` |
|
|
169
|
+
| `env-audit.mjs` | by hand |
|
|
170
|
+
| `env-classify.mjs` | by hand |
|
|
171
|
+
| `feedback-mint.mjs` | by hand |
|
|
172
|
+
| `freeze-example-run.mjs` | by hand |
|
|
173
|
+
| `generated-files-are-current.mjs` | CI |
|
|
174
|
+
| `hand-off-exits-probe.mjs` | one-off, named nowhere |
|
|
175
|
+
| `head-arrived-gated.mjs` | one-off, named nowhere |
|
|
176
|
+
| `headless-page.mjs` | by hand |
|
|
177
|
+
| `home-render-check.mjs` | CI |
|
|
178
|
+
| `import-cycle-check.mjs` | CI |
|
|
179
|
+
| `live-surface-check.mjs` | by hand |
|
|
180
|
+
| `main-health.mjs` | by hand |
|
|
181
|
+
| `markdown-link-check.mjs` | CI |
|
|
182
|
+
| `mcp-registry-listing.mjs` | CI |
|
|
183
|
+
| `measure-test-durations.mjs` | by hand |
|
|
184
|
+
| `merge-presence-check.mjs` | by hand |
|
|
185
|
+
| `merge-shape-check.mjs` | by hand |
|
|
186
|
+
| `mint-names-in-force.mjs` | by hand |
|
|
187
|
+
| `mint-offered-territories.mjs` | by hand |
|
|
188
|
+
| `mint-plugin-folder.mjs` | by hand |
|
|
189
|
+
| `mint-public-residue.mjs` | by hand |
|
|
190
|
+
| `mint-reference-strip-backlog.mjs` | by hand |
|
|
191
|
+
| `mint-search-level-tags.mjs` | by hand |
|
|
192
|
+
| `mint-source-pin-census.mjs` | by hand |
|
|
193
|
+
| `mint-suite-census.mjs` | CI |
|
|
194
|
+
| `mint-writing-standard-backlog.mjs` | by hand |
|
|
195
|
+
| `nightly-notice.mjs` | by hand |
|
|
196
|
+
| `no-test-account-reaches-the-package.mjs` | CI |
|
|
197
|
+
| `pack-publishable.mjs` | by hand |
|
|
198
|
+
| `package-size-budget.mjs` | CI |
|
|
199
|
+
| `placement-diff.mjs` | by hand |
|
|
200
|
+
| `plain-language-rules.mjs` | by hand |
|
|
201
|
+
| `portal-lifecycle-check.mjs` | CI |
|
|
202
|
+
| `portal-strings.mjs` | CI |
|
|
203
|
+
| `preinstall-node-check.mjs` | CI |
|
|
204
|
+
| `purge-runs.mjs` | by hand |
|
|
205
|
+
| `queue-inflight.mjs` | by hand |
|
|
206
|
+
| `reconcile-runs.mjs` | by hand |
|
|
207
|
+
| `record-carry-probe.mjs` | by hand |
|
|
208
|
+
| `register-plan-shape.mjs` | by hand |
|
|
209
|
+
| `release-approve-parked.mjs` | CI |
|
|
210
|
+
| `release-artifact-seal.mjs` | CI |
|
|
211
|
+
| `release-await-cut.mjs` | CI |
|
|
212
|
+
| `release-bench-replay-check.mjs` | CI |
|
|
213
|
+
| `release-code-scanning-check.mjs` | CI |
|
|
214
|
+
| `release-completeness-check.mjs` | CI |
|
|
215
|
+
| `release-cut-decision.mjs` | CI |
|
|
216
|
+
| `release-dist-tag.mjs` | CI |
|
|
217
|
+
| `release-duplicate-notes.mjs` | CI |
|
|
218
|
+
| `release-entry-catch-up.mjs` | CI |
|
|
219
|
+
| `release-install-check.mjs` | CI |
|
|
220
|
+
| `release-note-required.mjs` | CI |
|
|
221
|
+
| `release-notes-for.mjs` | CI |
|
|
222
|
+
| `release-notes-lint.mjs` | CI |
|
|
223
|
+
| `release-pre-gate.mjs` | CI |
|
|
224
|
+
| `release-publish-guard.mjs` | CI |
|
|
225
|
+
| `release-rehearsal-version.mjs` | CI |
|
|
226
|
+
| `release-sbom.mjs` | CI |
|
|
227
|
+
| `release-version-pr-checks.mjs` | CI |
|
|
228
|
+
| `release-version.mjs` | CI |
|
|
229
|
+
| `release-visible-check.mjs` | CI |
|
|
230
|
+
| `render-brand-banner.mjs` | one-off, named nowhere |
|
|
231
|
+
| `render-check.mjs` | CI |
|
|
232
|
+
| `repo-writes.mjs` | by hand |
|
|
233
|
+
| `report-frame-check.mjs` | CI |
|
|
234
|
+
| `report-header-render-check.mjs` | CI |
|
|
235
|
+
| `report-offline-render-check.mjs` | CI |
|
|
236
|
+
| `report-print-check.mjs` | CI |
|
|
237
|
+
| `report-screenshot.mjs` | by hand |
|
|
238
|
+
| `report-sections-render-check.mjs` | CI |
|
|
239
|
+
| `report-theme-render-check.mjs` | CI |
|
|
240
|
+
| `retire-bare-refs.mjs` | by hand |
|
|
241
|
+
| `revisit-render-check.mjs` | CI |
|
|
242
|
+
| `score.mjs` | by hand |
|
|
243
|
+
| `seat-retry-report.mjs` | by hand, `npm run retry-report` |
|
|
244
|
+
| `secret-scanner-fetch.mjs` | CI |
|
|
245
|
+
| `settings-render-check.mjs` | CI |
|
|
246
|
+
| `spdx-headers.mjs` | CI |
|
|
247
|
+
| `strip-titles-and-attributions.mjs` | by hand |
|
|
248
|
+
| `strip-tracker-citations.mjs` | by hand |
|
|
249
|
+
| `sync-e2e-store.mjs` | by hand |
|
|
250
|
+
| `test-account-names.mjs` | by hand |
|
|
251
|
+
| `test-durations-reporter.mjs` | by hand |
|
|
252
|
+
| `test-durations.json` | by hand |
|
|
253
|
+
| `test-fast.mjs` | by hand, `npm run test` |
|
|
254
|
+
| `test-full.mjs` | CI |
|
|
255
|
+
| `test-run.mjs` | CI |
|
|
256
|
+
| `text-difference.mjs` | by hand |
|
|
257
|
+
| `third-party-notices.mjs` | CI |
|
|
258
|
+
| `travelling-predicates.mjs` | by hand |
|
|
259
|
+
| `undeclared-field-census.mjs` | by hand |
|
|
260
|
+
| `undeclared-key-census.mjs` | by hand |
|
|
261
|
+
| `unexecuted-asserts.mjs` | by hand, `npm run assert-census` |
|
|
262
|
+
| `validate-profiles.mjs` | by hand |
|
|
263
|
+
| `verify-publishable.mjs` | by hand |
|
|
264
|
+
| `write-build-info.mjs` | npm, before every pack |
|
|
265
|
+
| `write-up-form-census.mjs` | by hand |
|
|
266
|
+
| `writing-standard-check.mjs` | CI |
|
|
@@ -46,9 +46,10 @@
|
|
|
46
46
|
import { execFileSync } from "node:child_process";
|
|
47
47
|
import { isEntrypoint } from "../shared/is-entrypoint.mjs";
|
|
48
48
|
import {
|
|
49
|
-
CLASSES, offendingClasses, isProse, isScannable,
|
|
49
|
+
CLASSES, offendingClasses, classesIn, isProse, isScannable,
|
|
50
50
|
withoutColourValues, withoutLinkTargets,
|
|
51
51
|
} from "../shared/reference-guard-classes.mjs";
|
|
52
|
+
import { sourceSpans, isScript } from "../shared/source-spans.mjs";
|
|
52
53
|
|
|
53
54
|
// Re-exported because scripts/retire-bare-refs.mjs and the arms beside this file import them from
|
|
54
55
|
// here, and moving the table should not move every caller in the same commit.
|
|
@@ -69,15 +70,45 @@ const baseArg = () => {
|
|
|
69
70
|
*/
|
|
70
71
|
export function addedLines(diffText) {
|
|
71
72
|
const out = [];
|
|
72
|
-
let path = null;
|
|
73
|
+
let path = null, n = 0;
|
|
73
74
|
for (const line of diffText.split("\n")) {
|
|
74
75
|
if (line.startsWith("+++ b/")) { path = line.slice(6); continue; }
|
|
75
76
|
if (line.startsWith("+++ ") || line.startsWith("--- ")) continue;
|
|
76
|
-
|
|
77
|
+
// Each hunk says where its added lines start in the new file, so a line can be found in the file it was added to.
|
|
78
|
+
const hunk = /^@@ -\S+ \+(\d+)(?:,\d+)? @@/.exec(line);
|
|
79
|
+
if (hunk) { n = Number(hunk[1]); continue; }
|
|
80
|
+
if (line.startsWith("+") && path) out.push({ path, line: line.slice(1), n: n++ });
|
|
77
81
|
}
|
|
78
82
|
return out;
|
|
79
83
|
}
|
|
80
84
|
|
|
85
|
+
/**
|
|
86
|
+
* The classes each added line carries, as `{ path, id, token, why, line }`. A line that starts as a comment is read whole,
|
|
87
|
+
* as before. In a script, a comment after code on an added line is read too: it is prose, and the file is read as a whole
|
|
88
|
+
* to find it, because a `//` inside a string or a regular expression is not one. A string is not read here; the census
|
|
89
|
+
* counts strings in a column of their own.
|
|
90
|
+
*
|
|
91
|
+
* @param {{path: string, line: string, n?: number}[]} added
|
|
92
|
+
* @param {(path: string) => string | null} readFile the file as the change leaves it
|
|
93
|
+
*/
|
|
94
|
+
export function addedHits(added, readFile) {
|
|
95
|
+
const spans = new Map();
|
|
96
|
+
const spansOf = (path) => {
|
|
97
|
+
if (!spans.has(path)) { let t = null; try { t = readFile(path); } catch { t = null; } spans.set(path, t == null ? null : sourceSpans(t)); }
|
|
98
|
+
return spans.get(path);
|
|
99
|
+
};
|
|
100
|
+
const hits = [];
|
|
101
|
+
for (const { path, line, n } of added) {
|
|
102
|
+
let found = offendingClasses(path, line);
|
|
103
|
+
if (!found.length && isScannable(path) && isScript(path) && !isProse(path, line) && Number.isInteger(n)) {
|
|
104
|
+
const trailing = spansOf(path)?.[n - 1]?.comment;
|
|
105
|
+
if (trailing) found = classesIn(trailing);
|
|
106
|
+
}
|
|
107
|
+
for (const c of found) hits.push({ path, ...c, line: line.trim().slice(0, 100) });
|
|
108
|
+
}
|
|
109
|
+
return hits;
|
|
110
|
+
}
|
|
111
|
+
|
|
81
112
|
function main() {
|
|
82
113
|
const base = baseArg() || "origin/main";
|
|
83
114
|
let diff;
|
|
@@ -91,10 +122,7 @@ function main() {
|
|
|
91
122
|
// AN EMPTY DIFF IS NOT A PASS TO CELEBRATE, but it is a legitimate one — a pull request can touch
|
|
92
123
|
// only files this check does not read. The count is printed either way so a reader can tell the
|
|
93
124
|
// difference between "looked and found nothing" and "had nothing to look at".
|
|
94
|
-
const hits = [];
|
|
95
|
-
for (const { path, line } of added) {
|
|
96
|
-
for (const c of offendingClasses(path, line)) hits.push({ path, ...c, line: line.trim().slice(0, 100) });
|
|
97
|
-
}
|
|
125
|
+
const hits = addedHits(added, (path) => execFileSync("git", ["show", `HEAD:${path}`], { encoding: "utf8", maxBuffer: 1 << 28, stdio: ["ignore", "pipe", "ignore"] }));
|
|
98
126
|
console.log(`added-reference-check: read ${added.length} added line(s) against ${base}`);
|
|
99
127
|
if (!hits.length) return;
|
|
100
128
|
|
|
@@ -76,7 +76,7 @@ export const COUNTED_EVENTS = {
|
|
|
76
76
|
"post-repair-correction-unrecoverable": FAILED, "post-repair-state-not-kept": FAILED,
|
|
77
77
|
"digest-flush-timeout": FAILED, "document-coverage-render-failed": FAILED, "doubts-failed": FAILED,
|
|
78
78
|
"evidence-claim-invariant": { kind: FAILED, when: (e) => e.ok === false || Number(e.violations) > 0 },
|
|
79
|
-
"coverage-row-not-added": FAILED, "verdict-floor-failed": FAILED,
|
|
79
|
+
"coverage-row-not-added": FAILED, "verdict-floor-failed": FAILED, "case-law-join-failed": FAILED,
|
|
80
80
|
"floor-duty-failed": FAILED, "frame-reopen-redigest-failed": FAILED, "goods-evidence-failed": FAILED, "placement-decisions-failed": FAILED, "placement-band-ids-failed": FAILED, "late-evidence-failed": FAILED, "band-refused-records-failed": FAILED, "verdict-write-deferred": FAILED, "ranking-read-by-writer-failed": FAILED, "audit-rebuild-failed": FAILED, "audit-build-failed": FAILED, "write-up-goods-from-failed": FAILED, "declination-goods-states-failed": FAILED, "review-exclusions-write-failed": FAILED, "house-element-ownership-failed": FAILED,
|
|
81
81
|
"intake-asks-missing": FAILED, "invalid-artifact-strikes": FAILED, "knockout-band-checks-inert": FAILED,
|
|
82
82
|
"knockout-in-use-as-unanswered": FAILED, "knockout-method-checks-inert": FAILED,
|
|
@@ -104,7 +104,7 @@ export const COUNTED_EVENTS = {
|
|
|
104
104
|
// court-decisions file that arrived absent or empty from a stage that ended ok: this record is its only one.
|
|
105
105
|
"degraded-parts": { kind: FAILED, when: (e) => (Array.isArray(e.parts) ? e.parts : [])
|
|
106
106
|
.some((p) => p?.part === "court-decisions" && /is (absent|empty)$/.test(String(p?.cause ?? ""))) },
|
|
107
|
-
"degraded-parts-failed": FAILED,
|
|
107
|
+
"degraded-parts-failed": FAILED, "logos-not-written": FAILED,
|
|
108
108
|
// A store publishing found unreadable, or one delivery read and a republish found missing: its only record.
|
|
109
109
|
"degraded-parts-at-publish": FAILED,
|
|
110
110
|
// A part publishing could not write, and the report shipped without it. A clearance's workbook is counted by its
|
|
@@ -197,7 +197,7 @@ export const NOT_COUNTED_EVENTS = {
|
|
|
197
197
|
"digest-coverage-form-brief", "digest-flush", "digest-queue-noop", "digest-queued", "digest-rulings-tail",
|
|
198
198
|
"doctrine-write", "document-coverage-rendered", "document-growth-trip", "doubt-selection", "doubts", "draft-carry",
|
|
199
199
|
"economics", "engine-build", "envelope-closed", "envelope-decision", "envelope-decision-early",
|
|
200
|
-
"escalation-skipped", "experiment", "experiment-refused", "goods-held-whole-handed",
|
|
200
|
+
"escalation-skipped", "experiment", "experiment-refused", "goods-held-whole-handed", "logos",
|
|
201
201
|
"form-neighbourhood-derived", "frame-diff",
|
|
202
202
|
"frame-diff-source-directives-dropped", "frame-reopen-reconcile-not-needed", "frame-reopen-skipped", "frame-web-grid",
|
|
203
203
|
"framework", "goods-evidence", "grid-ledger-saved", "grid-spec", "grid-split", "hit-list-minted",
|
|
@@ -233,7 +233,7 @@ export const NOT_COUNTED_EVENTS = {
|
|
|
233
233
|
"scope-facts", "scope-frontmatter", "scope-ledger-derived", "scope-ledger-skipped", "screen-gate-clean", "screen-gate-evidence",
|
|
234
234
|
"seam-reapplied", "search-policy", "searched-jurisdictions", "senior-rights", "skip",
|
|
235
235
|
"stage-contract", "stage-limit-derived", "stage-stamps-reconciled", "start", "supplemental-fold", "token-rollup",
|
|
236
|
-
"turnaround-reconciliation", "unit-band-seeded-empty", "verdict", "verdict-conditions-followed", "verdict-conditions-recorded", "verdict-floors-pass", "verdict-frontmatter",
|
|
236
|
+
"turnaround-reconciliation", "uncovered-market-rows", "unit-band-seeded-empty", "verdict", "verdict-conditions-followed", "verdict-conditions-recorded", "verdict-floors-pass", "verdict-frontmatter",
|
|
237
237
|
"verdict-recomputed-steps-withdrawn", "whatif-settled-on-archive", "write-up-forms",
|
|
238
238
|
],
|
|
239
239
|
"a note about the answer's content that changes nothing in the run; the quality read judges it": [
|