clearotron 0.5.0-beta.8 → 0.5.0-beta.9

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.
@@ -47,7 +47,7 @@ import { derivedStateOf, recordedDerivedState, replayOfDerivation } from "./deri
47
47
  import { parseVerdict, countCitedDefects, parseCorrectionKinds, parseCorrections, validators, findReviewerCoherenceFlags, lateReviewAgainst, VERDICT_RANK } from "./verify.mjs";
48
48
  import { readAcceptedFlags, nextRefutationSeq, readAcceptedReviewSince, REVIEW_EXCLUSIONS_FILE, listedExclusionPositions } from "./narrative-refutation-record.mjs"; // T3b — the typed flags, not the re-parse
49
49
  import { evidenceClaimViolations, evidenceClaimTable } from "./evidence-claim-invariant.mjs"; //
50
- import { buildCorrectionsApplied, correctionsWorklist, correctionsAppliedTable, correctionScope, flaggedPositions, scopeDrift, unresolvedFlags, reportLines, linesOf, REPORT_LINE_KEY, REPORT_LINE_LABEL } from "./corrections-feedforward.mjs";
50
+ import { buildCorrectionsApplied, correctionsWorklist, correctionsAppliedTable, correctionScope, flaggedPositions, scopeDrift, unresolvedFlags, reportLines, linesOf, REPORT_LINE_KEY, REPORT_LINE_LABEL, answersLeftBehind } from "./corrections-feedforward.mjs";
51
51
  import { correctionTargets, deliveredOutcomes } from "./corrections-delivered.mjs"; // whether each correction reached the record the report was built from
52
52
  import { parseCoverageLedgerJson, parseCoverageLedgerFull, deriveCoverageStatus, classTokensFromScopeText, coerceToolAbsenceDeferred, applyTaintDeferred, decideRegisterGap, splitDeferredByCloseability, heldForNothingToSend, formRowUnitKey, coverageLedgerTableRows, coverageUnitLabel, NON_MATERIAL_AXES, COVERAGE_STATUSES } from "./coverage-ledger.mjs";
53
53
  import { receiptSettled, readEnvelopeDecision, settleReceipt, settledDeferralsSection, readStickyGaps } from "./envelope-settle.mjs";
@@ -80,7 +80,7 @@ import { classifyGroundsNote } from "./grounds-grammar.mjs"; // — a charged
80
80
  // — the register coverage form: the driver writes it before the digest dispatches, renders the
81
81
  // `## Coverage ledger` table and the machine ledger FROM it after the pass, and unions it across passes.
82
82
  import { documentCoverage, renderDocumentCoverageSection, spliceDocumentCoverage } from "./document-coverage.mjs"; //
83
- import { buildCoverageAbsenceForm, coverageAbsenceGaps, coverageFormAbsence, coverageFormBrief, renderCoverageAbsenceSection, renderCoverageLedgerSection, spliceCoverageLedger, renderCoverageLedgerJsonFromForm, unitLabel, buildCoverageForm, formLedgerRows } from "./coverage-form.mjs";
83
+ import { buildCoverageAbsenceForm, coverageAbsenceGaps, coverageFormAbsence, coverageFormBrief, renderCoverageAbsenceSection, renderCoverageLedgerSection, spliceCoverageLedger, renderCoverageLedgerJsonFromForm, unitLabel, buildCoverageForm, formLedgerRows, isLayerRow, nationalRegistersNotSearched, nationalRegistersNote, orderFormName } from "./coverage-form.mjs";
84
84
  import { unionCoverageForm } from "./coverage-union.mjs";
85
85
  import { armCoverageForm, coverageFormInput, coverageFormPaths, coverageFormStamp, readCoverageForm, readCoverageFormInput, waitingFamilyStates, writeCoverageForm } from "./coverage-form-io.mjs";
86
86
  import { releasedFamilyQids, readWithheldFamilies } from "./withheld-families.mjs"; // the waiting families the reading turn released join as dictated entries
@@ -183,7 +183,7 @@ import { beginAnswerMemory, endAnswerMemory } from "../providers/_shared/answer-
183
183
  import { findScreenGateViolations, findScreenGateParseGaps, screenGateZeroCause, screenGateEvidence, policedDropUris } from "./screen-gate.mjs";
184
184
  import { emptyQueue, coerceQueue, mintItem, pendingItems, markFlushed, receiptKeyFor,
185
185
  buildFlushFollowup, runPostFlushGateRepair } from "./digest-queue.mjs"; // (t1cd) — the digest-trigger funnel
186
- import { foldFindingsFile, foldAfterSave, openPass, modelRecordPath, snapshotFold, restoreFold, readFold, keptModelOrdinal } from "./record-fold.mjs"; // the folded record from the delivery seam on
186
+ import { foldFindingsFile, foldAfterSave, openPass, modelRecordPath, snapshotFold, restoreFold, readFold, keptModelOrdinal, citingModelOrdinal } from "./record-fold.mjs"; // the folded record from the delivery seam on
187
187
  import { writeStamp, stageStaleness, restamp, restampStage, staleOnPath, reconcileStamps, shaOf, readStamp } from "./stage-freshness.mjs";
188
188
  import { locateReportFaults, reportPartsOf, overviewCitationFault, writersCitationFaults } from "./repair-targets.mjs"; // a delivery-check fault reaches the part of the report that holds it
189
189
  import { parseManifestVariants, variantsParseFailure, findCoverageLimitedCells, partitionClosableCells, findSimilarListingSignals,
@@ -194,7 +194,7 @@ import { recordRunConsumption } from "./consumption-ledger.mjs";
194
194
  import { quoteForJob, reconcileTurnaround } from "./run-quote.mjs";
195
195
  import { assembleRunRecords, recordBodyHasContent, readRecordArtifacts, findRegistryArithmeticIssues, findRegistryViolations, applyRegistryCorrections, extractEnforcerSignals, collectOppositionDeadlines, normalizeRecordUri } from "./registry-fidelity.mjs";
196
196
  import { recallReceiptForOwnCompany } from "./recall-receipt.mjs"; // a past run's recall receipt, as one company's audit may list it
197
- import { runLint, flagLines, properNameCandidates, OVERVIEW_CITATION_ID } from "./predelivery-lint.mjs";
197
+ import { runLint, flagLines, properNameCandidates, OVERVIEW_CITATION_ID, goodsHeldWholeDetail } from "./predelivery-lint.mjs";
198
198
  import { parsePlacementsJson } from "./placement-model.mjs"; // B2 — the structured tier mirror; the lint reads it only to flag an EMPTY one
199
199
  import { readAnchors } from "./anchor-reader.mjs";
200
200
  import { findEngagementReceipts } from "./engagement-receipt.mjs";
@@ -1259,6 +1259,19 @@ function goodsEvidenceDocFor(ctx, band, goods = null) {
1259
1259
  return doc;
1260
1260
  }
1261
1261
 
1262
+ // THE RECORDS A DELIVERY REPAIR WAS HANDED THE WHOLE GOODS TEXT FOR (predelivery-lint.mjs, goodsHeldWholeChecks), kept
1263
+ // beside the run so the check after that repair, and a resume, do not name them again. A missing or unreadable file is
1264
+ // an empty set: the check then names them, which costs a repair and never hides a finding.
1265
+ const GOODS_HANDED_FILE = "goods-held-whole-handed.json";
1266
+ function readGoodsHanded(runDir) {
1267
+ try { return new Set(JSON.parse(readFileSync(driverDir(runDir, GOODS_HANDED_FILE), "utf8"))?.records ?? []); } catch { return new Set(); }
1268
+ }
1269
+ function recordGoodsHanded(runDir, uris) {
1270
+ const all = new Set([...readGoodsHanded(runDir), ...uris]);
1271
+ ensureDriverDir(runDir);
1272
+ atomicWrite(driverDir(runDir, GOODS_HANDED_FILE), JSON.stringify({ records: [...all].sort() }, null, 2) + "\n");
1273
+ }
1274
+
1262
1275
  function recordGoodsEvidenceFor(ctx, band, derived = null) {
1263
1276
  const P = ctx.paths;
1264
1277
  try {
@@ -3563,7 +3576,7 @@ export function withGoodsFrom(ctx, P, rows, read = null) { // @internal — dr
3563
3576
  const evidence = read ?? goodsEvidenceOfDrops(P, runPrefix, uris);
3564
3577
  return rows.map((r) => {
3565
3578
  const e = r?.kind !== "page" && r?.uri ? evidence.get(r.uri) : null;
3566
- return e ? { ...r, goods_from: goodsFromLabel({ state: e.goods, source: e.source }) } : r;
3579
+ return e ? { ...r, goods_from: goodsFromLabel({ state: e.goods, source: e.source, question: e.question }) } : r;
3567
3580
  });
3568
3581
  } catch (e) { return unlabelled(e?.message ?? e); }
3569
3582
  }
@@ -7237,6 +7250,37 @@ export function withdrawByToken(reasons = [], clauses = [], guard = new Set(), t
7237
7250
  return out;
7238
7251
  }
7239
7252
 
7253
+ /**
7254
+ * THE CONDITIONS THE RECORD'S ACTIONS STATE, AS THE RECORD NOW STANDS. A repair can rewrite, withdraw or add a forward
7255
+ * legal step, and the list follows it: the entries the record's actions put there (`fromRecord`, by reason) are
7256
+ * replaced by the steps it states now (`now`, each `{ reason, clause }`, in the record's order), at the place the first
7257
+ * of them stood, or at the end where none stood. Every other entry keeps its place, and a step whose reason another
7258
+ * entry carries is left to that entry. Returns the index-aligned arrays as they now stand, the reasons the record now
7259
+ * holds there (`held`), and which reasons went and came. PURE.
7260
+ */
7261
+ export function conditionsFollowingTheRecord({ reasons = [], clauses = [], fromRecord = new Set(), now = [] } = {}) { // @internal — driven by its test
7262
+ const kept = [];
7263
+ let at = -1;
7264
+ for (const [i, r] of reasons.entries()) {
7265
+ if (fromRecord.has(r)) { if (at < 0) at = kept.length; continue; }
7266
+ kept.push([r, clauses[i]]);
7267
+ }
7268
+ const others = new Set(kept.map(([r]) => r));
7269
+ const placed = [];
7270
+ for (const n of now) {
7271
+ if (others.has(n.reason) || placed.some(([r]) => r === n.reason)) continue;
7272
+ placed.push([n.reason, n.clause ?? n.reason]);
7273
+ }
7274
+ const pos = at < 0 ? kept.length : at;
7275
+ const rows = [...kept.slice(0, pos), ...placed, ...kept.slice(pos)];
7276
+ const before = reasons.filter((r) => fromRecord.has(r));
7277
+ const clauseWas = new Map(reasons.map((r, i) => [r, clauses[i]]));
7278
+ const held = placed.map(([r]) => r);
7279
+ return { reasons: rows.map(([r]) => r), clauses: rows.map(([, c]) => c), held: new Set(held),
7280
+ withdrawn: before.filter((r) => !held.includes(r)), added: held.filter((r) => !before.includes(r)),
7281
+ restated: placed.filter(([r, c]) => before.includes(r) && clauseWas.get(r) !== c).map(([r]) => r) };
7282
+ }
7283
+
7240
7284
  /**
7241
7285
  * WHAT A REPAIR IN THE DELIVERY CHECK LEFT STALE, AND WHAT OF IT IS QUEUED. A stage is this repair's when it is stale now
7242
7286
  * and was not before the repair, or is stale on an input that has moved since; a stage stale before for the same reasons
@@ -7676,7 +7720,7 @@ async function enforceCorrectionsReachFindings(ctx, P, pre, resume) {
7676
7720
  const sha = createHash("sha256").update(raw).digest("hex");
7677
7721
  return { stale: named.length > 0 && sha === (pre.model?.sha ?? pre.sha) && !(corrections && corrections.applied), sha };
7678
7722
  };
7679
- if (!readState().stale) return;
7723
+ if (!readState().stale) return answerFollowsCorrection(ctx, P, pre, resume);
7680
7724
  note(`[corrections] findings.json unchanged after the corrective pass (review names: ${named.join(", ")}) — demanding the re-emit`);
7681
7725
  await stage("synthesis", ctx, {
7682
7726
  force: true, sessionKey: resume.synthesisKey, model: resume.synthesisModel, thinking: resume.synthesisThinking,
@@ -7696,6 +7740,33 @@ async function enforceCorrectionsReachFindings(ctx, P, pre, resume) {
7696
7740
  }
7697
7741
  }
7698
7742
 
7743
+ // THE ANSWERS FOLLOW THE FINDINGS THEY NAME, asked once, as the gate's one repair. A correction that moved findings an
7744
+ // answer citing findings may depend on (`answersLeftBehind`) is handed those findings and the answers that may miss them.
7745
+ // The writer updates the answers that depend on them or says why not in the corrections note; nothing is forced. Run
7746
+ // only where the findings did reach the record: where they did not, the re-emit above is the one repair, and it may
7747
+ // update the answers in the same PATCH. What remains afterwards is recorded, not judged; the recheck reads the answers.
7748
+ async function answerFollowsCorrection(ctx, P, pre, resume) {
7749
+ const { run } = ctx;
7750
+ const leftBehind = () => {
7751
+ try {
7752
+ return answersLeftBehind(JSON.parse(pre.model?.raw ?? pre.raw), JSON.parse(readFileSync(modelRecordPath(run.runDir, P.findings), "utf8")),
7753
+ ctx.framework?.bands);
7754
+ } catch { return []; } // an unreadable record is the ladder's business, not this check's
7755
+ };
7756
+ const answers = leftBehind();
7757
+ if (!answers.length) return;
7758
+ runLog(run.runDir, { event: "corrective-answers-left-behind", answers });
7759
+ note(`[corrections] ${answers.length} answer(s) in four_answers may miss findings the correction moved (${answers.map((a) => a.answer).join(", ")}) — asking once`);
7760
+ await stage("synthesis", ctx, {
7761
+ force: true, sessionKey: resume.synthesisKey, model: resume.synthesisModel, thinking: resume.synthesisThinking,
7762
+ trigger: "corrective-answers",
7763
+ followup: repairFollowup("synthesis:corrective-answers", { findings: modelRecordPath(run.runDir, P.findings), answers }) + stageCharter("synthesis", ctx.depth, ctx.framework),
7764
+ });
7765
+ const still = leftBehind();
7766
+ runLog(run.runDir, { event: "corrective-answers-after", answers: still });
7767
+ if (still.length) note(`[corrections] ${still.map((a) => a.answer).join(", ")} still name(s) the findings as before — recorded; any reason the writer gave is in the corrections note, and the recheck reads the answers`);
7768
+ }
7769
+
7699
7770
  // (T3a, ruling 2026-08-26 — "Deliver always, with open points printed. The refusal on a blocking
7700
7771
  // review goes." That REVERSES T3, which had retired "delivered-with-open-questions" and deleted
7701
7772
  // the extra this comment used to be a tombstone for. Both decisions are the owner's; this is the standing
@@ -8478,8 +8549,34 @@ export function coverageRowAreaLabel(axis, unit) { // @internal
8478
8549
  return coverageRowAreaFrom(axis, unit, labelled, "(all of it)");
8479
8550
  }
8480
8551
 
8481
- export function coverageJudgmentRows(ledgerRows, planExecution, plan = null) { // @internal
8552
+ // A LAYER ROW NAMES EVERY REGISTER IT LEFT, FROM ITS RECEIPT. The machine ledger keeps a row's axis, status
8553
+ // and reason, not its receipt, so the coverage form's layer row is found again by those three: the ledger is
8554
+ // rendered from the form, and they are the form row's own. A match must be one form row to one ledger row; any
8555
+ // other count leaves the row as it was. Its label is the territory's: the unit has no scope, so the axis's label
8556
+ // would say the whole main sweep stood open.
8557
+ const normReason = (s) => String(s ?? "").replace(/\s+/g, " ").trim();
8558
+ function layerRowNotes(ledgerRows, formRows) {
8559
+ const keyOf = (r) => `${String(r?.axis ?? "").trim().toLowerCase()}\u0000${String(r?.status ?? "").trim().toLowerCase()}\u0000${normReason(r?.reason)}`;
8560
+ const ledgerCount = new Map();
8561
+ for (const r of ledgerRows ?? []) ledgerCount.set(keyOf(r), (ledgerCount.get(keyOf(r)) ?? 0) + 1);
8562
+ const byKey = new Map();
8563
+ for (const f of (formRows ?? []).filter(isLayerRow)) {
8564
+ const k = keyOf(f);
8565
+ byKey.set(k, byKey.has(k) ? null : f);
8566
+ }
8567
+ const notes = new Map();
8568
+ for (const [k, f] of byKey) {
8569
+ if (!f || ledgerCount.get(k) !== 1) continue;
8570
+ const note = nationalRegistersNote(nationalRegistersNotSearched(f.receipt_reason));
8571
+ const territory = orderFormName(String(f.unit ?? "").split(" — ")[0]);
8572
+ if (note && territory) notes.set(k, { note, areaLabel: `${territory}: national registers` });
8573
+ }
8574
+ return { keyOf, notes };
8575
+ }
8576
+
8577
+ export function coverageJudgmentRows(ledgerRows, planExecution, plan = null, formRows = null) { // @internal
8482
8578
  const open = [];
8579
+ const layers = layerRowNotes(ledgerRows, formRows);
8483
8580
  for (const r of ledgerRows ?? []) {
8484
8581
  // `withheld-by-judgment` joins `confirmed-clean` in NOT reaching the reader, and for the opposite
8485
8582
  // reason. A clean row has nothing to disclose. A withheld one has something to say, and it is
@@ -8491,8 +8588,10 @@ export function coverageJudgmentRows(ledgerRows, planExecution, plan = null) {
8491
8588
  if (!r || status === "confirmed-clean" || status === "withheld-by-judgment") continue;
8492
8589
  const reason = String(r.reason ?? "").replace(/\s+/g, " ").trim().slice(0, 160);
8493
8590
  const axis = String(r.axis ?? "").toLowerCase();
8494
- open.push({ axis, area: coverageRowArea(axis, r.unit), areaLabel: coverageRowAreaLabel(axis, r.unit),
8495
- note: `${r.status}${reason ? ` — ${reason}` : ""}`, qids: [] });
8591
+ const layer = layers.notes.get(layers.keyOf(r));
8592
+ open.push({ axis, area: coverageRowArea(axis, r.unit),
8593
+ areaLabel: layer ? layer.areaLabel : coverageRowAreaLabel(axis, r.unit),
8594
+ note: `${r.status}${layer ? ` — ${layer.note}` : reason ? ` — ${reason}` : ""}`, qids: [] });
8496
8595
  }
8497
8596
  const skeleton = Array.isArray(planExecution?.skeleton) ? planExecution.skeleton : null;
8498
8597
  const axisOf = new Map();
@@ -8524,7 +8623,8 @@ export function stampCoverageJudgmentRows(P, runDir, note, ctx) { // @internal
8524
8623
  runLog(runDir, { event: "coverage-judgment-rows", judgment: false, reason: "synthesis emitted no coverage_judgment — none is invented here" });
8525
8624
  return;
8526
8625
  }
8527
- const rows = coverageJudgmentRows(loadCoverageLedger(runDir).rows, readPlanExecution(ctx), ctx?.registerPlan ?? null);
8626
+ const rows = coverageJudgmentRows(loadCoverageLedger(runDir).rows, readPlanExecution(ctx), ctx?.registerPlan ?? null,
8627
+ readCoverageForm(runDir).rows);
8528
8628
  const discarded = Array.isArray(cj.rows) ? cj.rows.length : 0;
8529
8629
  const next = { ...doc, coverage_judgment: { ...cj } };
8530
8630
  if (rows.length) next.coverage_judgment.rows = rows;
@@ -8543,7 +8643,7 @@ export function stampCoverageJudgmentRows(P, runDir, note, ctx) { // @internal
8543
8643
  }
8544
8644
  }
8545
8645
 
8546
- function injectDeferralCoverage(P, runDir, note) {
8646
+ export function injectDeferralCoverage(P, runDir, note) { // @internal — exported so a second pass is testable without a run
8547
8647
  try {
8548
8648
  const rp = driverDir(runDir, "frame-reopen.json");
8549
8649
  if (!existsSync(rp) || !existsSync(P.findings)) return;
@@ -8554,14 +8654,29 @@ function injectDeferralCoverage(P, runDir, note) {
8554
8654
  // rows — the reader-visible disclosure is the whole point of "can't close → disclose".
8555
8655
  if (!Array.isArray(doc.coverage)) doc.coverage = [];
8556
8656
  const normTxt = (s) => String(s ?? "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();
8557
- const covText = normTxt(doc.coverage.map((c) => `${c.area} ${c.note ?? ""}`).join(" "));
8657
+ // A row may stand in for this one only as the report page lets it (`dedupeFollowUps`, publish/render.mjs): the
8658
+ // driver's own row, or the writer's row restating the gap. A searched-clean row reports the opposite, and an
8659
+ // axis-labelled one ("Register / …") is a plan unit that may only share the words.
8660
+ const standsIn = (c) => String(c.area ?? "").startsWith("Follow-up / ")
8661
+ || (c.state !== "confirmed-clean" && !/\s\/\s/.test(String(c.area ?? "")));
8662
+ const wordsOf = (c) => new Set(normTxt(`${c.area} ${c.note ?? ""}`).split(" "));
8663
+ const rows = doc.coverage.filter(standsIn).map(wordsOf);
8558
8664
  let added = 0;
8559
8665
  for (const d of deferrals) {
8560
8666
  const directive = String(d?.directive ?? "").trim();
8561
8667
  if (!directive) continue;
8562
- const slice = normTxt(directive).split(" ").filter((w) => w.length >= 4).slice(0, 4).join(" ");
8563
- if (slice && covText.includes(slice)) continue; // synthesis already weighed it in
8564
- doc.coverage.push(deferralCoverageRow(directive, d?.reason)); // — word-boundary heading, full directive in the note
8668
+ // THE WORDS ARE THE ONES A ROW CARRIES, AND ONE ROW CARRIES ALL OF THEM. A directive is minted with its axis prefix
8669
+ // ("source:…"), and every row, this function's own included, prints it through `plainDirective`. This looked
8670
+ // for the raw directive's first four long words as one phrase across the whole coverage: the prefix was the
8671
+ // first of them, and a short word between two others ("eu", "and") broke the phrase anyway, so no row matched,
8672
+ // not even the row this function had just added. Each seam pass added it again: twice over in a record, and
8673
+ // back after a save that removed it. Measured on two test runs, 2026-11-03: 9 of 9 directives carried the
8674
+ // prefix, and 4 of one run's 7 a short word between their long ones.
8675
+ const want = normTxt(plainDirective(directive)).split(" ").filter((w) => w.length >= 4).slice(0, 4);
8676
+ if (want.length && rows.some((ws) => want.every((w) => ws.has(w)))) continue; // synthesis already weighed it in
8677
+ const row = deferralCoverageRow(directive, d?.reason); // — word-boundary heading, full directive in the note
8678
+ doc.coverage.push(row);
8679
+ rows.push(wordsOf(row));
8565
8680
  added++;
8566
8681
  }
8567
8682
  if (!added) return;
@@ -8884,7 +8999,8 @@ function goodsEvidenceOfDrops(P, runPrefix, uris, gateFetched = null) {
8884
8999
  }
8885
9000
  for (const uri of uris) {
8886
9001
  const e = recordGoodsEvidence(rowOf.get(normalizeRecordUri(uri)) ?? { record_id: uri }, { goods, held, fetches });
8887
- out.set(uri, { goods: e.state, source: e.source });
9002
+ // A register page the research saved is named by the question that saved it, which the write-up's label carries.
9003
+ out.set(uri, { goods: e.state, source: e.source, ...(e.question != null ? { question: e.question } : {}) });
8888
9004
  }
8889
9005
  return out;
8890
9006
  }
@@ -10229,7 +10345,9 @@ async function pipelineInner(job, opts = {}) {
10229
10345
  let engineTurnStartedMs = null, engineTurnEndedMs = null;
10230
10346
  if (!opts.recordFetcher && !koSelector) {
10231
10347
  engineTurnStartedMs = Date.now();
10232
- engineTurn = await preflightEngineTurn();
10348
+ // `opts.engineTurnWait` stands in for the door's wait before it checks a locked sign-in refresh again,
10349
+ // in tests; a run passes none and waits.
10350
+ engineTurn = await preflightEngineTurn({ wait: opts.engineTurnWait });
10233
10351
  engineTurnEndedMs = Date.now();
10234
10352
  if (engineTurn.warning) console.error(engineTurn.warning);
10235
10353
  }
@@ -10374,11 +10492,13 @@ async function pipelineInner(job, opts = {}) {
10374
10492
  // — the engine-turn door's verdict, beside the run it let through. A refusal never reaches here (it
10375
10493
  // throws before any of this exists), so this row answers the two questions that survive: did the door
10376
10494
  // run at all on this lane, and — when it failed open on weather — WHAT it decided to let past. Without
10377
- // it a proceeded-past-weather run is indistinguishable on the record from one that probed clean.
10495
+ // it a proceeded-past-weather run is indistinguishable on the record from one that probed clean. A door
10496
+ // that checked twice, because the first check met a locked sign-in refresh, says so beside the second.
10378
10497
  try {
10379
10498
  if (engineTurn) runLog(run.runDir, { event: "engine-turn-probe", ok: engineTurn.ok === true,
10380
10499
  engine: engineTurn.engine ?? null, mode: engineTurn.mode ?? null, basis: engineTurn.basis ?? null,
10381
- lane: engineTurn.ok === true ? "ok" : "weather", detail: engineTurn.detail ?? null });
10500
+ lane: engineTurn.ok === true ? "ok" : "weather", detail: engineTurn.detail ?? null,
10501
+ ...(engineTurn.recheckedAfter ? { recheckedAfter: engineTurn.recheckedAfter } : {}) });
10382
10502
  // — and the same probe as a SPAN the wall decomposition can attribute. Same measurement, second
10383
10503
  // reader: the row above goes to run.jsonl, which that instrument skips by name.
10384
10504
  if (engineTurn) recordSpan(run.runDir, "engine-turn", { startedMs: engineTurnStartedMs, endedMs: engineTurnEndedMs },
@@ -14955,6 +15075,10 @@ async function pipelineInner(job, opts = {}) {
14955
15075
  // withdrawn against it (ruled 2026-10-19).
14956
15076
  let assessed = verdict;
14957
15077
  let restoredClear = false; // a closed gap took this run back to CLEAR, so a later writer's judgment meets the floor again
15078
+ // THE REASONS THE RECORD'S OWN ACTIONS PUT IN THE LIST, by the floor's legal-actions arm, so the list can follow the
15079
+ // record when a repair in the delivery check rewrites, withdraws or adds a step (conditionsFollowingTheRecord).
15080
+ let recordConditionReasons = new Set();
15081
+ const DROPPED_CONDITIONS_REASON = "a forward legal step this opinion named could not be recorded, so the conditions listed here are incomplete";
14958
15082
 
14959
15083
  /**
14960
15084
  * Deliver, clamp conservatively, and name the defect in the run record.
@@ -15235,6 +15359,7 @@ async function pipelineInner(job, opts = {}) {
15235
15359
  // (the degenerate re-ask re-runs this floor; dedup is by the reason TEXT for both).
15236
15360
  for (const c of fresh) clampClauses.push(conditionClauses[conditions.indexOf(c)] ?? c);
15237
15361
  clampReasons.push(...fresh);
15362
+ for (const c of fresh) recordConditionReasons.add(c);
15238
15363
  if (verdict === "CLEAR") {
15239
15364
  runLog(run.runDir, { event: "coverage-floor-clamp", cause: "forward-actions", from: "CLEAR", to: "CONDITIONAL", legalActions: conditions.length });
15240
15365
  note(`deliver-conditional floor: the opinion names ${conditions.length} forward legal action(s) a human must take (${conditions[0].slice(0, 140)}${conditions.length > 1 ? `; +${conditions.length - 1} more` : ""}) — clamping CLEAR→CONDITIONAL (spec 64: the disposition is derived from the findings' named actions).`);
@@ -15258,7 +15383,7 @@ async function pipelineInner(job, opts = {}) {
15258
15383
  // do is read as complete — so the reason says INCOMPLETE in the client's own words, and the
15259
15384
  // engine-side detail (ids, defect tokens) rides the note and the log where an engineer reads.
15260
15385
  const droppedConditions = quarantinedConditionRows(fdoc?.actionsQuarantined);
15261
- const droppedReason = "a forward legal step this opinion named could not be recorded, so the conditions listed here are incomplete";
15386
+ const droppedReason = DROPPED_CONDITIONS_REASON;
15262
15387
  // ONCE, not once per entry. This floor is re-entered — the degenerate re-ask and the delivery
15263
15388
  // block both call it again — so the reason, the clause and the telemetry are guarded by the
15264
15389
  // reason's own presence. An event emitted on every re-entry would inflate any count keyed on
@@ -15267,6 +15392,7 @@ async function pipelineInner(job, opts = {}) {
15267
15392
  clampKinds.actionsDropped = true;
15268
15393
  clampClauses.push(droppedReason);
15269
15394
  clampReasons.push(droppedReason);
15395
+ recordConditionReasons.add(droppedReason);
15270
15396
  runLog(run.runDir, { event: "verdict-conditions-dropped", n: droppedConditions.length,
15271
15397
  ids: droppedConditions.map((q) => q.id), kinds: droppedConditions.map((q) => q.kind),
15272
15398
  errors: droppedConditions.map((q) => String(q.error ?? "").slice(0, 80)) });
@@ -15562,6 +15688,48 @@ async function pipelineInner(job, opts = {}) {
15562
15688
  try { displayVerdict = composeVerdictSidecar().doc; } catch { /* composed again when it is saved */ }
15563
15689
  return false;
15564
15690
  };
15691
+ // THE LABEL OWED IS SAVED before anything is published from it, and the report's own label follows it. Only a run
15692
+ // directory that refuses every save of it ends the run, and then nothing the run writes can be published.
15693
+ const saveTheOwedLabel = () => {
15694
+ if (!labelOwed) return;
15695
+ const owed = labelOwed;
15696
+ labelOwed = null;
15697
+ if (!saveTheLabel(`${owed}, saved again before delivery`))
15698
+ throw new StageFailure("verdict", `the run directory refused every save of the result's label (${owed}) — no surface can be published with it`);
15699
+ applyVerdictFrontMatter();
15700
+ };
15701
+ // THE CONDITIONS FOLLOW THE RECORD AFTER A REPAIR IN THE DELIVERY CHECK. Every surface reads the list from the label,
15702
+ // and the list states the record's forward legal steps as the record stands: a repair that rewrites, withdraws or
15703
+ // adds one moves the list with it, in the record's own words. The result moves only where the floor any result meets
15704
+ // moves it: a CLEAR the repaired steps now condition becomes CONDITIONAL, and nothing is relaxed. A BLOCKING result
15705
+ // states no step of its own, so only a list already stating the record's steps follows it. The caller saves the
15706
+ // label. Returns whether the list, its kinds or the result changed.
15707
+ const followTheRecordsActions = (why) => {
15708
+ if (verdict === "BLOCKING" && !recordConditionReasons.size) return false;
15709
+ let fdoc = null;
15710
+ try { fdoc = existsSync(P.findings) ? parseFindingsJsonLenient(readFileSync(P.findings, "utf8")) : null; }
15711
+ catch { fdoc = null; }
15712
+ if (!fdoc) return false; // no record to read: the list stands as stated, and the coherence checks judge it
15713
+ const { conditions, conditionClauses } = deriveActionConditions(fdoc.actions, fdoc.findings);
15714
+ const now = conditions.map((c) => ({ reason: c, clause: conditionClauses[conditions.indexOf(c)] ?? c }));
15715
+ const dropped = quarantinedConditionRows(fdoc.actionsQuarantined).length > 0;
15716
+ if (dropped && recordConditionReasons.has(DROPPED_CONDITIONS_REASON)) now.push({ reason: DROPPED_CONDITIONS_REASON, clause: DROPPED_CONDITIONS_REASON });
15717
+ const state = () => JSON.stringify([clampReasons, clampClauses, Boolean(clampKinds.legalActions), Boolean(clampKinds.actionsDropped)]);
15718
+ const stood = state(), was = verdict;
15719
+ const f = conditionsFollowingTheRecord({ reasons: clampReasons, clauses: clampClauses, fromRecord: recordConditionReasons, now });
15720
+ clampReasons = f.reasons;
15721
+ clampClauses = f.clauses;
15722
+ recordConditionReasons = f.held;
15723
+ if (!conditions.length) delete clampKinds.legalActions;
15724
+ if (!dropped) delete clampKinds.actionsDropped;
15725
+ // The floor runs again only where the repaired steps reach it, as the coherence repair runs it.
15726
+ if (state() !== stood || (verdict === "CLEAR" && (conditions.length || dropped))) applyCoverageFloor();
15727
+ if (state() === stood && verdict === was) return false;
15728
+ runLog(run.runDir, { event: "verdict-conditions-followed", why, withdrawn: f.withdrawn.length, added: f.added.length,
15729
+ restated: f.restated.length, conditions: recordConditionReasons.size, from: was, to: verdict });
15730
+ note(`the conditions follow the record ${why} (${f.withdrawn.length} withdrawn, ${f.added.length} added, ${f.restated.length} restated${verdict === was ? "" : `; ${was} → ${verdict}`})`);
15731
+ return true;
15732
+ };
15565
15733
  try { writeVerdictSidecar(); }
15566
15734
  catch (e) { throw new StageFailure("verdict", `verdict sidecar write failed (the single label authority): ${String(e.message).slice(0, 120)}`); }
15567
15735
 
@@ -15721,6 +15889,8 @@ async function pipelineInner(job, opts = {}) {
15721
15889
  // afterwards and therefore never read it as staleness.
15722
15890
  stampCoverageJudgmentRows(P, run.runDir, note, ctx);
15723
15891
  consolidateFindingsFile(P, note, ctx.framework);
15892
+ // The conditions too: a save that rewrote, withdrew or added a forward legal step moves the list with it.
15893
+ followTheRecordsActions("after a save of the record");
15724
15894
  // T2: consolidation can change the live composite set — re-derive the sidecar so every
15725
15895
  // surface joins the FINAL findings (the sidecar must never describe a superseded set).
15726
15896
  // review fix: consolidation can also surface CONDITIONS the floor never saw (a lenient-
@@ -16651,6 +16821,9 @@ async function pipelineInner(job, opts = {}) {
16651
16821
  // is presence-gated and simply emits nothing here; they stay alive for replay-archive.mjs,
16652
16822
  // which passes the archived summary.
16653
16823
  reportMd, narrativeMd, auditMd, recordsByUri: assembled.records, searchedNames,
16824
+ // What each record's goods rested on when the writer wrote, and the records whose whole text a delivery repair
16825
+ // was already handed: a finding written on goods the register cut, whose whole body the run holds now.
16826
+ goodsEvidence: readGoodsEvidence(run.runDir), goodsHanded: readGoodsHanded(run.runDir),
16654
16827
  // The overview as its writer wrote it, read for a citation of a finding the report does not carry; and the
16655
16828
  // conditions the email carries, as the email composes them.
16656
16829
  overviewMd: (() => { try { return readFileSync(P.reportOverview, "utf8"); } catch { return null; } })(), emailConditions: emailConditionsOfReport(reportMd, lintVerdict?.verdict),
@@ -16720,6 +16893,7 @@ async function pipelineInner(job, opts = {}) {
16720
16893
  // an edit to the actions. One attempt; a residual failure ships as the structural banner flag.
16721
16894
  if (lint.failures.some((f) => f.id === "verdict-actions-coherence" || f.id === "verdict-actions-stale" || f.id === "statement-tier" || f.id === "statement-unconditional" || f.id === "statement-stance" || f.id === "statement-conditional-form")) {
16722
16895
  const beforeVerdict = verdict;
16896
+ followTheRecordsActions("in the delivery check's re-derive"); // a stale step goes, as a missing one arrives
16723
16897
  applyCoverageFloor();
16724
16898
  try { writeVerdictSidecar(); }
16725
16899
  catch (e) { throw new StageFailure("verdict", `verdict sidecar re-derive failed (spec-64 coherence repair): ${String(e.message).slice(0, 120)}`); }
@@ -16882,13 +17056,35 @@ async function pipelineInner(job, opts = {}) {
16882
17056
  const fold = readFold(run.runDir);
16883
17057
  const sentenceFixable = targets.stamped.flatMap((f) => (f.parts ?? []).map((x) => ({ ...f, finding: keptModelOrdinal(fold, x.ordinal), detail: x.detail })));
16884
17058
  const recordFixable = targets.record.flatMap((f) => writersCitationFaults(f, (o) => keptModelOrdinal(fold, o)));
16885
- const narrativeFixable = [...modelFixable(bySurface("narrative")), ...sentenceFixable, ...recordFixable];
17059
+ // A finding named for goods the register cut, whose whole text the run holds now, is named in the writer's
17060
+ // numbering, in the line's own words: it opens "Finding <N> cites", so the list puts no "finding N:" before it.
17061
+ // Under a fold, N is the writer's finding that cites the record, which need not be the member the fold kept.
17062
+ let writersFindings = null; // the writer's record, read once and only for a goods line
17063
+ const writersRecord = () => {
17064
+ if (writersFindings) return writersFindings;
17065
+ try { writersFindings = parseFindingsJsonLenient(readFileSync(modelRecordPath(run.runDir, P.findings), "utf8")).findings ?? []; }
17066
+ catch { writersFindings = []; }
17067
+ return writersFindings;
17068
+ };
17069
+ const citesRecord = (wf, uri) => (Array.isArray(wf?.owner?.registrations) ? wf.owner.registrations : [])
17070
+ .some((reg) => normalizeRecordUri(reg?.uri ?? reg) === uri);
17071
+ const inWritersNumbering = (f) => (String(f.id).startsWith("goods-held-whole:")
17072
+ ? { ...f, detail: goodsHeldWholeDetail(citingModelOrdinal(fold, f.ordinal, f.uri, writersRecord(), citesRecord), f.uri, f.goods, f.state) } : f);
17073
+ const narrativeFixable = [...modelFixable(bySurface("narrative")).map(inWritersNumbering), ...sentenceFixable, ...recordFixable];
16886
17074
  if (narrativeFixable.length && synthesisKey) repairBaseKept = snapshotRepairBase(run.runDir);
16887
17075
  // A writer fault with no writer session to repair it is not repaired, and the run says so.
16888
17076
  if (narrativeFixable.length && !synthesisKey)
16889
17077
  runLog(run.runDir, { event: "lint-redo-skipped", surface: "writer", why: "no-writer-session", failures: narrativeFixable.map((f) => f.id) });
16890
17078
  if (narrativeFixable.length) await redo("synthesis", narrativeFixable, synthesisKey, synthesisModel, synthesisThinking, P.narrative,
16891
17079
  { findings: modelRecordPath(run.runDir, P.findings), narrative: P.narrative });
17080
+ // The records whose whole goods text this repair was handed, kept so the check after it does not name them again.
17081
+ const goodsHandedNow = narrativeFixable.filter((f) => String(f.id).startsWith("goods-held-whole:")).map((f) => f.uri);
17082
+ if (goodsHandedNow.length && repaired.includes("synthesis")) {
17083
+ try {
17084
+ recordGoodsHanded(run.runDir, goodsHandedNow);
17085
+ runLog(run.runDir, { event: "goods-held-whole-handed", records: [...new Set(goodsHandedNow)].sort() });
17086
+ } catch (e) { note(`pre-delivery lint: the records handed their whole goods text were not recorded: ${e?.message ?? e}`); }
17087
+ }
16892
17088
  if (reassembled) assembleReportMd(P, findingsForCards, assembledOrdinals, { grouped: groupedMembers, byRight });
16893
17089
  // The client-summary redo arm is retired with the stage (2026-08-01). Its `email`-surface
16894
17090
  // failures have not gone unowned: the `:email` reference check now runs over the report-derived
@@ -16905,6 +17101,17 @@ async function pipelineInner(job, opts = {}) {
16905
17101
  autoCorrectRegistry(); // doc-27 Item 1b: a re-emission may have reintroduced a wrong identifier — overwrite from the record again
16906
17102
  }
16907
17103
  }
17104
+ // THE GOODS REFRESH'S OUTCOME, kept in the run record whatever this pass did (predelivery-lint.mjs,
17105
+ // goodsHeldWholeChecks): the findings named for the repair, those still saying their goods are cut or unread after
17106
+ // it, and the check's own count of the ones that no longer say so.
17107
+ try {
17108
+ const rows = (lint?.checks ?? []).filter((c) => /^goods-held-whole(?::|-unresolved:|$)/.test(String(c.id)));
17109
+ if (rows.some((c) => c.id !== "goods-held-whole") || readGoodsHanded(run.runDir).size)
17110
+ runLog(run.runDir, { event: "goods-held-whole",
17111
+ named: rows.filter((c) => c.id.startsWith("goods-held-whole:")).map((c) => c.id.slice("goods-held-whole:".length)),
17112
+ unresolved: rows.filter((c) => c.id.startsWith("goods-held-whole-unresolved:")).map((c) => c.id.slice("goods-held-whole-unresolved:".length)),
17113
+ summary: rows.find((c) => c.id === "goods-held-whole")?.detail ?? null });
17114
+ } catch { /* the run record's row is best-effort; the check's own rows are in the receipt below */ }
16908
17115
  // The receipt artifact — ALWAYS written, pass or fail (spec A2's auditor evidence).
16909
17116
  // V4-1: the receipt states the ARTIFACT SET evaluated — surfaces, record set + sources, and the
16910
17117
  // stage labels this session inherited via skip — so an auditor can see the gates ran over
@@ -17354,17 +17561,17 @@ async function pipelineInner(job, opts = {}) {
17354
17561
  note(`stale-repair: ${staleStages.map((x) => x.label).join(", ")} could not be re-run for the changed decision — the run delivers, and the approved clauses name what they find`);
17355
17562
  staleStages = [];
17356
17563
  }
17357
- // THE LABEL OWED IS SAVED NOW, before anything is published from it, and the report's own label follows it. Only
17358
- // a run directory that refuses every save of it ends the run here, and then nothing the run writes can be published.
17359
- if (labelOwed) {
17360
- const owed = labelOwed;
17361
- labelOwed = null;
17362
- if (!saveTheLabel(`${owed}, saved again before delivery`))
17363
- throw new StageFailure("verdict", `the run directory refused every save of the result's label (${owed}) — no surface can be published with it`);
17364
- applyVerdictFrontMatter();
17365
- }
17564
+ saveTheOwedLabel(); // before anything is published from it
17366
17565
  note(`stale-repair: re-did ${staleRepaired.length} stage(s) in-pass (${staleRepaired.join(", ") || "none"}) — ${staleStages.length ? `${staleStages.length} still stale, the delivery guard blocks` : "the delivery path is fresh"}`);
17367
17566
  }
17567
+ // THE CONDITIONS FOLLOW THE RECORD AS IT IS DELIVERED, whichever repair above moved it last, and the label owed is
17568
+ // saved before the receipt below and anything published from it. A list that moved is judged again.
17569
+ if (followTheRecordsActions("as the record is delivered")) {
17570
+ saveTheLabel("as the record is delivered");
17571
+ applyVerdictFrontMatter();
17572
+ lint = lintNow();
17573
+ }
17574
+ saveTheOwedLabel();
17368
17575
  // P2 — record the delivery-BLOCKING stale labels the moment they are known (not only at the throw
17369
17576
  // below), so ANY later exit from this pass — the staleness throw, a core-artifact throw between here
17370
17577
  // and it, an auto-recovery park — carries the set into reconcilePassStamps. Reconcile must leave these
@@ -29,7 +29,8 @@ import { searchedCovers } from "./frame-diff-model.mjs"; // one c
29
29
  import { partyFactSources, partyFactViolations, partyFactMessage, canJudgePartyFacts } from "./party-facts.mjs"; //
30
30
  import { writeUpViolations, writeUpMessage } from "./narrative-write-ups.mjs"; //
31
31
 
32
- import { findRegistryArithmeticIssues, findRegistryViolations, splitBlocks } from "./registry-fidelity.mjs";
32
+ import { findRegistryArithmeticIssues, findRegistryViolations, splitBlocks, normalizeRecordUri } from "./registry-fidelity.mjs";
33
+ import { recordGoods, untaggedIsEnglish } from "./record-goods.mjs"; // a held record's goods, read as the band reads them
33
34
  import { parseFront } from "./publish/parse.mjs";
34
35
  import { citedFindingNumbers } from "./finding-citations.mjs"; // every written form of a citation, read one way
35
36
  export { citedFindingNumbers };
@@ -2275,6 +2276,91 @@ export function actionsRegisterChecks({ actionsRegister, expected }) {
2275
2276
  // the row ALWAYS PASSES — it exists so the receipt artifact and any reviewer can see where the assembly
2276
2277
  // moved words, without triggering a repair loop or a gate. Emitted only when the run actually folded
2277
2278
  // (archived/replay runs have no sidecar and never grow a row).
2279
+ // ── A FINDING WRITTEN ON GOODS THE REGISTER CUT, WHOSE WHOLE TEXT THE RUN NOW HOLDS ─────────────────────────
2280
+ //
2281
+ // A writer reads a record's goods as the band holds them, and a register's search answer can hold a long statement
2282
+ // cut, or not establish that it is whole. `goods-evidence.json` is written beside the band shape before the writer
2283
+ // writes, so it says which records the writer had that way. The record's whole body can arrive later: a fetch during
2284
+ // doubt closure, or the record closure just before this check. Measured 2026-11-03 on both engines: findings said a
2285
+ // class was "cut and unread" while the run went on to fetch that class whole, and nothing read the finding again.
2286
+ //
2287
+ // So a delivered finding is named, with the record's whole statements, for the writer's one repair at this check, when
2288
+ // both hold: it rests on such a record, now held whole, and its own text says part of its goods statement is cut or
2289
+ // unread (`claimsGoodsCut`). Both halves bound it. On the two saved runs that prompted this, the record half alone
2290
+ // named 22 and 34 findings, because half the band was cut and every cited record arrives whole by this check, while
2291
+ // the findings that reasoned on the missing part are the ones that say so: 3 and 8. A record whose held body still
2292
+ // says cut, or one the run does not hold, is not named. A record whose whole text was once handed to that repair
2293
+ // (`handed`, by uri) is not handed again: the check after the repair, and a resume, report its outcome instead
2294
+ // (corrected, unresolved, or no outcome established), whatever numbering the repair's save gives the findings.
2295
+ export function goodsHeldWholeChecks({ findings, goodsEvidence, recordsByUri, handed = null }) {
2296
+ const asWritten = new Map();
2297
+ for (const r of Array.isArray(goodsEvidence?.records) ? goodsEvidence.records : []) {
2298
+ const uri = normalizeRecordUri(r?.uri ?? r?.record_id);
2299
+ if (uri && r?.source === "search-row" && (r.state === "cut" || r.state === "unknown")) asWritten.set(uri, r.state);
2300
+ }
2301
+ const named = [], unresolved = [], corrected = [], handedCited = new Set();
2302
+ for (const f of Array.isArray(findings) ? findings : []) {
2303
+ if (!f || String(f.disposition ?? "") === "withdrawn" || !Number.isInteger(f.ordinal)) continue;
2304
+ const claims = claimsGoodsCut(f);
2305
+ for (const reg of Array.isArray(f?.owner?.registrations) ? f.owner.registrations : []) {
2306
+ const uri = normalizeRecordUri(reg?.uri ?? reg);
2307
+ if (!uri || !asWritten.has(uri)) continue;
2308
+ const body = recordsByUri?.get?.(uri) ?? null;
2309
+ const goods = body ? recordGoods(body, { english: untaggedIsEnglish(uri) }) : [];
2310
+ if (!goods.length || goods.some((g) => g?.cut || g?.unknown)) continue;
2311
+ // HANDED ONCE, AND THE OUTCOME KEPT. The repair is not run a second time for a record, and handing the text over
2312
+ // is not the defect resolved: a finding that still says its goods are cut or unread is unresolved, a row that
2313
+ // no repair takes (`structural`), and one that no longer says so is counted as corrected.
2314
+ if (handed?.has?.(uri)) {
2315
+ handedCited.add(uri);
2316
+ if (claims) unresolved.push({ ...check(`goods-held-whole-unresolved:${f.ordinal}:${uri}`, "goods-evidence", "narrative", false,
2317
+ `Finding ${f.ordinal} still says its goods are cut or unread after the delivery repair was given the complete goods statements of ${uri}.`),
2318
+ structural: true, ordinal: f.ordinal, uri });
2319
+ else corrected.push(`${f.ordinal}:${uri}`);
2320
+ continue;
2321
+ }
2322
+ if (!claims) continue;
2323
+ const state = asWritten.get(uri);
2324
+ named.push({ ...check(`goods-held-whole:${f.ordinal}:${uri}`, "goods-evidence", "narrative", false,
2325
+ goodsHeldWholeDetail(f.ordinal, uri, goods, state)), ordinal: f.ordinal, uri, goods, state });
2326
+ }
2327
+ }
2328
+ // A record handed to the repair that no delivered finding cites now has no outcome this check can establish.
2329
+ const noOutcome = [...(handed ?? [])].filter((u) => !handedCited.has(u));
2330
+ const summary = handed?.size
2331
+ ? `${corrected.length} finding(s) given complete goods statements by the delivery repair no longer say their goods are cut or unread; `
2332
+ + `${unresolved.length} still do`
2333
+ + (noOutcome.length ? `; ${noOutcome.length} record(s) given to it are cited by no delivered finding, so no outcome is established for them` : "")
2334
+ : "no delivered finding says its goods are cut or unread while the run holds them complete";
2335
+ return [...named, ...unresolved, check("goods-held-whole", "goods-evidence", "narrative", true, summary)];
2336
+ }
2337
+
2338
+ /** The line the writer's repair reads for one finding, in the numbering the writer's save takes. PURE. */
2339
+ export function goodsHeldWholeDetail(ordinal, uri, goods, state) {
2340
+ const statements = goods.map((g) => `${g.classes.length ? `Class ${g.classes.join(", ")}` : "Goods"}: "${g.text}"`).join(". ");
2341
+ return `Finding ${ordinal} cites ${uri}. Its earlier goods evidence was ${state === "cut" ? "cut by the register" : "of unestablished completeness"}. `
2342
+ + `The run now holds these complete goods statements from the register record: ${statements}. `
2343
+ + "Reassess this finding's goods comparison on those statements, and correct any claim that they remain cut or unread. Change its rating only if the evidence requires it.";
2344
+ }
2345
+
2346
+ /**
2347
+ * Does the finding's own text say part of its goods statement is cut or unread? A sentence that names the cut and a
2348
+ * part of a goods statement: "The consultancy list is cut", "a further research clause … is cut and unread", "before a
2349
+ * cut tail". A sentence that says something else is unread ("international designations are unread") is not one. PURE.
2350
+ */
2351
+ const CUT_WORD_RE = /\b(?:cut|truncated|unread)\b/i;
2352
+ const GOODS_PART_RE = /\b(?:list|lists|clause|clauses|wording|specification|goods|services|class|classes|tail|remainder|statement|statements)\b/i;
2353
+ export function claimsGoodsCut(finding) {
2354
+ const texts = [];
2355
+ const walk = (v) => {
2356
+ if (typeof v === "string") texts.push(v);
2357
+ else if (Array.isArray(v)) v.forEach(walk);
2358
+ else if (v && typeof v === "object") for (const [k, x] of Object.entries(v)) if (k !== "owner") walk(x);
2359
+ };
2360
+ walk(finding);
2361
+ return texts.some((t) => t.split(/(?<=[.;!?])\s+/).some((sentence) => CUT_WORD_RE.test(sentence) && GOODS_PART_RE.test(sentence)));
2362
+ }
2363
+
2278
2364
  export function cardBudgetChecks({ cardFolds }) {
2279
2365
  const folds = Array.isArray(cardFolds) ? cardFolds : [];
2280
2366
  if (!folds.length) return [];
@@ -2282,7 +2368,7 @@ export function cardBudgetChecks({ cardFolds }) {
2282
2368
  `assembly folded ${folds.length} surface(s) to the level budgets (moved, never deleted): ${folds.map((f) => `${f.surface} → +${f.movedSentences} sentence(s)/${f.movedWords} word(s) into depth`).join("; ")}`)];
2283
2369
  }
2284
2370
 
2285
- export function runLint({ depth, commonLawGrid, matterContext, clientPartyName, reportMd, overviewMd = null, emailConditions = null, clientSummaryMd, narrativeMd, auditMd, recordsByUri, searchedNames, headerName, ratedNames, actionsText, fetchFailures, extraPlatformNames, findings, narrativeFindings = null, findingsRaw, actionsRegister, actionsExpected, intakeAsks, askAnswers, cardFolds, verdictDoc, manifest, seniorRights, seniorRightsExpected, markAssessment, markAssessmentExpected, fourAnswers, contentModelExpected, findingsSchemaVersion, placements, ownerScreen, recordCarry, commonLawCarries, searchedJurisdictions = null }) {
2371
+ export function runLint({ depth, commonLawGrid, matterContext, clientPartyName, reportMd, overviewMd = null, emailConditions = null, clientSummaryMd, narrativeMd, auditMd, recordsByUri, searchedNames, headerName, ratedNames, actionsText, fetchFailures, extraPlatformNames, findings, narrativeFindings = null, findingsRaw, actionsRegister, actionsExpected, intakeAsks, askAnswers, cardFolds, verdictDoc, manifest, seniorRights, seniorRightsExpected, markAssessment, markAssessmentExpected, fourAnswers, contentModelExpected, findingsSchemaVersion, placements, ownerScreen, recordCarry, commonLawCarries, searchedJurisdictions = null, goodsEvidence = null, goodsHanded = null }) {
2286
2372
  // WS-B: the run's profile platforms join the vocabulary for this run. Profiles carry store
2287
2373
  // DOMAINS by contract, so derive the name tokens a report would actually print: the raw norm
2288
2374
  // ("thomasnetcom"), the separator-spaced phrase ("thomasnet com" / "made in china com"), and the
@@ -2378,6 +2464,9 @@ export function runLint({ depth, commonLawGrid, matterContext, clientPartyName,
2378
2464
  if (reportMd) checks.push(...permissionProseChecks({ text: reportMd, surface: "report" }));
2379
2465
  if (clientSummaryMd) checks.push(...permissionProseChecks({ text: clientSummaryMd, surface: "client-summary", idSuffix: ":client" }));
2380
2466
  if (narrativeMd) checks.push(...permissionProseChecks({ text: narrativeMd, surface: "narrative", idSuffix: ":narrative", structural: true }));
2467
+ // A finding written on goods the register cut, whose whole text the run holds now. Live runs only: the replay
2468
+ // harness passes no goods evidence, so an archived run never grows the check.
2469
+ if (goodsEvidence) checks.push(...goodsHeldWholeChecks({ findings, goodsEvidence, recordsByUri, handed: goodsHanded }));
2381
2470
  // — the narrative's own depth rules, on the narrative surface so they route to the synthesis redo.
2382
2471
  // Its finding headings are in the model's numbering, so they join the record the model wrote when the
2383
2472
  // delivered record is folded (`narrativeFindings`), and the delivered record otherwise.