@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,188 @@
|
|
|
1
|
+
// #1212. `git_probe`'s separator comment justified `gp_sep` as "a byte no
|
|
2
|
+
// porcelain line or ordinary warning contains" — a property of the BYTE, and
|
|
3
|
+
// not the property that actually holds. What holds is a property of GIT, and
|
|
4
|
+
// only for the commands the helper is currently pointed at. That distinction
|
|
5
|
+
// is the whole finding: `git_probe` takes `git "$@"`, nothing in its body
|
|
6
|
+
// checks the separator's absence, and a caller pointed at output git does not
|
|
7
|
+
// quote the same way gets a truncated `$gp_out` plus a non-numeric `$gp_rc`
|
|
8
|
+
// fed to `return`. The review that produced it split 1-1 — one refuter
|
|
9
|
+
// measured the corruption reproducible against a stub `git`, the other
|
|
10
|
+
// measured it unreachable and failing closed — and the single point both
|
|
11
|
+
// agreed on is that the comment asserted a boundary the code does not
|
|
12
|
+
// enforce.
|
|
13
|
+
//
|
|
14
|
+
// Re-measured while writing the comment, git 2.50.1 (Apple Git-155):
|
|
15
|
+
//
|
|
16
|
+
// `status --porcelain -uall` and `--porcelain -unormal --ignored`, over a
|
|
17
|
+
// file named `weird<0x02>file` and a chmod-000 directory `dir<0x02>name`:
|
|
18
|
+
// zero raw 0x02 bytes, under core.quotePath true AND false. stdout C-quotes
|
|
19
|
+
// the path (`?? "weird\002file"`); stderr renders the byte as `?`
|
|
20
|
+
// (`warning: could not open directory 'dir?name/'`) — two different rules,
|
|
21
|
+
// both landing outside the separator.
|
|
22
|
+
// The SAME command with `-z`: one raw 0x02, straight through. So do
|
|
23
|
+
// `log --format=%s` and `show <rev>:<path>`. The boundary is one flag away
|
|
24
|
+
// from an existing call site, which is why the comment now names it.
|
|
25
|
+
//
|
|
26
|
+
// WHY THIS FILE EXISTS AT ALL, given the fix is comment-only. The ticket's own
|
|
27
|
+
// thesis is that a comment asserted a boundary nothing enforced. Correcting
|
|
28
|
+
// the prose and pinning nothing reproduces that one level up — the corrected
|
|
29
|
+
// boundary would again rest on whoever read it last. And no behavioural test
|
|
30
|
+
// can see this change: the script's bytes below the `#` lines are identical,
|
|
31
|
+
// so `reap.sh` behaves identically and `reap.test.mjs` cannot tell the two
|
|
32
|
+
// revisions apart. A prose pin is the only enforcement available here, and
|
|
33
|
+
// the only thing in the suite that can see the mode this ticket changed.
|
|
34
|
+
//
|
|
35
|
+
// NOT pinned, deliberately: the corruption path itself. It is unreachable from
|
|
36
|
+
// every existing caller — three `status --porcelain` variants protected by
|
|
37
|
+
// git's path-quoting, and a fourth (`for-each-ref`, #1413) protected because
|
|
38
|
+
// a refname carrying the byte cannot exist in the first place — and a
|
|
39
|
+
// test would have to stub `git` to reach it, pinning a hypothetical rather
|
|
40
|
+
// than a behaviour. That is the ticket's own out-of-scope ruling, and the same
|
|
41
|
+
// reason the competing `$gp_rc` numeric guard was rejected: every call site is
|
|
42
|
+
// shaped `if ! git_probe …; then keep …`, so a garbled exit code cannot come
|
|
43
|
+
// back 0 and cannot turn a KEEP into a REAP. Nothing here asserts the helper's
|
|
44
|
+
// runtime shape; `reap.test.mjs` owns that.
|
|
45
|
+
//
|
|
46
|
+
// THE SLICE is the run of `#` lines immediately above the `gp_sep`
|
|
47
|
+
// declaration, bounded by CODE at both ends. `quiet-payload-prose.test.mjs`
|
|
48
|
+
// takes the same bound at `ci-state.mjs`'s header and its own notes say why,
|
|
49
|
+
// both halves measured under #695: in source a blank-line bound runs past the
|
|
50
|
+
// end of the comment into live code, so a decoy pasted in the code below took
|
|
51
|
+
// a whole suite green — and a phrase anchor sits INSIDE the prose it pins, so
|
|
52
|
+
// every edit to that prose reads as a moved anchor and reports the wrong
|
|
53
|
+
// fault. A one-line declaration is neither. `anchorAt` carries the
|
|
54
|
+
// exactly-once half, so a second copy of that declaration reds here rather
|
|
55
|
+
// than binding these pins to whichever copy comes first.
|
|
56
|
+
//
|
|
57
|
+
// This file names its one source by path and globs nothing, so its own text —
|
|
58
|
+
// which quotes the old wording in the first paragraph above — is not in the
|
|
59
|
+
// corpus and cannot satisfy or defeat the pins it carries.
|
|
60
|
+
//
|
|
61
|
+
// THE CEILING. These are PRESENCE pins over a bounded slice, plus one revert
|
|
62
|
+
// guard. What they catch is a required statement gutted, or the old
|
|
63
|
+
// property-of-the-byte wording restored. What they do NOT catch: a
|
|
64
|
+
// differently worded restatement of the false claim, or a sentence appended
|
|
65
|
+
// after a correct one to walk it back. They also say nothing about whether the
|
|
66
|
+
// measurements in the comment are right — they pin that the comment
|
|
67
|
+
// attributes the safety to git rather than to the byte, names the scope it
|
|
68
|
+
// holds at, names each call-site group's OWN safety rule rather than one
|
|
69
|
+
// rule for all of them, says the code does not check either invariant, and
|
|
70
|
+
// warns the next caller off.
|
|
71
|
+
//
|
|
72
|
+
// Zero deps: `node --test plugin/scripts/gp-sep-invariant-prose.test.mjs`.
|
|
73
|
+
|
|
74
|
+
import { test } from "node:test";
|
|
75
|
+
import assert from "node:assert/strict";
|
|
76
|
+
import { readFileSync } from "node:fs";
|
|
77
|
+
import { join } from "node:path";
|
|
78
|
+
import { phrase, runAbove, stripHashGutter } from "./prose-pin.mjs";
|
|
79
|
+
|
|
80
|
+
const REPO = join(import.meta.dirname, "..");
|
|
81
|
+
const REAP = "scripts/reap.sh";
|
|
82
|
+
const SOURCE = readFileSync(join(REPO, ...REAP.split("/")), "utf8");
|
|
83
|
+
|
|
84
|
+
// The declaration the comment documents, and the slice's lower bound.
|
|
85
|
+
const ANCHOR = "gp_sep=$(printf '\\002')";
|
|
86
|
+
|
|
87
|
+
// The `#` run immediately above the anchor, gutter stripped and flattened to a
|
|
88
|
+
// single line: a wrapped comment breaks a sentence at the `# ` gutter, which
|
|
89
|
+
// `phrase()`'s `\s+` does not span.
|
|
90
|
+
//
|
|
91
|
+
// The shared bound, not a local copy of it (#1604). `runAbove` owns the slice —
|
|
92
|
+
// the exactly-once anchor through `anchorAt`, and the run matched only where a
|
|
93
|
+
// `#` is a line's first token, so the bound is code at both ends rather than a
|
|
94
|
+
// blank line that would run past the comment into the script. Only the gutter
|
|
95
|
+
// strip is this file's: the `//` consumers of the same bound compare raw bytes
|
|
96
|
+
// and must not have it.
|
|
97
|
+
const separatorComment = (text) => stripHashGutter(runAbove(text, ANCHOR, REAP, "#"));
|
|
98
|
+
|
|
99
|
+
const COMMENT = separatorComment(SOURCE);
|
|
100
|
+
|
|
101
|
+
// Each row is one thing the comment has to say, and the acceptance criterion it
|
|
102
|
+
// answers. Kept as a table rather than inline so the rewrap check at the foot
|
|
103
|
+
// runs the same regexes rather than a second copy of them that could drift.
|
|
104
|
+
const PINS = [
|
|
105
|
+
[
|
|
106
|
+
"attributes the safety to git's quoting, not to the byte",
|
|
107
|
+
"git C-quotes the path",
|
|
108
|
+
"the separator is safe because of what GIT does to a control byte in a path, which is the claim that actually holds",
|
|
109
|
+
],
|
|
110
|
+
[
|
|
111
|
+
"says the code does not check either invariant",
|
|
112
|
+
"Nothing in the body checks either invariant",
|
|
113
|
+
"the one point both refuters agreed on: the invariant is asserted here and enforced nowhere",
|
|
114
|
+
],
|
|
115
|
+
[
|
|
116
|
+
"names the scope the invariant holds at",
|
|
117
|
+
"safe only for the commands this helper is currently pointed at",
|
|
118
|
+
"an invariant with no stated scope is one a future caller inherits without knowing it exists",
|
|
119
|
+
],
|
|
120
|
+
[
|
|
121
|
+
"names the porcelain-reading call sites by an exact count, not by \"every\"",
|
|
122
|
+
"Three call sites below read `status --porcelain`",
|
|
123
|
+
"\"every call site\" was the false claim (#1601 review): a fourth call site, `for-each-ref`, was added by #1413 and does not read `status --porcelain` at all — the boundary has to name an exact, checkable count",
|
|
124
|
+
],
|
|
125
|
+
[
|
|
126
|
+
"names the for-each-ref call site's different safety rule",
|
|
127
|
+
"a REFNAME, unlike a path, can never contain the byte at all",
|
|
128
|
+
"the fourth call site is safe for a reason that has nothing to do with git quoting a path — collapsing the two mechanisms into one claim is exactly how #1601's false \"every call site\" wording happened",
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
"warns the next caller off output carrying neither guarantee",
|
|
132
|
+
"DO NOT POINT `git_probe` AT A COMMAND WHOSE OUTPUT CARRIES NEITHER GUARANTEE",
|
|
133
|
+
"`git_probe` takes `git \"$@\"`, so the invariant is the caller's to keep and this warning is the only thing that tells them so",
|
|
134
|
+
],
|
|
135
|
+
[
|
|
136
|
+
"keeps the `set -e` rationale it sits above",
|
|
137
|
+
"under `set -e` a bare failing assignment aborts the subshell",
|
|
138
|
+
"a separate, still-accurate finding (PR #1068) that shares this comment block and must survive edits to the separator paragraph",
|
|
139
|
+
],
|
|
140
|
+
[
|
|
141
|
+
"keeps the bare-assignment note that rationale is about",
|
|
142
|
+
"never a bare `gp_o=$(...); gp_rc=$?`",
|
|
143
|
+
"the shape the `set -e` finding is about — the rationale without it names no construct",
|
|
144
|
+
],
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
// The guard on the guard. Every positive pin below reds on an empty slice, so
|
|
148
|
+
// those are self-diagnosing; the revert guard is a `doesNotMatch` and would
|
|
149
|
+
// pass vacuously over one. A moved or duplicated anchor already throws inside
|
|
150
|
+
// `anchorAt` — this covers the remaining way the slice comes back empty, the
|
|
151
|
+
// declaration losing the comment run above it altogether.
|
|
152
|
+
test("the comment run above the gp_sep declaration is found at all", () => {
|
|
153
|
+
assert.ok(
|
|
154
|
+
COMMENT.trim().length > 0,
|
|
155
|
+
`${REAP}: no \`#\` run sits immediately above \`${ANCHOR}\`, so the slice these pins assert over is empty and they prove nothing. Re-derive the bound — never widen it to the whole file.`,
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
for (const [what, text, why] of PINS) {
|
|
160
|
+
test(`the git_probe separator comment ${what}`, () => {
|
|
161
|
+
assert.match(
|
|
162
|
+
COMMENT,
|
|
163
|
+
phrase(text),
|
|
164
|
+
`${REAP}: the comment above \`${ANCHOR}\` no longer says "${text}". ${why} (#1212)`,
|
|
165
|
+
);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// The revert guard, and the half AC 1 states negatively: the comment must no
|
|
170
|
+
// longer describe 0x02 as a byte git's output cannot contain, in any casing.
|
|
171
|
+
// Measured false — `status --porcelain -uall -z` emits it, and so does any
|
|
172
|
+
// command printing content rather than paths — and it is the wrong shape of
|
|
173
|
+
// claim regardless, since it reads as a property of the byte that needs no
|
|
174
|
+
// scope. Matched case-insensitively, unlike every positive pin above: those
|
|
175
|
+
// are satisfied by phrase() finding the words ANYWHERE, so casing never hides
|
|
176
|
+
// a false negative, but this is the one `doesNotMatch` in the file, and a
|
|
177
|
+
// caller who reintroduces this exact retired clause as a sentence's opening —
|
|
178
|
+
// this file's own prose style, see "WHY THIS FILE EXISTS", "THE SLICE",
|
|
179
|
+
// "THE CEILING" above — capitalizes its first letter for free, which a
|
|
180
|
+
// case-sensitive doesNotMatch would silently let back in.
|
|
181
|
+
test("the git_probe separator comment no longer claims 0x02 is absent from porcelain output", () => {
|
|
182
|
+
assert.doesNotMatch(
|
|
183
|
+
COMMENT,
|
|
184
|
+
new RegExp(phrase("a byte no porcelain line or ordinary warning contains").source, "i"),
|
|
185
|
+
`${REAP}: the comment above \`${ANCHOR}\` is back to describing \`gp_sep\` as a byte git's output cannot contain. That states a property of the BYTE and carries no scope, so a caller pointed at `
|
|
186
|
+
+ "`status --porcelain -uall -z` (which does emit the raw byte, measured) inherits an assumption nothing checks. State what git does to a control byte in a path, and where that stops holding. (#1212)",
|
|
187
|
+
);
|
|
188
|
+
});
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// #493. Every guard protecting `ready-to-merge` sits UPSTREAM of the label —
|
|
2
|
+
// the finisher's dispatch pin, the halt on a moved head, the worktree audit all
|
|
3
|
+
// run before the label exists. Downstream the label is unconditional: measured
|
|
4
|
+
// on PR #426, a finisher audited a head and labelled it, a fix-applier then
|
|
5
|
+
// surfaced a defect, the controller approved a fix, and the label sat on a
|
|
6
|
+
// commit nobody had audited with nothing left to go stale. #180 is the
|
|
7
|
+
// confirmed half of the mechanism — a GitHub label does not follow the branch.
|
|
8
|
+
//
|
|
9
|
+
// The ruled fix is that the merge bot re-derives the head, as a REQUIREMENT
|
|
10
|
+
// rather than bot discretion. It already held in practice — the merge bots that
|
|
11
|
+
// merged #1090 and #1091 both re-derived every gate at the merge instant — but
|
|
12
|
+
// it held because their dispatch prompts said so, which is precisely what this
|
|
13
|
+
// file exists to stop being the only reason.
|
|
14
|
+
//
|
|
15
|
+
// THE CEILING: these are presence pins on prose. They prove the rules are
|
|
16
|
+
// stated where their reader reaches them; they cannot prove a merge bot obeys
|
|
17
|
+
// them, and nothing here runs `gh`.
|
|
18
|
+
import { test } from "node:test";
|
|
19
|
+
import assert from "node:assert/strict";
|
|
20
|
+
import { readFileSync } from "node:fs";
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
import { between, phrase } from "./prose-pin.mjs";
|
|
23
|
+
|
|
24
|
+
const REPO = join(import.meta.dirname, "..");
|
|
25
|
+
const DOC = readFileSync(join(REPO, "commands", "run-merge-bot.md"), "utf8");
|
|
26
|
+
const RUN_TEAM = readFileSync(join(REPO, "skills", "run-team", "SKILL.md"), "utf8");
|
|
27
|
+
|
|
28
|
+
// Bounded at both ends. Unbounded to EOF, `ready-to-merge`, `head` and
|
|
29
|
+
// `finisher` each occur freely through the per-PR sequence and the watcher
|
|
30
|
+
// loop, so every assertion below would survive deletion of the section itself.
|
|
31
|
+
// The end anchor is the NEXT heading — `## Per-PR sequence` again since #1806
|
|
32
|
+
// retired the gate-proof section #966 had put between them.
|
|
33
|
+
const labelledHead = () =>
|
|
34
|
+
between(DOC, "## The labelled head", "## Per-PR sequence", "run-merge-bot.md");
|
|
35
|
+
|
|
36
|
+
// Step 3 is the merge gate, run twice, so the head leg has to be IN it — not
|
|
37
|
+
// in a later paragraph a reader reaches the merge without having read.
|
|
38
|
+
const step3 = () =>
|
|
39
|
+
between(DOC, "3. **Gate the merge with `merge-gate.mjs`", "4. `gh pr merge <pr> --merge`", "run-merge-bot.md");
|
|
40
|
+
|
|
41
|
+
test("the head re-derivation is stated as a requirement, not left to bot discretion", () => {
|
|
42
|
+
assert.match(labelledHead(), phrase("re-deriving the head is a requirement here, not bot discretion"));
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("the labelled head names why no upstream guard covers this window", () => {
|
|
46
|
+
// Without the reason this reads as a redundant fourth check and gets deleted
|
|
47
|
+
// as one. The two facts it rests on: the label does not move with the branch,
|
|
48
|
+
// and every other guard runs before the label exists.
|
|
49
|
+
assert.match(labelledHead(), phrase("A GitHub label does not follow the branch"));
|
|
50
|
+
assert.match(
|
|
51
|
+
labelledHead(),
|
|
52
|
+
phrase("runs *before* the label exists, so none of them is watching this window"),
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("the timeline read is the mechanism, keyed on the three events that move a head", () => {
|
|
57
|
+
const s = labelledHead();
|
|
58
|
+
assert.match(s, /issues\/<pr>\/timeline\?per_page=100/);
|
|
59
|
+
assert.match(s, /\.event == "labeled" and \.label\.name == "ready-to-merge"/);
|
|
60
|
+
assert.match(s, /\.event == "committed" or \.event == "head_ref_force_pushed"/);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("the read's ordering constraint rides in the same sentence as its reason", () => {
|
|
64
|
+
// The whole rule is WHEN. `gh pr update-branch` lands commits dated after the
|
|
65
|
+
// label by construction — measured on this repo: #1090 (never rebased) lists
|
|
66
|
+
// `labeled ready-to-merge` after its commits, #1091 (rebased by its merge
|
|
67
|
+
// bot) lists three `committed` plus a `head_ref_force_pushed` after the
|
|
68
|
+
// label. So a read taken post-rebase cannot tell the bot's own commits from a
|
|
69
|
+
// member's. One contiguous span, so splitting the constraint away from the
|
|
70
|
+
// command it governs reds this.
|
|
71
|
+
assert.match(
|
|
72
|
+
labelledHead(),
|
|
73
|
+
phrase("Read the timeline before `gh pr update-branch` and before anything else that can move the head"),
|
|
74
|
+
);
|
|
75
|
+
assert.match(
|
|
76
|
+
labelledHead(),
|
|
77
|
+
phrase("once you have rebased this read can no longer tell your commits from someone else's"),
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// The decision rule itself — WHICH SIDE of the label line a commit has to fall
|
|
82
|
+
// on. Everything above pins that the query is present and that a refusal
|
|
83
|
+
// follows; nothing pinned the predicate between them. Measured on the commit
|
|
84
|
+
// BEFORE this one: inverting `after` to `BEFORE` left this file 14/14 green,
|
|
85
|
+
// and deleting the sentence outright left 36/36 green across both prose
|
|
86
|
+
// suites. Inverted, the doc tells the bot to refuse the ordinary PR and
|
|
87
|
+
// to merge #180's shape — the head this ticket exists to stop.
|
|
88
|
+
//
|
|
89
|
+
// One contiguous span through `**Refuse:`, not two matches: N separate matches
|
|
90
|
+
// pin N facts and never the text between them. Verified as-of-commit on three
|
|
91
|
+
// mutants and two controls — the two above red, so does splicing `unless the
|
|
92
|
+
// commits are plausibly your own predecessor's, in which case proceed` between
|
|
93
|
+
// the predicate and its verdict (the informative one: every pinned token
|
|
94
|
+
// survives it and only the binding flips), while re-wrapping the same wording
|
|
95
|
+
// across three lines and rewording the unpinned sentence above both stay
|
|
96
|
+
// green. `phrase`, not a raw regex, is what makes that rewrap green.
|
|
97
|
+
test("a commit AFTER the last label line is what the refusal keys on", () => {
|
|
98
|
+
assert.match(
|
|
99
|
+
labelledHead(),
|
|
100
|
+
phrase(
|
|
101
|
+
"A `committed` or `head_ref_force_pushed` line after the last `labeled ready-to-merge` means the head moved after the audit. **Refuse:",
|
|
102
|
+
),
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("the refusal names its token, leaves the label alone, and sends a fresh finisher", () => {
|
|
107
|
+
const s = labelledHead();
|
|
108
|
+
assert.match(s, phrase("report `head-moved-after-label-#<pr>` and stop on that PR"));
|
|
109
|
+
assert.match(s, phrase("Leave the label where it is"));
|
|
110
|
+
assert.match(s, phrase("the first audit does not transfer, because it verified a different tree"));
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// AC-4, the ACCEPT side. A bot that refuses whenever the labelled SHA is not
|
|
114
|
+
// the current head must not refuse the ordinary PR. Pinned as one span
|
|
115
|
+
// with its verdict, because a bare "this is the normal case" with the outcome
|
|
116
|
+
// deleted is what leaves a reader guessing.
|
|
117
|
+
test("the normal path — label applied, head unchanged — is stated as proceeding untouched", () => {
|
|
118
|
+
assert.match(
|
|
119
|
+
labelledHead(),
|
|
120
|
+
phrase(
|
|
121
|
+
"Nothing after that label line is the normal case, and it proceeds untouched** — label applied, head unchanged, merge goes ahead exactly as it did before this gate existed",
|
|
122
|
+
),
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// Step 3's comparison has an operand, and this section is the only place that
|
|
127
|
+
// captures it. Step 1's `pre` exists only where step 1 runs, so a PR already
|
|
128
|
+
// current has none — the instruction has to stand on its own read, and it has
|
|
129
|
+
// to say the read happens BEFORE the rebase or it captures the wrong SHA.
|
|
130
|
+
test("the pre-rebase head is recorded here, since step 3 compares against it and nothing rebuilds it", () => {
|
|
131
|
+
const s = labelledHead();
|
|
132
|
+
assert.match(s, phrase("Record the head before you rebase"));
|
|
133
|
+
// `phrase`, not a raw regex: this command sits in prose, not in a fenced
|
|
134
|
+
// block, so a hard-wrap can put a newline between any two of its words.
|
|
135
|
+
// Measured — the raw form reddened on a same-wording rewrap of the section.
|
|
136
|
+
assert.match(s, phrase("gh pr view <pr> --json headRefOid -q .headRefOid"));
|
|
137
|
+
assert.match(s, phrase("on an already-current PR it is simply the head you merge"));
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// The other ACCEPT-side half: the two things the gate deliberately does NOT
|
|
141
|
+
// answer. A hand-added label reads clean here (run-team owns reviewer-only),
|
|
142
|
+
// and a head rebased by an abandoned earlier pass refuses on purpose rather
|
|
143
|
+
// than as a false positive. Both are the sentences a later reader would delete
|
|
144
|
+
// as hedging, and deleting either turns a stated limit into a silent one.
|
|
145
|
+
test("the gate declares what it does not cover, and which refusal is intended", () => {
|
|
146
|
+
const s = labelledHead();
|
|
147
|
+
assert.match(s, phrase("a hand-added `ready-to-merge` with no finisher behind it reads clean here"));
|
|
148
|
+
assert.match(s, phrase("earlier, abandoned pass of this command** refuses too"));
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test("step 3 re-derives the head at the merge instant, against pre or the rebase's post", () => {
|
|
152
|
+
// The gate compares the PR head against `--pre`/`--post`, so the operands
|
|
153
|
+
// have to be the labelled head and the bot's own rebase — any other source
|
|
154
|
+
// for `--pre` certifies whatever head the bot read last.
|
|
155
|
+
const s = step3();
|
|
156
|
+
assert.match(s, phrase("`--pre` is the head you recorded at **The labelled head**; `--post` is the head step 1's rebase produced"));
|
|
157
|
+
assert.match(s, phrase("**`head-moved-after-label`** — the PR head is neither `pre` nor `post`"));
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test("step 3 says why no CI gate above it can see a push that landed during the wait", () => {
|
|
161
|
+
// The reason is the load-bearing half: `ci-state.mjs` selects the run whose
|
|
162
|
+
// headSha equals the CURRENT PR head (`r.headSha === prHead`), so a member's
|
|
163
|
+
// push plus its own green run clears step 2 outright. Without this sentence
|
|
164
|
+
// the head comparison looks like a duplicate of the CI binding and gets cut.
|
|
165
|
+
const s = step3();
|
|
166
|
+
assert.match(s, phrase("Any third SHA is a push that landed while you waited on CI, and no CI check can see it"));
|
|
167
|
+
assert.match(s, phrase("`r.headSha === prHead` filter"));
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// #493 AC-3, and the reason it reaches into run-team: the merge bot's refusal
|
|
171
|
+
// stops a bad merge but costs a pass. The cheap half is upstream — the
|
|
172
|
+
// controller not dispatching a finisher into a window a member is about to
|
|
173
|
+
// move. Sliced to the finisher-dispatch paragraph; `question`, `outbox` and
|
|
174
|
+
// `dispatch` all recur through a 2000+ line file.
|
|
175
|
+
const dispatchGate = () =>
|
|
176
|
+
between(
|
|
177
|
+
RUN_TEAM,
|
|
178
|
+
"**finisher** — a fresh small agent, not the fix-applier resumed.",
|
|
179
|
+
"**A final report is not proof the member stopped.**",
|
|
180
|
+
"run-team/SKILL.md",
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
test("an unanswered member question blocks finisher dispatch, with the same weight as an owed ruling", () => {
|
|
184
|
+
const s = dispatchGate();
|
|
185
|
+
assert.match(
|
|
186
|
+
s,
|
|
187
|
+
phrase(
|
|
188
|
+
"An unanswered question from the member is an outbox item, and it blocks dispatch with the same weight as a ruling you have already made",
|
|
189
|
+
),
|
|
190
|
+
);
|
|
191
|
+
// WHY it does not feel like one is what stops it being read as a restatement
|
|
192
|
+
// of the owed-ruling rule directly above and deleted as duplication.
|
|
193
|
+
assert.match(s, phrase("you have decided nothing yet, so the outbox reads empty"));
|
|
194
|
+
// Both exits, or "answer it" reads as a mandate to rule on everything.
|
|
195
|
+
assert.match(s, phrase("tell the member you are not ruling and it should proceed on its own default"));
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// The recovery the ticket asks to keep in the runbook, at the moment it
|
|
199
|
+
// applies: the label is already on and the controller is about to approve a
|
|
200
|
+
// push. Sliced to that paragraph — `ready-to-merge` and `finisher` are
|
|
201
|
+
// everywhere in this file.
|
|
202
|
+
const labelRecovery = () =>
|
|
203
|
+
between(
|
|
204
|
+
RUN_TEAM,
|
|
205
|
+
"**Once the label is on, take it off before you approve any push.**",
|
|
206
|
+
"A halt at step 1 reads identical from a bare SHA mismatch",
|
|
207
|
+
"run-team/SKILL.md",
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
test("the recovery removes the label before approving, and says why messaging the bot is not the stop", () => {
|
|
211
|
+
const s = labelRecovery();
|
|
212
|
+
assert.match(s, phrase("removing the artifact the merge bot gates on is the reliable stop"));
|
|
213
|
+
assert.match(s, phrase("a label has been observed holding until after an abort message arrived"));
|
|
214
|
+
assert.match(s, phrase("dispatch a **fresh** finisher against the new head"));
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// Cross-file, same hazard #447 recorded: run-team's failure table is the
|
|
218
|
+
// controller's index of merge-bot outcomes, so a token that exists only in
|
|
219
|
+
// run-merge-bot.md leaves the controller with a report it cannot place.
|
|
220
|
+
const failureTable = () =>
|
|
221
|
+
between(RUN_TEAM, "## Failure handling", "A red PR never silently becomes", "run-team/SKILL.md");
|
|
222
|
+
|
|
223
|
+
test("the failure table carries the head-moved outcome and its response", () => {
|
|
224
|
+
const s = failureTable();
|
|
225
|
+
assert.match(s, phrase("Merge bot finds the head moved after `ready-to-merge` was applied"));
|
|
226
|
+
assert.match(s, phrase("`head-moved-after-label-#<pr>`, PR stays queued, label untouched"));
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test("the report vocabulary includes head-moved-after-label", () => {
|
|
230
|
+
// Bounded to the Report line itself: the token survives elsewhere in the doc,
|
|
231
|
+
// so a whole-file match would mask its removal from the vocabulary list.
|
|
232
|
+
assert.match(DOC, /^Report merged [^\n]*head-moved-after-label-#X/m);
|
|
233
|
+
});
|