@feigi/fleet-ctl 3.23.36 → 3.23.37
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/package.json +1 -1
- package/scripts/main-checkout.mjs +1 -1
- package/scripts/member-write-guard.mjs +1 -1
- package/scripts/repo-root.mjs +1 -1
- package/skills/run-team/references/reaping.md +1 -1
- package/scripts/agent-test-dir-prose.test.mjs +0 -59
- package/scripts/agent-test.test.mjs +0 -1640
- package/scripts/ambient-git-vars-mjs-prose.test.mjs +0 -397
- package/scripts/ambient-git-vars-prose.test.mjs +0 -192
- package/scripts/ancestry-check-position-prose.test.mjs +0 -175
- package/scripts/apply-ruleset.test.mjs +0 -421
- package/scripts/arg-header-probes-prose.test.mjs +0 -394
- package/scripts/arg.test.mjs +0 -1354
- package/scripts/board-cli.test.mjs +0 -710
- package/scripts/board-identity.test.mjs +0 -429
- package/scripts/board-liveness-banner.test.mjs +0 -119
- package/scripts/board-prev-shape.test.mjs +0 -228
- package/scripts/board-tryparse-null.test.mjs +0 -119
- package/scripts/board.test.mjs +0 -3121
- package/scripts/brief-after-cut-prose.test.mjs +0 -53
- package/scripts/candidates-exit3-prose.test.mjs +0 -302
- package/scripts/candidates.test.mjs +0 -2312
- package/scripts/caveat-unification-prose.test.mjs +0 -98
- package/scripts/cell-readout.test.mjs +0 -615
- package/scripts/ci-comment-rot-prose.test.mjs +0 -2025
- package/scripts/ci-completes-premise-prose.test.mjs +0 -257
- package/scripts/ci-state-prose.test.mjs +0 -113
- package/scripts/ci-state.test.mjs +0 -1933
- package/scripts/ci-vacuous-green.test.mjs +0 -368
- package/scripts/citation-sweep-prose.test.mjs +0 -1712
- package/scripts/claim-lifecycle.test.mjs +0 -187
- package/scripts/claim-ticket.test.mjs +0 -1122
- package/scripts/closing-keyword-prose.test.mjs +0 -193
- package/scripts/cockpit-launch-idempotent-prose.test.mjs +0 -165
- package/scripts/cockpit-tick-nonblocking.test.mjs +0 -210
- package/scripts/compute-board.test.mjs +0 -1214
- package/scripts/compute-spend.test.mjs +0 -517
- package/scripts/consumer-technology-prose.test.mjs +0 -126
- package/scripts/cross-repo-citation-prose.test.mjs +0 -155
- package/scripts/cwd-isolation-pins.mjs +0 -83
- package/scripts/dedupe-guard-prose.test.mjs +0 -243
- package/scripts/delete-merged-branch.test.mjs +0 -576
- package/scripts/derive-testcmd.test.mjs +0 -595
- package/scripts/diff-stats.test.mjs +0 -404
- package/scripts/dispatch-block-golden-prose.test.mjs +0 -1130
- package/scripts/dispatch-block-pins-prose.test.mjs +0 -615
- package/scripts/dispositions-check.test.mjs +0 -936
- package/scripts/dispositions-gate-prose.test.mjs +0 -129
- package/scripts/drop-merged-label.test.mjs +0 -479
- package/scripts/exec-stub.mjs +0 -93
- package/scripts/exec-stub.test.mjs +0 -69
- package/scripts/expected-jobs-prose.test.mjs +0 -80
- package/scripts/fan-out-authorization-prose.test.mjs +0 -80
- package/scripts/filing-bar-seat-prose.test.mjs +0 -242
- package/scripts/filing-claim-bar-prose.test.mjs +0 -166
- package/scripts/finisher-died-prose.test.mjs +0 -31
- package/scripts/finisher-dispatch-premise-prose.test.mjs +0 -312
- package/scripts/finisher-halt-prose.test.mjs +0 -106
- package/scripts/finisher-name-prose.test.mjs +0 -134
- package/scripts/finisher-own-tree-prose.test.mjs +0 -299
- package/scripts/finisher-pin-race-prose.test.mjs +0 -339
- package/scripts/finisher-test-verdict-prose.test.mjs +0 -102
- package/scripts/fix-applier-correction-rules-prose.test.mjs +0 -202
- package/scripts/fix-applier-result-file-prose.test.mjs +0 -149
- package/scripts/fleet-bootstrap.test.mjs +0 -75
- package/scripts/fleet-heartbeat.test.mjs +0 -450
- package/scripts/fleet-provenance.test.mjs +0 -138
- package/scripts/fleet-run.test.mjs +0 -90
- package/scripts/fleet-state.test.mjs +0 -460
- package/scripts/fleet-tick-prose.test.mjs +0 -300
- package/scripts/fleet-tick.test.mjs +0 -2444
- package/scripts/force-with-lease-reason-prose.test.mjs +0 -184
- package/scripts/frontmatter-check.test.mjs +0 -436
- package/scripts/git-env.test.mjs +0 -149
- package/scripts/git-status-untracked-mode-sweep.test.mjs +0 -216
- package/scripts/gone-walk.test.mjs +0 -213
- package/scripts/gp-sep-invariant-prose.test.mjs +0 -188
- package/scripts/head-moved-after-label-prose.test.mjs +0 -233
- package/scripts/immutable-body-claim-prose.test.mjs +0 -204
- package/scripts/implementer-model-tier.test.mjs +0 -235
- package/scripts/inflight-citation-prose.test.mjs +0 -144
- package/scripts/inflight-exit2-prose.test.mjs +0 -81
- package/scripts/inflight-probe-guard-prose.test.mjs +0 -109
- package/scripts/inflight-scan-scope-prose.test.mjs +0 -57
- package/scripts/inflight.test.mjs +0 -2882
- package/scripts/injection-control-prose.test.mjs +0 -404
- package/scripts/install-root-audit.test.mjs +0 -464
- package/scripts/instrument-check-prose.test.mjs +0 -235
- package/scripts/instruments.test.mjs +0 -787
- package/scripts/is-cli.test.mjs +0 -99
- package/scripts/issue-tracker-prose.test.mjs +0 -71
- package/scripts/json.test.mjs +0 -364
- package/scripts/ledger-dispatch.test.mjs +0 -927
- package/scripts/ledger-grammar.test.mjs +0 -227
- package/scripts/ledger-read-require-file.test.mjs +0 -197
- package/scripts/ledger-rotate.test.mjs +0 -142
- package/scripts/ledger.test.mjs +0 -3436
- package/scripts/line-distance-prose.test.mjs +0 -245
- package/scripts/liveness-rationale-prose.test.mjs +0 -83
- package/scripts/locale-pin-prose.test.mjs +0 -189
- package/scripts/main-checkout.test.mjs +0 -332
- package/scripts/member-outcome-prose.test.mjs +0 -167
- package/scripts/member-outcomes-header.test.mjs +0 -129
- package/scripts/member-outcomes-prose.test.mjs +0 -63
- package/scripts/member-outcomes.test.mjs +0 -638
- package/scripts/member-prompt-prose.test.mjs +0 -165
- package/scripts/member-record.test.mjs +0 -541
- package/scripts/member-write-guard.test.mjs +0 -214
- package/scripts/merge-commit-probe-prose.test.mjs +0 -122
- package/scripts/merge-gate.test.mjs +0 -613
- package/scripts/muted-git-guard-sweep.test.mjs +0 -493
- package/scripts/net-ssh-precedence-prose.test.mjs +0 -91
- package/scripts/net-watchdog-prose.test.mjs +0 -79
- package/scripts/net.test.mjs +0 -211
- package/scripts/no-ci-gate-prose.test.mjs +0 -108
- package/scripts/no-undo-audit.test.mjs +0 -3961
- package/scripts/no-wave.test.mjs +0 -138
- package/scripts/node-floor-sweep.test.mjs +0 -611
- package/scripts/pointer-target-prose.test.mjs +0 -186
- package/scripts/pr-cost.test.mjs +0 -521
- package/scripts/pr-overlap.test.mjs +0 -692
- package/scripts/printf-die-sweep.test.mjs +0 -384
- package/scripts/prompt-renderer.mjs +0 -40
- package/scripts/prompt-renderer.test.mjs +0 -68
- package/scripts/prose-pin.mjs +0 -807
- package/scripts/prose-pin.test.mjs +0 -1034
- package/scripts/prove-merge.test.mjs +0 -995
- package/scripts/pull-table-relabel-prose.test.mjs +0 -60
- package/scripts/quiet-payload-prose.test.mjs +0 -222
- package/scripts/reap-cherry-check-prose.test.mjs +0 -80
- package/scripts/reap.test.mjs +0 -4432
- package/scripts/reaping-prose.test.mjs +0 -239
- package/scripts/reaping-reap-authorizers-prose.test.mjs +0 -112
- package/scripts/reaping-release-authorizers-prose.test.mjs +0 -85
- package/scripts/recipe-derivation-prose.test.mjs +0 -112
- package/scripts/recipe-prove.test.mjs +0 -1042
- package/scripts/refuter-scratch-prose.test.mjs +0 -135
- package/scripts/release-label-required-prose.test.mjs +0 -71
- package/scripts/release-label-split-prose.test.mjs +0 -184
- package/scripts/release-ticket-reap-pairing-prose.test.mjs +0 -63
- package/scripts/release-ticket.test.mjs +0 -5099
- package/scripts/renovate-release-contract.test.mjs +0 -379
- package/scripts/repo-root.test.mjs +0 -873
- package/scripts/reporter-output-rule-prose.test.mjs +0 -208
- package/scripts/review-agent-report-only.test.mjs +0 -49
- package/scripts/review-core-booking.test.mjs +0 -35
- package/scripts/review-core-cwd-isolation.test.mjs +0 -374
- package/scripts/review-core-reads.test.mjs +0 -478
- package/scripts/review-core-refuter-scratch.test.mjs +0 -148
- package/scripts/review-core-scratch-refusal.test.mjs +0 -64
- package/scripts/review-core-shared-test-run.test.mjs +0 -275
- package/scripts/review-core-snapshot-path.test.mjs +0 -830
- package/scripts/review-core-specialist-scratch.test.mjs +0 -191
- package/scripts/review-core-testcmd.test.mjs +0 -335
- package/scripts/review-core-unrun.test.mjs +0 -566
- package/scripts/review-core-unverified-discriminant.test.mjs +0 -208
- package/scripts/review-eval-resolver-path.test.mjs +0 -55
- package/scripts/review-host-fixture.mjs +0 -89
- package/scripts/review-in-run-retry.test.mjs +0 -211
- package/scripts/review-no-vendor-dispatch.test.mjs +0 -45
- package/scripts/review-path-default.test.mjs +0 -796
- package/scripts/review-runner-spawns.test.mjs +0 -95
- package/scripts/review-runner.test.mjs +0 -166
- package/scripts/review-tier-audit.test.mjs +0 -140
- package/scripts/run-artifact-pr-prose.test.mjs +0 -341
- package/scripts/run-merge-bot-prose.test.mjs +0 -1413
- package/scripts/run-team-local-hook.test.mjs +0 -442
- package/scripts/scratch-partition-invariant-prose.test.mjs +0 -74
- package/scripts/scripts-path-citation-sweep.test.mjs +0 -73
- package/scripts/section-between-guard-prose.test.mjs +0 -379
- package/scripts/select-dimensions.test.mjs +0 -674
- package/scripts/shared-refusal.test.mjs +0 -388
- package/scripts/shell-traps-prose.test.mjs +0 -504
- package/scripts/shortlist.test.mjs +0 -380
- package/scripts/slow-transport.mjs +0 -72
- package/scripts/snapshot-repo.test.mjs +0 -1006
- package/scripts/snapshot-runner-audience-prose.test.mjs +0 -130
- package/scripts/spend-view.test.mjs +0 -312
- package/scripts/staleness-qualifier-prose.test.mjs +0 -251
- package/scripts/staleness-verdict-prose.test.mjs +0 -142
- package/scripts/staleness.test.mjs +0 -893
- package/scripts/stalled-member-liveness-prose.test.mjs +0 -219
- package/scripts/stash-prohibition-prose.test.mjs +0 -313
- package/scripts/strip-comments.mjs +0 -44
- package/scripts/temp-dir.mjs +0 -47
- package/scripts/ticket-router.test.mjs +0 -981
- package/scripts/tier-check.test.mjs +0 -828
- package/scripts/tier-outcomes-header.test.mjs +0 -518
- package/scripts/tier-outcomes.test.mjs +0 -572
- package/scripts/tier-roles.test.mjs +0 -535
- package/scripts/tracker-block-copy-prose.test.mjs +0 -288
- package/scripts/triage-labels-gloss-prose.test.mjs +0 -97
- package/scripts/unattended-git-sweep.test.mjs +0 -142
- package/scripts/verify-sha-exit2-prose.test.mjs +0 -269
- package/scripts/verify-sha.test.mjs +0 -692
- package/scripts/watcher-degraded-block.test.mjs +0 -369
- package/scripts/watcher-key-prose.test.mjs +0 -106
- package/scripts/within-run-pair-prose.test.mjs +0 -212
- package/scripts/worktree-audit.test.mjs +0 -1408
- package/scripts/worktree-head-prose.test.mjs +0 -276
- package/scripts/worktree-listing-sweep.test.mjs +0 -217
- package/scripts/worktree-model-prose.test.mjs +0 -216
- package/scripts/worktree-porcelain.mjs +0 -35
- package/scripts/worktree-porcelain.test.mjs +0 -102
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { test } from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import { logicalLines } from "./prose-pin.mjs";
|
|
6
|
-
|
|
7
|
-
// #197. `review-and-fix.md` points at its own blocks by name — "see **X**" —
|
|
8
|
-
// and the emphasised block it names carried trailing content INSIDE the
|
|
9
|
-
// emphasis, so the name in the pointer was never the string on the target.
|
|
10
|
-
// That reads fine linearly and fails exactly one way: an agent that greps for
|
|
11
|
-
// the pointer string finds the pointer and nothing else, i.e. the citation
|
|
12
|
-
// resolves to itself. Same class as `citation-sweep-prose.test.mjs`, one
|
|
13
|
-
// document inward — there the citation was a line number, here it is a name.
|
|
14
|
-
//
|
|
15
|
-
// THE CEILING: this proves every pointer NAME resolves to a distinct target,
|
|
16
|
-
// nothing about the target being the right block or saying the right thing. A
|
|
17
|
-
// pointer renamed in lockstep with its target stays green, correctly. The
|
|
18
|
-
// pointer LIST is derived from the document rather than hardcoded, so a pointer
|
|
19
|
-
// added later is covered without editing this file — and so this file cannot
|
|
20
|
-
// satisfy its own pins. Only the floor under that list, `PINNED` below, is a
|
|
21
|
-
// literal, because a derived count cannot notice itself shrinking.
|
|
22
|
-
//
|
|
23
|
-
// #1609: both scans below run over the document's LOGICAL lines, never its
|
|
24
|
-
// physical ones. Every regex here is single-line by necessity — a clause must
|
|
25
|
-
// not run past its own paragraph, and a target must lead its block — so a
|
|
26
|
-
// rewrap of the runbook used to move the document out from under them: pure
|
|
27
|
-
// reflow of step 4, not one word changed, took the pointer list from 5 names
|
|
28
|
-
// to 3 and retired two pins by deleting them. `logicalLines` puts the wrap
|
|
29
|
-
// tolerance in the INPUT so the regexes keep their bounds; `lineAt` maps a hit
|
|
30
|
-
// back to the physical line a reader opens.
|
|
31
|
-
const REPO = join(import.meta.dirname, "..");
|
|
32
|
-
const DOC = "commands/review-and-fix.md";
|
|
33
|
-
const TEXT = readFileSync(join(REPO, DOC), "utf8");
|
|
34
|
-
|
|
35
|
-
// A pointer clause is `see` plus one or more emphasised names joined by `and`,
|
|
36
|
-
// `or` or a comma, either of the last two optionally preceded by a comma —
|
|
37
|
-
// `see **A**, **B**, and **C** below`. Without the optional comma the last name
|
|
38
|
-
// of an Oxford list is dropped and never pinned at all.
|
|
39
|
-
const CLAUSE = /[Ss]ee ((?:\*\*[^*\n]+\*\*)(?:(?:,? and|,? or|,) \*\*[^*\n]+\*\*)*)/g;
|
|
40
|
-
const BOLD = /\*\*([^*\n]+)\*\*/g;
|
|
41
|
-
|
|
42
|
-
// Both scans over ONE document, as a function rather than straight-line module
|
|
43
|
-
// scope: the reflow pin at the bottom has to run this exact extraction over a
|
|
44
|
-
// rewrapped copy, and a second local copy of the scan would pin only itself
|
|
45
|
-
// while the real one reverted to physical lines.
|
|
46
|
-
function scan(doc) {
|
|
47
|
-
const { text: SCAN, lineAt } = logicalLines(doc);
|
|
48
|
-
const pointers = [];
|
|
49
|
-
for (const clause of SCAN.matchAll(CLAUSE)) {
|
|
50
|
-
const base = clause.index + clause[0].indexOf(clause[1]);
|
|
51
|
-
for (const name of clause[1].matchAll(BOLD)) {
|
|
52
|
-
pointers.push({ text: name[1], offset: base + name.index, line: lineAt(base + name.index) });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// A target is a BLOCK, so only block-leading emphasis is one. Matching ANY
|
|
57
|
-
// emphasis here is what makes this suite stop discriminating: every bold span
|
|
58
|
-
// CLAUSE does not recognise as a pointer would register as a target, so one
|
|
59
|
-
// pointer resolves to another pointer and the file greens on exactly the
|
|
60
|
-
// defect #197 was filed for. The offset exclusion below is belt-and-braces —
|
|
61
|
-
// a clause always has `see ` before its first name, so a pointer is never
|
|
62
|
-
// block-leading — and it holds the invariant independently of this regex.
|
|
63
|
-
//
|
|
64
|
-
// Scanning the joined view is what makes `^` mean block-leading rather than
|
|
65
|
-
// wrap-leading: on the raw bytes, a `**Bold**` a reflow happens to push to
|
|
66
|
-
// column 0 mid-paragraph registers as a target, and a pointer then resolves
|
|
67
|
-
// to a block the wrap invented — the same reflow, failing green not red.
|
|
68
|
-
const pointerOffsets = new Set(pointers.map((p) => p.offset));
|
|
69
|
-
const targets = new Map();
|
|
70
|
-
for (const span of SCAN.matchAll(/^\*\*([^*\n]+)\*\*/gm)) {
|
|
71
|
-
if (pointerOffsets.has(span.index)) continue;
|
|
72
|
-
if (!targets.has(span[1])) targets.set(span[1], lineAt(span.index));
|
|
73
|
-
}
|
|
74
|
-
for (const heading of SCAN.matchAll(/^#{1,6} +(.+?)\s*$/gm)) {
|
|
75
|
-
if (!targets.has(heading[1])) targets.set(heading[1], lineAt(heading.index));
|
|
76
|
-
}
|
|
77
|
-
return { pointers, targets };
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const { pointers, targets } = scan(TEXT);
|
|
81
|
-
|
|
82
|
-
// The count, not merely non-emptiness: PARTIAL degradation is the real hole.
|
|
83
|
-
// Reword one clause's verb and that pointer's pin silently disappears while
|
|
84
|
-
// the survivors keep the suite green — measured, a single `see` → `consult`
|
|
85
|
-
// retires a pin with no signal at all. Bump this deliberately when a pointer
|
|
86
|
-
// is genuinely retired from the document; never to silence a red.
|
|
87
|
-
const PINNED = 5;
|
|
88
|
-
test("every pointer clause in the document is still recognised", () => {
|
|
89
|
-
assert.ok(
|
|
90
|
-
pointers.length >= PINNED,
|
|
91
|
-
`${DOC} yields ${pointers.length} pointer names, expected at least ${PINNED} — a drop means a pointer was rephrased OUT of the \`see **…**\` shape rather than removed from the document, so its pin below stopped running instead of failing. Restore the clause shape, or lower ${PINNED} only once you have confirmed the pointer is gone from ${DOC} for good.`,
|
|
92
|
-
);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
for (const p of pointers) {
|
|
96
|
-
test(`the pointer to "${p.text}" at :${p.line} resolves to a target`, () => {
|
|
97
|
-
assert.ok(
|
|
98
|
-
targets.has(p.text),
|
|
99
|
-
`${DOC}:${p.line} points at **${p.text}**, but no block in the file is emphasised as exactly that string — a literal search for the pointer finds only the pointer. Move any trailing punctuation or trailing clause OUTSIDE the target's \`**…**\` so the emphasised span is verbatim what the pointer names.`,
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// #1609, the pin the two above could not carry. Both of them read the document
|
|
105
|
-
// as it is checked in — one physical line per paragraph — so neither notices
|
|
106
|
-
// that every regex up there is `\n`-hostile by necessity. Measured against the
|
|
107
|
-
// physical-line scan this replaced, reflowing this file with not one word
|
|
108
|
-
// changed: at 80 columns the pointer list goes 5 names → 4, at 45 → 2, and
|
|
109
|
-
// the pins for the names it loses do not fail, they stop existing. Targets go
|
|
110
|
-
// the same way and vary more sharply by width, not a flat count — three
|
|
111
|
-
// block-leading `**…**` spans stop being targets at 80 columns, six at 60,
|
|
112
|
-
// and six again at 45, because the wrap lands inside the emphasis. At 45
|
|
113
|
-
// columns alone, up to four NEW ones also appear (`skipped`, `default`,
|
|
114
|
-
// `run-binding`, `critical/important`) because the wrap pushed a
|
|
115
|
-
// mid-paragraph bold to column 0. That last set is the silent direction: a
|
|
116
|
-
// pointer resolving to a block the reflow invented.
|
|
117
|
-
//
|
|
118
|
-
// Reflowed HERE rather than committed as a fixture: a checked-in rewrapped copy
|
|
119
|
-
// rots away from the real document the moment someone edits one and not the
|
|
120
|
-
// other, and this has to hold for the runbook's CURRENT words. The word-identity
|
|
121
|
-
// assert is what keeps the fixture honest — a `reflow` that garbled the text
|
|
122
|
-
// would make the comparison below trivially true against garbage on both sides.
|
|
123
|
-
// It is necessary and not sufficient: whitespace-normalised equality cannot see
|
|
124
|
-
// INDENT, and the first cut of this helper silently de-indented every wrapped
|
|
125
|
-
// paragraph's opening line while passing that assert. The target-set compare
|
|
126
|
-
// below is what caught it, which is the same thing it is here to catch.
|
|
127
|
-
const reflow = (text, cols) => {
|
|
128
|
-
const out = [];
|
|
129
|
-
let fenced = false;
|
|
130
|
-
for (const line of text.split("\n")) {
|
|
131
|
-
if (/^ {0,3}(?:```|~~~)/.test(line)) fenced = !fenced;
|
|
132
|
-
// A hard break is authored, not a wrap point — an editor does not reflow
|
|
133
|
-
// through one, and neither does `logicalLines`.
|
|
134
|
-
if (fenced || line.length <= cols || /(?:[ \t]{2}|\\)$/.test(line)) {
|
|
135
|
-
out.push(line);
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
// Two indents, not one. `lead` keeps the opening line where the author put
|
|
139
|
-
// it — dropping it promotes an indented continuation paragraph to a
|
|
140
|
-
// top-level one, a structural edit — and `indent` puts every wrapped line
|
|
141
|
-
// past a list marker, because wrapping a list item flush left would turn
|
|
142
|
-
// its tail into a new paragraph.
|
|
143
|
-
const lead = line.match(/^[ \t]*/)[0];
|
|
144
|
-
const indent = " ".repeat(line.match(/^(?:[ \t]*(?:[-*+]|\d+[.)])[ \t]+|[ \t]*)/)[0].length);
|
|
145
|
-
const words = line.slice(lead.length).split(" ").filter(Boolean);
|
|
146
|
-
let cur = lead + (words.shift() ?? "");
|
|
147
|
-
for (const word of words) {
|
|
148
|
-
if (`${cur} ${word}`.length > cols) {
|
|
149
|
-
out.push(cur);
|
|
150
|
-
cur = indent + word;
|
|
151
|
-
} else cur = `${cur} ${word}`;
|
|
152
|
-
}
|
|
153
|
-
out.push(cur);
|
|
154
|
-
}
|
|
155
|
-
return out.join("\n");
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
// Three widths: 80 is an ordinary editor wrap, 45 splits inside the emphasised
|
|
159
|
-
// names themselves, and 60 sits between and loses a DIFFERENT pointer than 80
|
|
160
|
-
// does. One width alone measures one accident of where the breaks landed.
|
|
161
|
-
for (const cols of [80, 60, 45]) {
|
|
162
|
-
test(`a pure reflow of ${DOC} at ${cols} columns changes no pointer and no target`, () => {
|
|
163
|
-
const rewrapped = reflow(TEXT, cols);
|
|
164
|
-
assert.notEqual(rewrapped, TEXT, `reflow at ${cols} columns changed nothing — this pin is not exercising a rewrap`);
|
|
165
|
-
assert.equal(
|
|
166
|
-
rewrapped.replace(/\s+/g, " ").trim(),
|
|
167
|
-
TEXT.replace(/\s+/g, " ").trim(),
|
|
168
|
-
"the reflow fixture changed the document's words, so the comparison below would prove nothing",
|
|
169
|
-
);
|
|
170
|
-
const after = scan(rewrapped);
|
|
171
|
-
assert.deepEqual(
|
|
172
|
-
after.pointers.map((p) => p.text),
|
|
173
|
-
pointers.map((p) => p.text),
|
|
174
|
-
`rewrapping ${DOC} at ${cols} columns changes which pointers this file finds — the scan is reading physical lines again, so an author who reflows a paragraph silently retires the pins for every pointer the wrap split.`,
|
|
175
|
-
);
|
|
176
|
-
// The other direction, and the one that fails GREEN: a target lost to the
|
|
177
|
-
// wrap takes its pointer's pin down as a spurious red, and a `**Bold**`
|
|
178
|
-
// that the wrap pushes to column 0 mid-paragraph is a target the reflow
|
|
179
|
-
// invented — one more block for a pointer to resolve to for free.
|
|
180
|
-
assert.deepEqual(
|
|
181
|
-
[...after.targets.keys()],
|
|
182
|
-
[...targets.keys()],
|
|
183
|
-
`rewrapping ${DOC} at ${cols} columns changes which blocks count as targets — block-leading emphasis is being read as "starts a physical line" rather than "starts a block".`,
|
|
184
|
-
);
|
|
185
|
-
});
|
|
186
|
-
}
|