@feigi/fleet-ctl 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +9 -0
- package/LICENSE +202 -0
- package/NOTICE +18 -0
- package/agents/fleet-finisher.agent.md +7 -0
- package/agents/fleet-implementer-alt.agent.md +210 -0
- package/agents/fleet-implementer.agent.md +210 -0
- package/agents/fleet-merge-bot.agent.md +7 -0
- package/agents/fleet-review-comments.agent.md +40 -0
- package/agents/fleet-review-correctness.agent.md +43 -0
- package/agents/fleet-review-runner.agent.md +73 -0
- package/agents/fleet-review-silent-failure.agent.md +49 -0
- package/agents/fleet-review-simplify.agent.md +46 -0
- package/agents/fleet-review-snapshot.agent.md +24 -0
- package/agents/fleet-review-tests.agent.md +46 -0
- package/agents/fleet-review-types.agent.md +41 -0
- package/agents/fleet-review-verifier.agent.md +29 -0
- package/commands/review-and-fix.md +98 -0
- package/commands/run-merge-bot.md +357 -0
- package/commands/run-team-help.md +17 -0
- package/package.json +23 -0
- package/scripts/agent-test-dir-prose.test.mjs +59 -0
- package/scripts/agent-test.test.mjs +1636 -0
- package/scripts/ambient-git-vars-mjs-prose.test.mjs +354 -0
- package/scripts/ambient-git-vars-prose.test.mjs +192 -0
- package/scripts/ancestry-check-position-prose.test.mjs +175 -0
- package/scripts/apply-ruleset.test.mjs +420 -0
- package/scripts/arg-header-probes-prose.test.mjs +393 -0
- package/scripts/arg.mjs +600 -0
- package/scripts/arg.test.mjs +1354 -0
- package/scripts/board-cli.test.mjs +694 -0
- package/scripts/board-identity.test.mjs +429 -0
- package/scripts/board-liveness-banner.test.mjs +119 -0
- package/scripts/board-prev-shape.test.mjs +229 -0
- package/scripts/board-tryparse-null.test.mjs +119 -0
- package/scripts/board.html +471 -0
- package/scripts/board.mjs +2037 -0
- package/scripts/board.test.mjs +3086 -0
- package/scripts/brief-after-cut-prose.test.mjs +53 -0
- package/scripts/candidates-exit3-prose.test.mjs +302 -0
- package/scripts/candidates.mjs +674 -0
- package/scripts/candidates.test.mjs +2101 -0
- package/scripts/caveat-unification-prose.test.mjs +98 -0
- package/scripts/ci-comment-rot-prose.test.mjs +2025 -0
- package/scripts/ci-completes-premise-prose.test.mjs +257 -0
- package/scripts/ci-state-prose.test.mjs +113 -0
- package/scripts/ci-state.mjs +761 -0
- package/scripts/ci-state.test.mjs +1640 -0
- package/scripts/ci-vacuous-green.test.mjs +368 -0
- package/scripts/citation-sweep-prose.test.mjs +1572 -0
- package/scripts/claim-lifecycle.test.mjs +185 -0
- package/scripts/claim-ticket.sh +417 -0
- package/scripts/claim-ticket.test.mjs +1121 -0
- package/scripts/closing-keyword-prose.test.mjs +193 -0
- package/scripts/cockpit-launch-idempotent-prose.test.mjs +165 -0
- package/scripts/cockpit-tick-nonblocking.test.mjs +210 -0
- package/scripts/compute-board.mjs +579 -0
- package/scripts/compute-board.test.mjs +1060 -0
- package/scripts/compute-spend.mjs +329 -0
- package/scripts/compute-spend.test.mjs +451 -0
- package/scripts/cross-repo-citation-prose.test.mjs +156 -0
- package/scripts/cwd-isolation-pins.mjs +83 -0
- package/scripts/dedupe-guard-prose.test.mjs +243 -0
- package/scripts/derive-testcmd.sh +239 -0
- package/scripts/derive-testcmd.test.mjs +380 -0
- package/scripts/diff-stats.mjs +231 -0
- package/scripts/diff-stats.test.mjs +408 -0
- package/scripts/dispatch-block-golden-prose.test.mjs +1024 -0
- package/scripts/dispatch-block-pins-prose.test.mjs +615 -0
- package/scripts/drop-merged-label.sh +173 -0
- package/scripts/drop-merged-label.test.mjs +480 -0
- package/scripts/expected-jobs-prose.test.mjs +80 -0
- package/scripts/filing-bar-seat-prose.test.mjs +242 -0
- package/scripts/filing-claim-bar-prose.test.mjs +166 -0
- package/scripts/finisher-dispatch-premise-prose.test.mjs +312 -0
- package/scripts/finisher-halt-prose.test.mjs +106 -0
- package/scripts/finisher-name-prose.test.mjs +134 -0
- package/scripts/finisher-own-tree-prose.test.mjs +285 -0
- package/scripts/finisher-pin-race-prose.test.mjs +339 -0
- package/scripts/fix-applier-correction-rules-prose.test.mjs +201 -0
- package/scripts/fix-applier-result-file-prose.test.mjs +100 -0
- package/scripts/fleet-bootstrap +155 -0
- package/scripts/fleet-heartbeat.mjs +272 -0
- package/scripts/fleet-heartbeat.test.mjs +450 -0
- package/scripts/fleet-provenance +207 -0
- package/scripts/fleet-provenance.test.mjs +64 -0
- package/scripts/fleet-run +148 -0
- package/scripts/fleet-run.test.mjs +90 -0
- package/scripts/fleet-state.mjs +400 -0
- package/scripts/fleet-state.test.mjs +373 -0
- package/scripts/fleet-tick-prose.test.mjs +299 -0
- package/scripts/fleet-tick.mjs +832 -0
- package/scripts/fleet-tick.test.mjs +1332 -0
- package/scripts/force-with-lease-reason-prose.test.mjs +184 -0
- package/scripts/frontmatter-allowlist.json +64 -0
- package/scripts/frontmatter-check.mjs +256 -0
- package/scripts/frontmatter-check.test.mjs +436 -0
- package/scripts/git-env.mjs +124 -0
- package/scripts/git-env.test.mjs +149 -0
- package/scripts/git-status-untracked-mode-sweep.test.mjs +216 -0
- package/scripts/gone-walk.test.mjs +213 -0
- package/scripts/gp-sep-invariant-prose.test.mjs +188 -0
- package/scripts/head-moved-after-label-prose.test.mjs +233 -0
- package/scripts/immutable-body-claim-prose.test.mjs +413 -0
- package/scripts/implementer-model-tier.test.mjs +643 -0
- package/scripts/inflight-citation-prose.test.mjs +144 -0
- package/scripts/inflight-exit2-prose.test.mjs +81 -0
- package/scripts/inflight-probe-guard-prose.test.mjs +109 -0
- package/scripts/inflight-scan-scope-prose.test.mjs +57 -0
- package/scripts/inflight.sh +1106 -0
- package/scripts/inflight.test.mjs +2984 -0
- package/scripts/injection-control-prose.test.mjs +404 -0
- package/scripts/install-root-audit.test.mjs +464 -0
- package/scripts/instrument-check-prose.test.mjs +235 -0
- package/scripts/instruments.sh +394 -0
- package/scripts/instruments.test.mjs +787 -0
- package/scripts/issue-tracker-prose.test.mjs +71 -0
- package/scripts/json.sh +248 -0
- package/scripts/json.test.mjs +364 -0
- package/scripts/ledger-dispatch.test.mjs +516 -0
- package/scripts/ledger-grammar.mjs +85 -0
- package/scripts/ledger-grammar.test.mjs +142 -0
- package/scripts/ledger-read-require-file.test.mjs +197 -0
- package/scripts/ledger.mjs +1753 -0
- package/scripts/ledger.test.mjs +3554 -0
- package/scripts/line-distance-prose.test.mjs +245 -0
- package/scripts/liveness-rationale-prose.test.mjs +83 -0
- package/scripts/locale-pin-prose.test.mjs +189 -0
- package/scripts/member-outcome-prose.test.mjs +167 -0
- package/scripts/member-outcomes-header.test.mjs +148 -0
- package/scripts/member-outcomes-prose.test.mjs +63 -0
- package/scripts/member-outcomes.mjs +231 -0
- package/scripts/member-outcomes.test.mjs +507 -0
- package/scripts/member-prompt-prose.test.mjs +161 -0
- package/scripts/member-record.mjs +605 -0
- package/scripts/member-record.test.mjs +516 -0
- package/scripts/member-write-guard.mjs +279 -0
- package/scripts/member-write-guard.test.mjs +211 -0
- package/scripts/merge-commit-probe-prose.test.mjs +122 -0
- package/scripts/merge-gate.mjs +262 -0
- package/scripts/merge-gate.test.mjs +613 -0
- package/scripts/muted-git-guard-sweep.test.mjs +493 -0
- package/scripts/net-ssh-precedence-prose.test.mjs +91 -0
- package/scripts/net-watchdog-prose.test.mjs +79 -0
- package/scripts/net.sh +409 -0
- package/scripts/net.test.mjs +211 -0
- package/scripts/no-ci-gate-prose.test.mjs +108 -0
- package/scripts/no-undo-audit.sh +1134 -0
- package/scripts/no-undo-audit.test.mjs +3965 -0
- package/scripts/no-wave.test.mjs +138 -0
- package/scripts/node-floor-sweep.test.mjs +611 -0
- package/scripts/pointer-target-prose.test.mjs +186 -0
- package/scripts/pr-overlap.mjs +417 -0
- package/scripts/pr-overlap.test.mjs +695 -0
- package/scripts/printf-die-sweep.test.mjs +384 -0
- package/scripts/prompt-renderer.mjs +39 -0
- package/scripts/prompt-renderer.test.mjs +68 -0
- package/scripts/prose-pin.mjs +808 -0
- package/scripts/prose-pin.test.mjs +1034 -0
- package/scripts/prove-merge.sh +228 -0
- package/scripts/prove-merge.test.mjs +995 -0
- package/scripts/pull-table-relabel-prose.test.mjs +60 -0
- package/scripts/quiet-payload-prose.test.mjs +222 -0
- package/scripts/reap.sh +1768 -0
- package/scripts/reap.test.mjs +4395 -0
- package/scripts/reaping-prose.test.mjs +159 -0
- package/scripts/refuter-scratch-prose.test.mjs +135 -0
- package/scripts/release-label-required-prose.test.mjs +71 -0
- package/scripts/release-label-split-prose.test.mjs +169 -0
- package/scripts/release-ticket.sh +1716 -0
- package/scripts/release-ticket.test.mjs +5106 -0
- package/scripts/renovate-release-contract.test.mjs +379 -0
- package/scripts/repo-root.mjs +544 -0
- package/scripts/repo-root.test.mjs +873 -0
- package/scripts/reporter-output-rule-prose.test.mjs +208 -0
- package/scripts/review-agent-report-only.test.mjs +49 -0
- package/scripts/review-core-cwd-isolation.test.mjs +374 -0
- package/scripts/review-core-reads.test.mjs +478 -0
- package/scripts/review-core-refuter-scratch.test.mjs +148 -0
- package/scripts/review-core-snapshot-path.test.mjs +777 -0
- package/scripts/review-core-specialist-scratch.test.mjs +189 -0
- package/scripts/review-core-testcmd.test.mjs +288 -0
- package/scripts/review-core-unrun.test.mjs +530 -0
- package/scripts/review-core-unverified-discriminant.test.mjs +208 -0
- package/scripts/review-core.mjs +1028 -0
- package/scripts/review-eval-resolver-path.test.mjs +55 -0
- package/scripts/review-eval.mjs +197 -0
- package/scripts/review-host-fixture.mjs +73 -0
- package/scripts/review-in-run-retry.test.mjs +187 -0
- package/scripts/review-no-vendor-dispatch.test.mjs +45 -0
- package/scripts/review-path-default.test.mjs +796 -0
- package/scripts/review-runner-spawns.test.mjs +93 -0
- package/scripts/review-runner.test.mjs +155 -0
- package/scripts/review-tier-audit.test.mjs +140 -0
- package/scripts/run-artifact-pr-prose.test.mjs +341 -0
- package/scripts/run-merge-bot-prose.test.mjs +1391 -0
- package/scripts/scratch-partition-invariant-prose.test.mjs +74 -0
- package/scripts/scripts-path-citation-sweep.test.mjs +73 -0
- package/scripts/section-between-guard-prose.test.mjs +378 -0
- package/scripts/select-dimensions.test.mjs +674 -0
- package/scripts/shared-refusal.test.mjs +388 -0
- package/scripts/shell-traps-prose.test.mjs +507 -0
- package/scripts/shortlist.mjs +355 -0
- package/scripts/shortlist.test.mjs +366 -0
- package/scripts/slow-transport.mjs +72 -0
- package/scripts/snapshot-repo.test.mjs +772 -0
- package/scripts/snapshot-runner-audience-prose.test.mjs +129 -0
- package/scripts/spend-view.test.mjs +312 -0
- package/scripts/staleness-qualifier-prose.test.mjs +251 -0
- package/scripts/staleness-verdict-prose.test.mjs +142 -0
- package/scripts/staleness.mjs +414 -0
- package/scripts/staleness.test.mjs +893 -0
- package/scripts/stalled-member-liveness-prose.test.mjs +219 -0
- package/scripts/stash-prohibition-prose.test.mjs +313 -0
- package/scripts/strip-comments.mjs +44 -0
- package/scripts/tier-check.mjs +468 -0
- package/scripts/tier-check.test.mjs +726 -0
- package/scripts/tier-guard-gate-prose.test.mjs +216 -0
- package/scripts/tier-outcomes-header.test.mjs +586 -0
- package/scripts/tier-outcomes.mjs +441 -0
- package/scripts/tier-outcomes.test.mjs +342 -0
- package/scripts/tier-roles.mjs +250 -0
- package/scripts/tier-roles.test.mjs +316 -0
- package/scripts/tracker-block-copy-prose.test.mjs +288 -0
- package/scripts/triage-labels-gloss-prose.test.mjs +97 -0
- package/scripts/unattended-git-sweep.test.mjs +142 -0
- package/scripts/verify-sha-exit2-prose.test.mjs +269 -0
- package/scripts/verify-sha.sh +117 -0
- package/scripts/verify-sha.test.mjs +693 -0
- package/scripts/watcher-degraded-block.test.mjs +372 -0
- package/scripts/watcher-key-prose.test.mjs +106 -0
- package/scripts/within-run-pair-prose.test.mjs +208 -0
- package/scripts/worktree-audit.sh +482 -0
- package/scripts/worktree-audit.test.mjs +1407 -0
- package/scripts/worktree-head-prose.test.mjs +276 -0
- package/scripts/worktree-listing-sweep.test.mjs +217 -0
- package/scripts/worktree-model-prose.test.mjs +216 -0
- package/scripts/worktree.sh +470 -0
- package/skills/next-ticket/SKILL.md +138 -0
- package/skills/run-team/SKILL.md +3603 -0
- package/skills/run-team/references/ci-and-staleness.md +75 -0
- package/skills/run-team/references/correction-tickets.md +37 -0
- package/skills/run-team/references/isolation.md +23 -0
- package/skills/run-team/references/member-lifecycle.md +73 -0
- package/skills/run-team/references/reaping.md +73 -0
- package/skills/sizing-a-ticket/SKILL.md +39 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// #847. The comment introducing ci-state.mjs's expected-job derivation carried
|
|
2
|
+
// figures — how many jobs "the fleet's prose" names, how many "the workflow"
|
|
3
|
+
// defines. What a reader checking whether an empty `missing` is vacuous needs
|
|
4
|
+
// from that comment is the PROPERTY: the list is derived from the workflow this
|
|
5
|
+
// run resolved, never hardcoded. This file pins that claim, with its polarity.
|
|
6
|
+
//
|
|
7
|
+
// It does not ban a job count. The ban it once carried refused every cardinal
|
|
8
|
+
// sharing a sentence with "job" — "3 workers", "job 2 of a matrix build" (#1194)
|
|
9
|
+
// — and still let a count spelled above ten through (#1193). The list is
|
|
10
|
+
// derived, so a stale count in this comment misleads a reader and changes no
|
|
11
|
+
// behaviour, and the comment itself says why it names no set. A pin that reds
|
|
12
|
+
// on legitimate prose to police a figure that moves nothing costs more than the
|
|
13
|
+
// figure.
|
|
14
|
+
//
|
|
15
|
+
// THE CEILING: this reds when no comment introduces expectedJobs(), and when the
|
|
16
|
+
// comment stops claiming the list is derived or never hardcoded. It cannot prove
|
|
17
|
+
// the surrounding argument sound, and it never runs ci-state.mjs —
|
|
18
|
+
// ci-state.test.mjs owns the derivation's behavior.
|
|
19
|
+
|
|
20
|
+
import { test } from "node:test";
|
|
21
|
+
import assert from "node:assert/strict";
|
|
22
|
+
import { readFileSync } from "node:fs";
|
|
23
|
+
import { fileURLToPath } from "node:url";
|
|
24
|
+
|
|
25
|
+
const CI_STATE = readFileSync(fileURLToPath(new URL("./ci-state.mjs", import.meta.url)), "utf8");
|
|
26
|
+
|
|
27
|
+
// The ARGUED comment introducing the derivation: the contiguous `//` run directly
|
|
28
|
+
// above `function expectedJobs(`, stopping below the `// --- … ---` section
|
|
29
|
+
// banner. ci-state.mjs discusses jobs, workflows and derivation in neighbouring
|
|
30
|
+
// comments, so a match over the file would stay green with this block gutted —
|
|
31
|
+
// satisfied entirely by prose the rule does not govern. The banner is that same
|
|
32
|
+
// hole one line closer: it says "derived" by itself, so including it would let
|
|
33
|
+
// the whole argued comment be deleted with the derivation half still satisfied.
|
|
34
|
+
// Stopping at the first non-comment line also means a block moved away from
|
|
35
|
+
// expectedJobs() reds here rather than silently widening the slice back to the
|
|
36
|
+
// file.
|
|
37
|
+
function derivationComment() {
|
|
38
|
+
const at = CI_STATE.indexOf("function expectedJobs(");
|
|
39
|
+
assert.notEqual(at, -1, "expectedJobs() moved or was renamed — update this test");
|
|
40
|
+
const lines = CI_STATE.slice(0, at).split("\n");
|
|
41
|
+
const block = [];
|
|
42
|
+
for (let i = lines.length - 2; i >= 0 && /^\s*\/\//.test(lines[i]) && !/^\s*\/\/\s*---/.test(lines[i]); i--) {
|
|
43
|
+
block.unshift(lines[i].replace(/^\s*\/\/\s?/, ""));
|
|
44
|
+
}
|
|
45
|
+
assert.notEqual(block.length, 0, "no comment introduces expectedJobs() any more — #847 asked for one that states the property");
|
|
46
|
+
return block.join(" ").replace(/\s+/g, " ");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The rule, as a function so the refuse cases can be fed prose this repo does
|
|
51
|
+
* not contain. Returns null when the comment is sound, else the reason.
|
|
52
|
+
*/
|
|
53
|
+
export function derivationCommentFault(comment) {
|
|
54
|
+
// The NEGATED form, not the bare word, on BOTH sides: `hardcoded` alone is
|
|
55
|
+
// polarity-blind, and so is `deriv` alone — a comment asserting the list IS
|
|
56
|
+
// hardcoded, or that it is NOT derived, is the exact fault this refuses.
|
|
57
|
+
const derivedSound = /\bderiv/i.test(comment) && !/\b(?:never|not)\s+deriv/i.test(comment);
|
|
58
|
+
const hardcodedSound = /\b(?:never|not)\s+hardcoded/i.test(comment);
|
|
59
|
+
if (!derivedSound && !hardcodedSound) {
|
|
60
|
+
return "the expected-job comment no longer says the list is derived from the workflow rather than hardcoded — the one thing a reader checking whether an empty `missing` is vacuous needs from it";
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
test("the expected-job comment says the list is derived, never hardcoded", () => {
|
|
66
|
+
assert.equal(derivationCommentFault(derivationComment()), null);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// What the rule REFUSES, which the test above cannot show: a comment that drops
|
|
70
|
+
// the claim, and one that reverses it.
|
|
71
|
+
test("a comment that drops or reverses the derivation claim is refused", () => {
|
|
72
|
+
assert.equal(derivationCommentFault("Never hardcoded: expectedJobs() parses the `jobs:` block of the workflow file this run resolved."), null);
|
|
73
|
+
assert.equal(derivationCommentFault("Derived from the workflow, which defines 5 jobs."), null);
|
|
74
|
+
assert.match(derivationCommentFault("The list tracks the workflow file automatically."), /no longer says the list is derived/);
|
|
75
|
+
// Polarity: asserting the list IS hardcoded must refuse, not satisfy.
|
|
76
|
+
assert.match(derivationCommentFault("The expected job list is hardcoded below because the workflow never changes."), /no longer says the list is derived/);
|
|
77
|
+
// Polarity, the other direction: asserting the list is NOT derived must
|
|
78
|
+
// refuse too, not slip through on the bare `deriv` substring match.
|
|
79
|
+
assert.match(derivationCommentFault("This list is not derived from anything; it is fully hardcoded for performance."), /no longer says the list is derived/);
|
|
80
|
+
});
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
// #239. `decided?` is a correct test that was running in the wrong seat.
|
|
2
|
+
// `review-and-fix.md` step 5 sent the FILER to `run-team/SKILL.md` phase 0's
|
|
3
|
+
// criterion, importing phase 0's cost model — where implementer divergence
|
|
4
|
+
// costs a claim, a worktree and a dispatch — into a seat where divergence costs
|
|
5
|
+
// one PR review the maintainer already runs. Same test, two seats, opposite
|
|
6
|
+
// correct answers. The ruling and its reasoning are ADR 0001.
|
|
7
|
+
//
|
|
8
|
+
// What this pins is the SPLIT, which lives in the join between two documents
|
|
9
|
+
// read by two different agents. Neither file is wrong on its own after a
|
|
10
|
+
// revert: step 5 can go back to delegating and phase 0 will still be a
|
|
11
|
+
// perfectly good consumption gate, and nothing else in the tree notices. That
|
|
12
|
+
// is why the pin is here rather than inside either file's existing suite.
|
|
13
|
+
//
|
|
14
|
+
// Slices are flattened. `run-team/SKILL.md` hard-wraps at ~80 columns, so every
|
|
15
|
+
// literal space in these phrases may be a newline plus indent; `review-and-fix.md`
|
|
16
|
+
// authors one long line per step today, which makes `flat()` a no-op there
|
|
17
|
+
// until the day someone wraps it. Reflow-brittleness is a class defect in this
|
|
18
|
+
// repo's prose pins, so both are flattened whether or not a width reds today.
|
|
19
|
+
//
|
|
20
|
+
// CEILING: presence and adjacency over bounded slices. These prove the rule is
|
|
21
|
+
// stated and that its inverse is not; they cannot prove a later sentence in the
|
|
22
|
+
// same slice does not carve out an exception.
|
|
23
|
+
//
|
|
24
|
+
// Measured as of this commit, on an isolated copy of the four files: 12 semantic
|
|
25
|
+
// mutations — both label branches inverted, the torn tie-break deleted and
|
|
26
|
+
// exception-spliced, the delegation restored, the gate sentence deleted and
|
|
27
|
+
// stripped of its seat pricing, the ADR pointer renamed on one side, the guard
|
|
28
|
+
// floor and trigger each retuned, complements swapped to supersedes, and the
|
|
29
|
+
// apply/label roles swapped — each reddened its own pin and no other. Nine
|
|
30
|
+
// controls stayed green: the gate paragraph rewrapped at 70/100/140 and by
|
|
31
|
+
// `fmt(1)`, the guard bullets and step 5 rewrapped, an unpinned step-5 sentence
|
|
32
|
+
// reworded, and an ADR heading reworded. Re-derive after any edit to these
|
|
33
|
+
// slices; a rationale indexed to wording rots with the wording.
|
|
34
|
+
import { test } from "node:test";
|
|
35
|
+
import assert from "node:assert/strict";
|
|
36
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
37
|
+
import { join } from "node:path";
|
|
38
|
+
import { between, phrase } from "./prose-pin.mjs";
|
|
39
|
+
|
|
40
|
+
const REPO = join(import.meta.dirname, "..");
|
|
41
|
+
const read = (...p) => readFileSync(join(REPO, ...p), "utf8");
|
|
42
|
+
const RUN_TEAM = read("skills", "run-team", "SKILL.md");
|
|
43
|
+
const REVIEW_AND_FIX = read("commands", "review-and-fix.md");
|
|
44
|
+
const ROOT = join(import.meta.dirname, "..", "..");
|
|
45
|
+
const readRoot = (...p) => readFileSync(join(ROOT, ...p), "utf8");
|
|
46
|
+
|
|
47
|
+
const flat = (s) => s.replace(/\s+/g, " ");
|
|
48
|
+
|
|
49
|
+
const step5 = () => flat(between(REVIEW_AND_FIX, "5. File each deferred finding", "\n6. Diff-check green", "review-and-fix step 5"));
|
|
50
|
+
// Bounded by the two phase-0 markers that bracket the note, never by the note
|
|
51
|
+
// itself: anchoring on the sentence under test turns its deletion into a
|
|
52
|
+
// slicing error rather than a failed assertion.
|
|
53
|
+
const decidedNote = () => flat(between(RUN_TEAM, "**Torn → surface, never guess**", "**Class?**", "run-team phase 0 decided? note"));
|
|
54
|
+
|
|
55
|
+
test("step 5 routes a confirmed defect with an open remedy to ready-for-agent", () => {
|
|
56
|
+
const s = step5();
|
|
57
|
+
// The MAPPING, not the two labels. Both label strings occur in this slice
|
|
58
|
+
// whichever way the rule points, so a pin on either alone stays green with
|
|
59
|
+
// the branches swapped. `needs-triage` is excluded from the gap and `[^.]`
|
|
60
|
+
// keeps the match inside one sentence.
|
|
61
|
+
assert.match(
|
|
62
|
+
s,
|
|
63
|
+
/Confirmed defect with the remedy still open(?:(?!needs-triage)[^.])*?ready-for-agent/,
|
|
64
|
+
"step 5 no longer sends a confirmed defect with an open remedy to `ready-for-agent`",
|
|
65
|
+
);
|
|
66
|
+
// The tie-break and its narrowed meaning are ONE claim: `torn → needs-triage`
|
|
67
|
+
// survived the reprice only because torn was redefined to "unsure anything is
|
|
68
|
+
// broken". Pinned as a contiguous span, because two separate matches would
|
|
69
|
+
// leave the join open — an exception clause spliced between them reverses the
|
|
70
|
+
// rule and satisfies both.
|
|
71
|
+
assert.match(
|
|
72
|
+
s,
|
|
73
|
+
phrase("Torn → `needs-triage`, narrowed: torn means **unsure anything is broken**, not unsure how to fix it."),
|
|
74
|
+
"step 5 lost the narrowed torn tie-break, so `needs-triage` is back to meaning `unsure how to fix it`",
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("step 5 states its own bar instead of delegating to phase 0's criterion", () => {
|
|
79
|
+
const s = step5();
|
|
80
|
+
// The positive companion. A bare negative on `decided?` would be vacuous here
|
|
81
|
+
// by construction — step 5 names the test deliberately, in order to rule it
|
|
82
|
+
// out — so what is pinned is the sentence that rules it out.
|
|
83
|
+
assert.match(
|
|
84
|
+
s,
|
|
85
|
+
phrase("Do **not** reach for phase 0's **decided?** test here."),
|
|
86
|
+
"step 5 no longer tells the filer to leave phase 0's `decided?` test alone",
|
|
87
|
+
);
|
|
88
|
+
// The superseded delegation, verbatim from the text 6d0c1f6 replaced.
|
|
89
|
+
// Verified zero occurrences in the current file.
|
|
90
|
+
assert.doesNotMatch(
|
|
91
|
+
s,
|
|
92
|
+
phrase("read the criterion there rather than re-deriving it here"),
|
|
93
|
+
"step 5 delegates the label choice back to phase 0 — the two seats have re-collided",
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("phase 0 marks decided? as a consumption gate and names an ADR that exists", () => {
|
|
98
|
+
const s = decidedNote();
|
|
99
|
+
// Contiguous span again: "consumption gate" and "the filing-time counterpart
|
|
100
|
+
// was repriced" pin nothing apart. The gate label is only meaningful bound to
|
|
101
|
+
// the seat it is priced for and to the counterpart that is priced differently.
|
|
102
|
+
assert.match(
|
|
103
|
+
s,
|
|
104
|
+
phrase(
|
|
105
|
+
"**This is a consumption gate**, priced for the seat where implementer divergence costs a claim, a worktree and a dispatch; the filing-time counterpart was repriced to *is the defect confirmed* and states its own bar inline",
|
|
106
|
+
),
|
|
107
|
+
"phase 0's `decided?` note no longer marks it a consumption gate with a repriced filing-time counterpart",
|
|
108
|
+
);
|
|
109
|
+
// Read the path out of the prose rather than restating it, so a rename that
|
|
110
|
+
// updates only one side reds. A pointer into a document that is not there
|
|
111
|
+
// fails silently for every reader.
|
|
112
|
+
const [, adr] = s.match(/see `(docs\/adr\/[^`]+)`/) ?? [];
|
|
113
|
+
assert.ok(adr, "phase 0's `decided?` note no longer points at an ADR under `docs/adr/`");
|
|
114
|
+
assert.ok(existsSync(join(ROOT, adr)), `phase 0 points at \`${adr}\`, which does not exist`);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test("the ADR keeps its pre-chosen guard and its #211 relationship", () => {
|
|
118
|
+
const adr = flat(readRoot("docs", "adr", "0001-filing-label-bar-is-defect-confirmed.md"));
|
|
119
|
+
// Floor and trigger as one span. Chosen before any data, on the tier guard's
|
|
120
|
+
// precedent, so that a later run cannot derive a threshold that happens to
|
|
121
|
+
// clear the number in front of it. Separate pins would let either be retuned
|
|
122
|
+
// alone.
|
|
123
|
+
assert.match(
|
|
124
|
+
adr,
|
|
125
|
+
phrase(
|
|
126
|
+
"**Floor:** 20 deferrals filed across at least 3 distinct run dates after this decision lands. - **Trigger:** `needs-triage` still taking more than half of them.",
|
|
127
|
+
),
|
|
128
|
+
"the ADR's guard floor or trigger moved — a pre-chosen guard that is retuned later is not a guard",
|
|
129
|
+
);
|
|
130
|
+
// The conflation this ADR exists to stop, pinned in both halves: the verdict
|
|
131
|
+
// and the division of labour it rests on. Swapping `applied` and `labelled`
|
|
132
|
+
// reds the second while the first stays green, so both are asserted.
|
|
133
|
+
assert.match(
|
|
134
|
+
adr,
|
|
135
|
+
phrase("This decision **complements #211 and does not supersede it.**"),
|
|
136
|
+
"the ADR no longer states that it complements #211 rather than superseding it",
|
|
137
|
+
);
|
|
138
|
+
assert.match(
|
|
139
|
+
adr,
|
|
140
|
+
phrase("#211 governs what gets **applied**; this governs what gets **labelled**"),
|
|
141
|
+
"the ADR no longer separates #211's apply policy from this decision's label policy",
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// #839. ADR 0001's guard pre-chose a floor and a trigger but never said WHICH
|
|
146
|
+
// POPULATION the trigger measures — open issues only, or open and closed
|
|
147
|
+
// together. Both readings are available from the same text and they do not
|
|
148
|
+
// agree: a refuted deferral filed as `needs-triage` and later closed is in the
|
|
149
|
+
// denominator under one and absent under the other. An undefined input surface
|
|
150
|
+
// hands back exactly the discretion a pre-chosen guard exists to remove — the
|
|
151
|
+
// evaluator picks the population and the population picks the verdict.
|
|
152
|
+
//
|
|
153
|
+
// Ruled open AND closed on #839. The reason is pinned WITH the ruling, in one
|
|
154
|
+
// contiguous span, because a bare ruling is re-derivable against itself: a later
|
|
155
|
+
// reader who finds open-only more convenient can restore it from a text that
|
|
156
|
+
// never says why it was rejected. Same reason the pre-chosen-guard test pins
|
|
157
|
+
// the floor and the trigger as one span rather than two.
|
|
158
|
+
//
|
|
159
|
+
// CEILING: presence and contiguity over one bounded section. This proves the
|
|
160
|
+
// clause is stated and that its reason travels with it; it cannot prove a
|
|
161
|
+
// sentence elsewhere in the ADR does not carve out an exception.
|
|
162
|
+
const guardSection = (text) =>
|
|
163
|
+
flat(between(text, "## The guard — floor and trigger, chosen before any data", "\n## Relationship to #211", "ADR 0001 guard section"));
|
|
164
|
+
|
|
165
|
+
// The ruling and its reason as ONE phrase, wrap-tolerant. Reworded on purpose →
|
|
166
|
+
// update this string. Do not delete the pin to clear the red.
|
|
167
|
+
const POPULATION = phrase(
|
|
168
|
+
"**Population:** open **and** closed issues together, never open alone. The trigger measures filing behaviour, and a refuted deferral filed as `needs-triage` and later closed counts under one reading and vanishes under the other — so under open-only any triage pass that reads the backlog improves the ratio without one filing having changed. A guard on the filing bar must not be satisfiable by triaging the queue.",
|
|
169
|
+
);
|
|
170
|
+
// The population made operational. A prose ruling the evaluator's own command
|
|
171
|
+
// contradicts is not a ruling, and `--state all` is the single token that
|
|
172
|
+
// carries it.
|
|
173
|
+
const STATE_ALL = phrase("--state all");
|
|
174
|
+
// The as-of duty. Per this ADR's own rule, a count off an append-only tracker
|
|
175
|
+
// rots on the next filing, so the date the count was taken is part of the count.
|
|
176
|
+
const AS_OF = phrase("record the date taken with the verdict");
|
|
177
|
+
|
|
178
|
+
// Presence alone doesn't defend a pin: a mutant can wrap the matched span in
|
|
179
|
+
// markdown strikethrough or drop a negating sentence right after it, and a
|
|
180
|
+
// bare `.test()` still finds every pinned word in order. Bound the match's own
|
|
181
|
+
// surroundings too, not just its content.
|
|
182
|
+
const notNeutralized = (s) => {
|
|
183
|
+
const m = s.match(POPULATION);
|
|
184
|
+
if (!m) return true; // population pin already reports the clause missing; don't double-fire
|
|
185
|
+
const before = s.slice(Math.max(0, m.index - 5), m.index);
|
|
186
|
+
const after = s.slice(m.index + m[0].length, m.index + m[0].length + 200);
|
|
187
|
+
return !/~~/.test(before + after) && !/Superseded/i.test(after);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const guardPins = {
|
|
191
|
+
population: (s) => !POPULATION.test(s),
|
|
192
|
+
stateAll: (s) => !STATE_ALL.test(s),
|
|
193
|
+
asOf: (s) => !AS_OF.test(s),
|
|
194
|
+
notNeutralized: (s) => !notNeutralized(s),
|
|
195
|
+
};
|
|
196
|
+
const guardFiring = (s) => Object.keys(guardPins).filter((n) => guardPins[n](s));
|
|
197
|
+
|
|
198
|
+
test("the guard names the population its trigger measures, and why", () => {
|
|
199
|
+
const s = guardSection(readRoot("docs", "adr", "0001-filing-label-bar-is-defect-confirmed.md"));
|
|
200
|
+
// Positive control against a vacuous slice: a stale anchor matching almost
|
|
201
|
+
// nothing would still satisfy a doesNotMatch and assert nothing.
|
|
202
|
+
assert.ok(s.length > 200, "the guard slice is shorter than its own heading and bullets — the extractor is broken, not the ADR wrong");
|
|
203
|
+
assert.deepEqual(guardFiring(s), [], "the guard's population clause, its `--state all` count, or its as-of duty is gone");
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// The refuse direction: each fixture asserts it changed the document before it
|
|
207
|
+
// is scored, because a fixture that applies nothing is green in exactly the way
|
|
208
|
+
// a pin that does not bite is green.
|
|
209
|
+
const guardMutants = [
|
|
210
|
+
["the population is flipped to open-only", ["population"],
|
|
211
|
+
(t) => t.replace(phrase("open **and** closed issues together, never open alone"), "open issues only, never the closed ones")],
|
|
212
|
+
["the ruling survives but its reason is stripped", ["population"],
|
|
213
|
+
(t) => t.replace(phrase("The trigger measures filing behaviour, and a refuted deferral filed as `needs-triage` and later closed counts under one reading and vanishes under the other — so under open-only any triage pass that reads the backlog improves the ratio without one filing having changed. A guard on the filing bar must not be satisfiable by triaging the queue."), "Count them all.")],
|
|
214
|
+
["the count command is narrowed to open issues", ["stateAll"],
|
|
215
|
+
(t) => t.replace(phrase("--state all"), "--state open")],
|
|
216
|
+
["the as-of duty is dropped", ["asOf"],
|
|
217
|
+
(t) => t.replace(phrase("and record the date taken with the verdict"), "and read it off the tracker")],
|
|
218
|
+
["the population clause is struck through and marked superseded", ["notNeutralized"],
|
|
219
|
+
(t) => t.replace(POPULATION, (m) => `~~${m}~~ Superseded: use open issues only, it is simpler to compute.`)],
|
|
220
|
+
];
|
|
221
|
+
|
|
222
|
+
for (const [what, expected, mutate] of guardMutants) {
|
|
223
|
+
test(`the guard pins redden when ${what}`, () => {
|
|
224
|
+
const adr = readRoot("docs", "adr", "0001-filing-label-bar-is-defect-confirmed.md");
|
|
225
|
+
const mutated = mutate(adr);
|
|
226
|
+
assert.notEqual(mutated, adr, `the "${what}" fixture no longer matches the guard section and applied nothing — update the fixture, do not delete it`);
|
|
227
|
+
assert.deepEqual(guardFiring(guardSection(mutated)), expected, `the "${what}" fixture did not fire exactly the pins it is here to exercise`);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
test("rewrapping the guard section and editing it elsewhere stays green", () => {
|
|
232
|
+
// The accept direction. A pin that reds on any edit to the section has
|
|
233
|
+
// discriminated nothing and gets deleted by whoever next reflows this file.
|
|
234
|
+
const adr = readRoot("docs", "adr", "0001-filing-label-bar-is-defect-confirmed.md");
|
|
235
|
+
const section = between(adr, "## The guard — floor and trigger, chosen before any data", "\n## Relationship to #211", "ADR 0001 guard section");
|
|
236
|
+
const benign = adr.replace(section, () =>
|
|
237
|
+
section
|
|
238
|
+
.replace(/\n(?! *[-*] )(?! *```)/g, " ")
|
|
239
|
+
.replace("When the guard fires, its verdict lands on `main`.", "When the guard fires, its verdict lands on `main` before the next run starts."));
|
|
240
|
+
assert.notEqual(benign, adr, "the benign-edit fixture no longer matches the guard section — update it");
|
|
241
|
+
assert.deepEqual(guardFiring(guardSection(benign)), [], "a reflow plus an unrelated edit reddened a guard pin — the pins are over-tight, not the ADR wrong");
|
|
242
|
+
});
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// ADR 0002. Step 5 gained a second, earlier bar: a finding whose own claim is
|
|
2
|
+
// that correct code could be shaped better never gets its own open issue — it
|
|
3
|
+
// goes into the per-review closed record under `Below the claim bar`, with a
|
|
4
|
+
// promotion path back out. Measured basis: 2026-08-15→31, 133 triage-closed
|
|
5
|
+
// `wontfix` in sixteen days, 121 of them review deferrals, mostly this shape.
|
|
6
|
+
//
|
|
7
|
+
// What this pins is the bar's KEY — the finding's claim, never its review
|
|
8
|
+
// band. #591 is why the distinction is load-bearing: `unverified` conflates
|
|
9
|
+
// policy-skipped suggestions with crashed-refuter criticals, so a band-keyed
|
|
10
|
+
// rule silently drops findings nobody looked at. A revert of the band sentence
|
|
11
|
+
// alone would leave a bar that reads as a severity floor, which is the exact
|
|
12
|
+
// shelved option ADR 0001 gated behind #591.
|
|
13
|
+
//
|
|
14
|
+
// Slices are flattened, same class defect as filing-bar-seat-prose.test.mjs:
|
|
15
|
+
// step 5 is one long line today, the ADR hard-wraps, and reflow must not red.
|
|
16
|
+
//
|
|
17
|
+
// CEILING: presence and adjacency over bounded slices. These prove the bar,
|
|
18
|
+
// its routing, and its band-exclusion are stated; they cannot prove a later
|
|
19
|
+
// sentence in the same slice does not carve out an exception.
|
|
20
|
+
//
|
|
21
|
+
// Measured as of this commit, on the working tree with restore after each: six
|
|
22
|
+
// mutations — the bar sentence deleted, its verdict inverted (never → keeps),
|
|
23
|
+
// the record routing redirected to an own open issue, the band-exclusion
|
|
24
|
+
// sentence deleted, the ADR pointer renamed in the prose, and the ADR's guard
|
|
25
|
+
// floor retuned 20 → 50 — each reddened its own pin and no other. Controls: an
|
|
26
|
+
// unpinned step-5 sentence reworded and the ADR's guard bullets rewrapped both
|
|
27
|
+
// stayed green.
|
|
28
|
+
//
|
|
29
|
+
// #1113 added the applied-promotion pin. Trigger A counts entries "promoted",
|
|
30
|
+
// and the filed path leaves a citation on the record while the fix-applier's
|
|
31
|
+
// apply path files nothing at all — so the promotion the trigger most needs to
|
|
32
|
+
// see left no mark on the record. Step 5 now writes one under a fixed opening
|
|
33
|
+
// and the ADR's guard names the same string; the pin compares the two by
|
|
34
|
+
// EQUALITY, because a search for one inside the other passes on a narrowing
|
|
35
|
+
// rename. Measured on the working tree with restore after each: five mutations
|
|
36
|
+
// — step 5's apply-path verdict inverted (files nothing → files its own issue),
|
|
37
|
+
// step 5's marker narrowed, the ADR's marker narrowed, the ADR's
|
|
38
|
+
// promotion-signal definition reworded down to the filed path alone, and step
|
|
39
|
+
// 5's marker unquoted — each reddened this pin and no other, while retuning
|
|
40
|
+
// Trigger A's 5 reddened only the older guard pin. Controls: the ADR's Trigger
|
|
41
|
+
// A bullet reflowed onto one line and an unpinned step-5 sentence reworded both
|
|
42
|
+
// stayed green.
|
|
43
|
+
import { test } from "node:test";
|
|
44
|
+
import assert from "node:assert/strict";
|
|
45
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
46
|
+
import { join } from "node:path";
|
|
47
|
+
import { between, phrase } from "./prose-pin.mjs";
|
|
48
|
+
|
|
49
|
+
const REPO = join(import.meta.dirname, "..");
|
|
50
|
+
const read = (...p) => readFileSync(join(REPO, ...p), "utf8");
|
|
51
|
+
const REVIEW_AND_FIX = read("commands", "review-and-fix.md");
|
|
52
|
+
const ROOT = join(import.meta.dirname, "..", "..");
|
|
53
|
+
|
|
54
|
+
const flat = (s) => s.replace(/\s+/g, " ");
|
|
55
|
+
|
|
56
|
+
const step5 = () => flat(between(REVIEW_AND_FIX, "5. File each deferred finding", "\n6. Diff-check green", "review-and-fix step 5"));
|
|
57
|
+
|
|
58
|
+
test("step 5 states the claim bar: shaped-better findings never get their own open issue", () => {
|
|
59
|
+
// The bar and its verdict as ONE span. Pinning "Worth a claim" apart from
|
|
60
|
+
// "never gets its own open issue" leaves the join open — a clause spliced
|
|
61
|
+
// between them reverses the rule and satisfies both.
|
|
62
|
+
assert.match(
|
|
63
|
+
step5(),
|
|
64
|
+
phrase(
|
|
65
|
+
"**Worth a claim: a finding whose own claim is that correct code could be shaped better — style, naming, layout, redundancy, a micro-simplification — never gets its own open issue.**",
|
|
66
|
+
),
|
|
67
|
+
"step 5 lost the worth-a-claim bar — shaped-better findings are back to one open issue each",
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("step 5 routes below-bar findings into the closed record, with a promotion path out", () => {
|
|
72
|
+
const s = step5();
|
|
73
|
+
assert.match(
|
|
74
|
+
s,
|
|
75
|
+
phrase("Append it to the same closed record issue under a `Below the claim bar` heading"),
|
|
76
|
+
"step 5 no longer routes a below-bar finding into the per-review closed record issue",
|
|
77
|
+
);
|
|
78
|
+
assert.match(
|
|
79
|
+
s,
|
|
80
|
+
phrase("is the promotion signal: file it open then, citing the record"),
|
|
81
|
+
"step 5 lost the promotion path — a below-bar finding rediscovered as real has no way back to its own issue",
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("step 5 keys the bar on the finding's claim, never its review band", () => {
|
|
86
|
+
// Contiguous through the confirmed/torn hand-off: the exclusion is only
|
|
87
|
+
// meaningful bound to where an above-bar finding goes instead.
|
|
88
|
+
assert.match(
|
|
89
|
+
step5(),
|
|
90
|
+
phrase(
|
|
91
|
+
"**The bar reads the finding's claim, never its review band** — a finding that alleges wrong behavior, whatever band it sat in, `unverified`-with-crashed-refuters included, is above this bar and files open under the confirmed/torn split",
|
|
92
|
+
),
|
|
93
|
+
"step 5 no longer excludes wrong-behavior findings from the claim bar — a band-keyed reading drops crashed-refuter criticals (#591)",
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("step 5 points at an ADR that exists, and the ADR keeps its pre-chosen guard", () => {
|
|
98
|
+
// Read the path out of the prose rather than restating it, so a rename that
|
|
99
|
+
// updates only one side reds.
|
|
100
|
+
const [, adrPath] = step5().match(/\(`(docs\/adr\/0002[^`]+)`\)/) ?? [];
|
|
101
|
+
assert.ok(adrPath, "step 5 no longer cites an ADR 0002 path under `docs/adr/`");
|
|
102
|
+
assert.ok(existsSync(join(ROOT, adrPath)), `step 5 points at \`${adrPath}\`, which does not exist`);
|
|
103
|
+
|
|
104
|
+
const adr = flat(readFileSync(join(ROOT, adrPath), "utf8"));
|
|
105
|
+
// Floor and both triggers as one span, 0001's precedent: chosen before any
|
|
106
|
+
// data, and separate pins would let any one be retuned alone.
|
|
107
|
+
assert.match(
|
|
108
|
+
adr,
|
|
109
|
+
phrase(
|
|
110
|
+
"**Floor:** 20 below-bar entries across at least 3 distinct run dates. - **Trigger A — bar too wide:** 5 or more of those entries promoted",
|
|
111
|
+
),
|
|
112
|
+
"the ADR's guard floor or promotion trigger moved — a pre-chosen guard that is retuned later is not a guard",
|
|
113
|
+
);
|
|
114
|
+
assert.match(
|
|
115
|
+
adr,
|
|
116
|
+
phrase("**Trigger B — bar missed the load:** non-record `wontfix` closes still above half of all closes"),
|
|
117
|
+
"the ADR lost trigger B — nothing detects the clause missing the volume it was priced against",
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test("the applied promotion path is stated in step 5 and read by the ADR's guard", () => {
|
|
122
|
+
const s = step5();
|
|
123
|
+
// The path and its consequence as ONE span. "is that same promotion signal"
|
|
124
|
+
// pinned apart from "it files nothing" leaves the join open, and the second
|
|
125
|
+
// half is the whole reason the first needs writing down: this path leaves no
|
|
126
|
+
// filed issue behind, so nothing lands on the record by itself.
|
|
127
|
+
assert.match(
|
|
128
|
+
s,
|
|
129
|
+
phrase("**An in-scope rediscovery step 2 applied is that same promotion signal, and it files nothing**"),
|
|
130
|
+
"step 5 no longer treats an applied below-bar rediscovery as a promotion — the entry re-derived, checked and worth fixing goes unrecorded",
|
|
131
|
+
);
|
|
132
|
+
// Read the comment's fixed opening out of each file's own prose and compare
|
|
133
|
+
// the two, rather than restating the string here. A rename on one side alone
|
|
134
|
+
// leaves Trigger A counting a mark nothing writes, and neither file is wrong
|
|
135
|
+
// on its own after it. Equality, never a match of one inside the other:
|
|
136
|
+
// measured, shortening step 5's opening to `Promoted — applied` stays green
|
|
137
|
+
// under a `phrase(marker)` search of the ADR, because the ADR's longer string
|
|
138
|
+
// contains it.
|
|
139
|
+
const [, marker] = s.match(/comment on that record issue, opening `([^`]+)`/) ?? [];
|
|
140
|
+
assert.ok(marker, "step 5 no longer gives the applied-promotion comment a fixed opening, so the guard has no mark to count");
|
|
141
|
+
const [, adrPath] = s.match(/\(`(docs\/adr\/0002[^`]+)`\)/) ?? [];
|
|
142
|
+
assert.ok(adrPath, "step 5 no longer cites an ADR 0002 path under `docs/adr/`");
|
|
143
|
+
const adr = flat(readFileSync(join(ROOT, adrPath), "utf8"));
|
|
144
|
+
// Scoped to the Trigger A bullet, not the whole flattened ADR — an
|
|
145
|
+
// unscoped search matches whichever `X` comment on it` substring appears
|
|
146
|
+
// FIRST in the file, so narrowing Trigger A's own marker while an earlier
|
|
147
|
+
// sentence still carries the old string stays green. `between` throws if
|
|
148
|
+
// the bullet's own bounds go missing, for the same reason a missing
|
|
149
|
+
// anchor elsewhere in this file throws rather than widening.
|
|
150
|
+
const triggerA = between(adr, "- **Trigger A — bar too wide:**", "- **Trigger B", "ADR 0002 Trigger A");
|
|
151
|
+
const [, adrMarker] = triggerA.match(/`([^`]+)` comment on it/) ?? [];
|
|
152
|
+
assert.equal(
|
|
153
|
+
adrMarker,
|
|
154
|
+
marker,
|
|
155
|
+
`ADR 0002's guard counts \`${adrMarker}\` while step 5 writes \`${marker}\` — the trigger reads a mark nothing leaves`,
|
|
156
|
+
);
|
|
157
|
+
// The definition itself, not just the marker: a guard whose input is
|
|
158
|
+
// undefined is not a guard, and the filed path alone is the half that
|
|
159
|
+
// systematically undercounts. Checked against the same Trigger A slice,
|
|
160
|
+
// for the same scoping reason as the marker above.
|
|
161
|
+
assert.match(
|
|
162
|
+
triggerA,
|
|
163
|
+
phrase("**Promotion signal — two marks, both on the record issue:** an open issue citing the record, and a"),
|
|
164
|
+
"ADR 0002's Trigger A no longer defines what counts as a promotion, so the filed path is the only one an evaluator can see",
|
|
165
|
+
);
|
|
166
|
+
});
|