@feigi/fleet-ctl 3.23.35 → 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,187 +0,0 @@
|
|
|
1
|
-
// The claim → push → merge → reap lifecycle, driven end to end against a real
|
|
2
|
-
// bare origin. #760 is a bug about a branch's UPSTREAM, and an upstream is only
|
|
3
|
-
// observable through what the other scripts do with it — so pinning the config
|
|
4
|
-
// values claim-ticket.sh writes proves nothing about whether reap.sh can see
|
|
5
|
-
// the branch or release-ticket.sh can delete it. A first cut of #760 did pin
|
|
6
|
-
// exactly those values, went green, and had in fact made a freshly claimed
|
|
7
|
-
// branch read `[gone]` immediately: `reap.sh --apply` deleted the worktree and
|
|
8
|
-
// the branch before any work was done in them. These tests are the consequence
|
|
9
|
-
// coverage that gap needed.
|
|
10
|
-
//
|
|
11
|
-
// Zero deps: `node --test plugin/scripts/claim-lifecycle.test.mjs`.
|
|
12
|
-
|
|
13
|
-
import { test } from "node:test";
|
|
14
|
-
import assert from "node:assert/strict";
|
|
15
|
-
import { execFileSync, spawnSync } from "node:child_process";
|
|
16
|
-
import { mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
17
|
-
import { tmpdir } from "node:os";
|
|
18
|
-
import { join } from "node:path";
|
|
19
|
-
import { fileURLToPath } from "node:url";
|
|
20
|
-
import { writeExecStub } from "./exec-stub.mjs";
|
|
21
|
-
import { worktreeNames } from "./worktree-porcelain.mjs";
|
|
22
|
-
|
|
23
|
-
const CLAIM = fileURLToPath(new URL("./claim-ticket.sh", import.meta.url));
|
|
24
|
-
const REAP = fileURLToPath(new URL("./reap.sh", import.meta.url));
|
|
25
|
-
const RELEASE = fileURLToPath(new URL("./release-ticket.sh", import.meta.url));
|
|
26
|
-
|
|
27
|
-
// Cut the developer's ~/.gitconfig out of the fixture: a local `push.default`
|
|
28
|
-
// or `branch.autoSetupMerge` decides the very behaviour under test here.
|
|
29
|
-
const BASE_ENV = {
|
|
30
|
-
...process.env,
|
|
31
|
-
BASE_REF: undefined,
|
|
32
|
-
GIT_DIR: undefined,
|
|
33
|
-
GIT_WORK_TREE: undefined,
|
|
34
|
-
GIT_AUTHOR_NAME: "t",
|
|
35
|
-
GIT_AUTHOR_EMAIL: "t@example.com",
|
|
36
|
-
GIT_COMMITTER_NAME: "t",
|
|
37
|
-
GIT_COMMITTER_EMAIL: "t@example.com",
|
|
38
|
-
GIT_CONFIG_GLOBAL: "/dev/null",
|
|
39
|
-
GIT_CONFIG_SYSTEM: "/dev/null",
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Bare origin + a clone standing in for the fleet's checkout, plus a `gh` stub
|
|
44
|
-
* on PATH. `gh issue view` answers `in-progress` because release-ticket.sh
|
|
45
|
-
* reads the label before it deletes anything.
|
|
46
|
-
*/
|
|
47
|
-
function fixture(t) {
|
|
48
|
-
// realpathSync: macOS resolves /var through /private, and git canonicalises
|
|
49
|
-
// the paths it reports, so a raw mkdtemp path never string-matches them.
|
|
50
|
-
const root = realpathSync(mkdtempSync(join(tmpdir(), "lifecycle-")));
|
|
51
|
-
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
52
|
-
const origin = join(root, "origin.git");
|
|
53
|
-
const w = join(root, "w");
|
|
54
|
-
const bin = join(root, "bin");
|
|
55
|
-
execFileSync("git", ["-c", "init.defaultBranch=main", "init", "-q", "--bare", origin], { env: BASE_ENV });
|
|
56
|
-
execFileSync("git", ["clone", "-q", origin, w], { env: BASE_ENV });
|
|
57
|
-
execFileSync("mkdir", ["-p", bin]);
|
|
58
|
-
writeExecStub(join(bin, "gh"), '#!/bin/sh\ncase "$*" in *"issue view"*) echo in-progress;; esac\nexit 0\n');
|
|
59
|
-
const env = { ...BASE_ENV, PATH: `${bin}:${process.env.PATH}` };
|
|
60
|
-
const git = (cwd, ...a) => execFileSync("git", a, { cwd, env, encoding: "utf8" }).trim();
|
|
61
|
-
writeFileSync(join(w, "README.md"), "fixture\n");
|
|
62
|
-
git(w, "add", "-A");
|
|
63
|
-
git(w, "commit", "-q", "-m", "root");
|
|
64
|
-
git(w, "branch", "-M", "main");
|
|
65
|
-
git(w, "push", "-q", "-u", "origin", "main");
|
|
66
|
-
// claim-ticket.sh refuses a repo with no Recipe cache (ADR 0015). The
|
|
67
|
-
// smallest proven one: nothing to install, nothing to fail. Untracked, in
|
|
68
|
-
// the checkout's own `.fleet/`, which is where derive-testcmd.sh reads it.
|
|
69
|
-
execFileSync("mkdir", ["-p", join(w, ".fleet")]);
|
|
70
|
-
writeFileSync(join(w, ".fleet", "recipe.json"), JSON.stringify({
|
|
71
|
-
install: "true", test: "true", derivedAt: git(w, "rev-parse", "HEAD"), installClean: true, testCount: 1,
|
|
72
|
-
}));
|
|
73
|
-
return { root, origin, w, env, git };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const sh = (script, cwd, env, ...args) =>
|
|
77
|
-
spawnSync("sh", [script, ...args], { cwd, env, encoding: "utf8" });
|
|
78
|
-
|
|
79
|
-
/** What reap.sh's sweep selects on: `%(upstream:track)` for one branch. */
|
|
80
|
-
const track = (git, w, branch) =>
|
|
81
|
-
git(w, "for-each-ref", "--format=%(upstream:track)", `refs/heads/${branch}`);
|
|
82
|
-
|
|
83
|
-
/** Advance origin/main past the claim's base, without merging it locally. */
|
|
84
|
-
function staleLocalMain({ origin, root, env, git }) {
|
|
85
|
-
const other = join(root, "other");
|
|
86
|
-
execFileSync("git", ["clone", "-q", origin, other], { env });
|
|
87
|
-
git(other, "commit", "-q", "--allow-empty", "-m", "later");
|
|
88
|
-
git(other, "push", "-q", "origin", "HEAD:main");
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
test("a freshly claimed branch is not [gone], and reap.sh leaves it alone", (t) => {
|
|
92
|
-
const f = fixture(t);
|
|
93
|
-
const claim = sh(CLAIM, f.w, f.env, "42", "slug", "fix", "--apply");
|
|
94
|
-
assert.equal(claim.status, 0, claim.stdout + claim.stderr);
|
|
95
|
-
|
|
96
|
-
const wt = join(f.w, ".worktrees", "42-slug");
|
|
97
|
-
// #760's own measurement: an upstream of origin/main makes `@{u}` RESOLVE,
|
|
98
|
-
// so every "did my push land?" check answers about main instead. It has to
|
|
99
|
-
// fail loudly, and the failure has to be the missing-upstream one — a claim
|
|
100
|
-
// whose upstream merely names an absent ref resolves here just fine.
|
|
101
|
-
const u = spawnSync("git", ["-C", wt, "rev-parse", "--abbrev-ref", "@{u}"], { env: f.env, encoding: "utf8" });
|
|
102
|
-
assert.notEqual(u.status, 0, u.stdout);
|
|
103
|
-
assert.match(u.stderr, /no upstream configured/);
|
|
104
|
-
|
|
105
|
-
// An upstream naming a remote ref that has never existed reads `[gone]` here
|
|
106
|
-
// — indistinguishable, to reap.sh, from a merged branch whose remote was
|
|
107
|
-
// deleted. No upstream at all reads empty.
|
|
108
|
-
assert.equal(track(f.git, f.w, "fix/42-slug"), "");
|
|
109
|
-
|
|
110
|
-
const reaped = sh(REAP, f.w, f.env, "--apply");
|
|
111
|
-
assert.equal(reaped.status, 0, reaped.stdout + reaped.stderr);
|
|
112
|
-
assert.deepEqual(JSON.parse(reaped.stdout).reaped, []);
|
|
113
|
-
// Positive control on the same run: the branch and its worktree survived.
|
|
114
|
-
assert.equal(f.git(f.w, "rev-parse", "--verify", "refs/heads/fix/42-slug").length, 40);
|
|
115
|
-
assert.ok(worktreeNames(f.git(f.w, "worktree", "list", "--porcelain")).includes("42-slug"));
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test("after push -u, merge and prune, reap.sh does see the branch as [gone]", (t) => {
|
|
119
|
-
const f = fixture(t);
|
|
120
|
-
assert.equal(sh(CLAIM, f.w, f.env, "42", "slug", "fix", "--apply").status, 0);
|
|
121
|
-
const wt = join(f.w, ".worktrees", "42-slug");
|
|
122
|
-
|
|
123
|
-
// The documented first push (skills/next-ticket/SKILL.md step 7) is what
|
|
124
|
-
// establishes the real upstream — nothing before it should have.
|
|
125
|
-
f.git(wt, "commit", "-q", "--allow-empty", "-m", "work");
|
|
126
|
-
f.git(wt, "push", "-q", "-u", "origin", "HEAD");
|
|
127
|
-
assert.equal(f.git(f.w, "config", "--get", "branch.fix/42-slug.merge"), "refs/heads/fix/42-slug");
|
|
128
|
-
|
|
129
|
-
// Merge and delete the remote branch, the way GitHub does.
|
|
130
|
-
f.git(wt, "push", "-q", "origin", "HEAD:main");
|
|
131
|
-
f.git(wt, "push", "-q", "origin", ":refs/heads/fix/42-slug");
|
|
132
|
-
f.git(f.w, "fetch", "-q", "--prune", "origin");
|
|
133
|
-
assert.equal(track(f.git, f.w, "fix/42-slug"), "[gone]");
|
|
134
|
-
|
|
135
|
-
const reaped = sh(REAP, f.w, f.env, "--apply");
|
|
136
|
-
assert.equal(reaped.status, 0, reaped.stdout + reaped.stderr);
|
|
137
|
-
assert.deepEqual(JSON.parse(reaped.stdout).reaped, ["fix/42-slug"]);
|
|
138
|
-
assert.equal(
|
|
139
|
-
spawnSync("git", ["-C", f.w, "rev-parse", "--verify", "refs/heads/fix/42-slug"], { env: f.env }).status,
|
|
140
|
-
128,
|
|
141
|
-
);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
test("release-ticket.sh --apply releases an untouched claim while local main is stale", (t) => {
|
|
145
|
-
const f = fixture(t);
|
|
146
|
-
// ORDER IS THE WHOLE TEST. origin/main advances and is fetched BEFORE the
|
|
147
|
-
// claim, so the branch is cut from a commit local main has never reached.
|
|
148
|
-
// Advance origin AFTER the claim instead and the branch's base still equals
|
|
149
|
-
// local HEAD, `git branch -d` finds it trivially merged, and the test goes
|
|
150
|
-
// green against the very bug it exists to catch — measured, that ordering
|
|
151
|
-
// let a `-d` mutant through.
|
|
152
|
-
staleLocalMain(f);
|
|
153
|
-
f.git(f.w, "fetch", "-q", "origin");
|
|
154
|
-
assert.equal(sh(CLAIM, f.w, f.env, "42", "slug", "fix", "--apply").status, 0);
|
|
155
|
-
// The claim's base is not an ancestor of local HEAD, so `git branch -d`
|
|
156
|
-
// — which falls back to comparing against HEAD once the branch has no
|
|
157
|
-
// resolvable upstream — refuses, half-releasing the claim: worktree deleted,
|
|
158
|
-
// branch stranded, in-progress still on the issue.
|
|
159
|
-
assert.notEqual(f.git(f.w, "rev-parse", "main"), f.git(f.w, "rev-parse", "origin/main"));
|
|
160
|
-
assert.equal(f.git(f.w, "rev-parse", "refs/heads/fix/42-slug"), f.git(f.w, "rev-parse", "origin/main"));
|
|
161
|
-
|
|
162
|
-
const rel = sh(RELEASE, f.w, f.env, "42", "slug", "fix", "--apply");
|
|
163
|
-
assert.equal(rel.status, 0, rel.stdout + rel.stderr);
|
|
164
|
-
const receipt = JSON.parse(rel.stdout.trim().split("\n").pop());
|
|
165
|
-
assert.equal(receipt.released, true);
|
|
166
|
-
assert.deepEqual(receipt.blockers, []);
|
|
167
|
-
assert.equal(
|
|
168
|
-
spawnSync("git", ["-C", f.w, "rev-parse", "--verify", "refs/heads/fix/42-slug"], { env: f.env }).status,
|
|
169
|
-
128,
|
|
170
|
-
);
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
test("release-ticket.sh still refuses a claim that carries work", (t) => {
|
|
174
|
-
// The control the previous test needs: `-D` is authorized by the `ahead` and
|
|
175
|
-
// `git cherry` guards, so those guards have to still block. Without this a
|
|
176
|
-
// fix that deletes unconditionally passes the test above.
|
|
177
|
-
const f = fixture(t);
|
|
178
|
-
assert.equal(sh(CLAIM, f.w, f.env, "42", "slug", "fix", "--apply").status, 0);
|
|
179
|
-
f.git(join(f.w, ".worktrees", "42-slug"), "commit", "-q", "--allow-empty", "-m", "work");
|
|
180
|
-
|
|
181
|
-
const rel = sh(RELEASE, f.w, f.env, "42", "slug", "fix", "--apply");
|
|
182
|
-
assert.equal(rel.status, 1, rel.stdout + rel.stderr);
|
|
183
|
-
const receipt = JSON.parse(rel.stdout.trim().split("\n").pop());
|
|
184
|
-
assert.equal(receipt.released, false);
|
|
185
|
-
assert.match(receipt.blockers.join(" "), /commit\(s\) ahead/);
|
|
186
|
-
assert.equal(f.git(f.w, "rev-parse", "--verify", "refs/heads/fix/42-slug").length, 40);
|
|
187
|
-
});
|