mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-27 10:24:00 +01:00
train S2: merge #3666 at 1b83c502e1 v1.91.353.0
This commit is contained in:
commit
9b84199b4c
27 files changed
+242
-34
No files matched your search
+1
-1
@@ -517,7 +517,7 @@ chooses it in item 2 and ALREADY_BUMPED derives it in item 1.
|
||||
|
||||
**One call:** `~/.gemini/antigravity-cli/skills/gstack/bin/gstack-ship-release version --base <base> [--bump <BUMP_LEVEL>] --why '<WHY>'`
|
||||
runs items 1 and 3–5; each decision left to you is a `STOP:` naming its rerun flag
|
||||
(`--bump`, `--accept-incomplete`, `--version <v>`, `--keep-current`).
|
||||
(`--bump`, `--accept-incomplete`, `--version <v>`, `--keep-current`, `--answer`).
|
||||
|
||||
`ship: queue_mode stamp-at-merge` replaces items 1–4.
|
||||
|
||||
|
||||
+1
-1
@@ -517,7 +517,7 @@ chooses it in item 2 and ALREADY_BUMPED derives it in item 1.
|
||||
|
||||
**One call:** `~/.claude/skills/gstack/bin/gstack-ship-release version --base <base> [--bump <BUMP_LEVEL>] --why '<WHY>'`
|
||||
runs items 1 and 3–5; each decision left to you is a `STOP:` naming its rerun flag
|
||||
(`--bump`, `--accept-incomplete`, `--version <v>`, `--keep-current`).
|
||||
(`--bump`, `--accept-incomplete`, `--version <v>`, `--keep-current`, `--answer`).
|
||||
|
||||
`ship: queue_mode stamp-at-merge` replaces items 1–4.
|
||||
|
||||
|
||||
+1
-1
@@ -516,7 +516,7 @@ chooses it in item 2 and ALREADY_BUMPED derives it in item 1.
|
||||
|
||||
**One call:** `$GSTACK_ROOT/bin/gstack-ship-release version --base <base> [--bump <BUMP_LEVEL>] --why '<WHY>'`
|
||||
runs items 1 and 3–5; each decision left to you is a `STOP:` naming its rerun flag
|
||||
(`--bump`, `--accept-incomplete`, `--version <v>`, `--keep-current`).
|
||||
(`--bump`, `--accept-incomplete`, `--version <v>`, `--keep-current`, `--answer`).
|
||||
|
||||
`ship: queue_mode stamp-at-merge` replaces items 1–4.
|
||||
|
||||
|
||||
+1
-1
@@ -518,7 +518,7 @@ chooses it in item 2 and ALREADY_BUMPED derives it in item 1.
|
||||
|
||||
**One call:** `$GSTACK_ROOT/bin/gstack-ship-release version --base <base> [--bump <BUMP_LEVEL>] --why '<WHY>'`
|
||||
runs items 1 and 3–5; each decision left to you is a `STOP:` naming its rerun flag
|
||||
(`--bump`, `--accept-incomplete`, `--version <v>`, `--keep-current`).
|
||||
(`--bump`, `--accept-incomplete`, `--version <v>`, `--keep-current`, `--answer`).
|
||||
|
||||
`ship: queue_mode stamp-at-merge` replaces items 1–4.
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import * as path from 'node:path';
|
||||
import { EXIT } from '../lib/headless-artifacts';
|
||||
import { checkChangelog, mergeChangelogs, normalizeChangelog, reheadChangelog } from '../lib/changelog-check';
|
||||
import { rewriteStamps, tentativeMentions } from '../lib/restamp';
|
||||
import { BUMP_NEVER_KEY_VERSION } from '../lib/ship-policy';
|
||||
import {
|
||||
BASE_POLICY, cleanup, ghShim, makeFixtureRepo, makePr, mergeToMain, readFile, recordAndBundle, restamp, runBin, type FixtureRepo, mergeMain } from './helpers/restamp-fixture';
|
||||
|
||||
@@ -192,6 +193,18 @@ describe('three PRs, reordered twice, zero manual edits', () => {
|
||||
expect(stamped.out).toMatch(/^next: NEW_VERSION=1\.2\.4\.0; record the release decision, then write the CHANGELOG entry text only/m);
|
||||
});
|
||||
|
||||
// Value: protects=a bump never repo's --next never invents a MICRO stamp: without --bump or --version it refuses and writes nothing, and an explicit level stamps as before; fails_when=restamp falls back to micro for a repo whose policy names no level;
|
||||
// why_new=GST-380 added bump never; seam=gstack-ship-policy, gstack-version-bump write; no_claim=the claim queue read
|
||||
test('bump never: --next without a level is RESTAMP_VERSION_SOURCE with nothing written; --bump stamps', () => {
|
||||
const repo = fixture({ policy: { ...BASE_POLICY, queue_mode: 'claim-at-open', bump: 'never', min_gstack_version: BUMP_NEVER_KEY_VERSION } });
|
||||
makePr(repo, 'pr-a');
|
||||
const before = readFile(repo, 'VERSION');
|
||||
const r = restamp(repo, ['--next']);
|
||||
expect([r.status, /bump never names no level.*nothing written.*\(RESTAMP_VERSION_SOURCE\)/.test(r.err)]).toEqual([3, true]);
|
||||
expect(readFile(repo, 'VERSION')).toBe(before);
|
||||
expect(restamp(repo, ['--next', '--bump', 'patch', '--dry-run']).status).toBe(EXIT.ok);
|
||||
});
|
||||
|
||||
test('claim-at-open with an unknown claim says incomplete, names the PR and never says read', () => {
|
||||
const repo = fixture({ policy: { ...BASE_POLICY, queue_mode: 'claim-at-open' }, prefix: 'gstack-restamp-github.com-' });
|
||||
makePr(repo, 'pr-a');
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { EXIT } from '../lib/headless-artifacts';
|
||||
import { CHANGELOG_FRAGMENTS_KEY_VERSION, DEFAULT_POLICY, POLICY_KEYS, POLICY_KEY_INTRODUCED, REVIEW_SCOPE_KEY_VERSION, globToRegExp, matchesAny, validatePolicy } from '../lib/ship-policy';
|
||||
import { BUMP_NEVER_KEY_VERSION, CHANGELOG_FRAGMENTS_KEY_VERSION, DEFAULT_POLICY, POLICY_KEYS, POLICY_KEY_INTRODUCED, REVIEW_SCOPE_KEY_VERSION, globToRegExp, matchesAny, minimumReader, shipConsequences, validatePolicy } from '../lib/ship-policy';
|
||||
import { fillDue } from '../lib/ship-queue-train';
|
||||
import { cmpVersion, parseVersion } from '../lib/version-source';
|
||||
import { BASE_POLICY, cleanup, makeFixtureRepo, runBin, type FixtureRepo } from './helpers/restamp-fixture';
|
||||
@@ -63,6 +63,20 @@ describe('validatePolicy (schema + containment, pure)', () => {
|
||||
expect(codes({ preregistration_shas: ['not-a-sha'] })).toEqual(['POLICY_CONTAINMENT:preregistration_shas[0]']);
|
||||
});
|
||||
|
||||
// Value: protects=bump never is refused without its floor (an older gstack names the cause) and next to any policy that stamps a version at every merge, reports its reader floor, and prints its Step 12 consequence; fails_when=never validates bare, or beside stamp-at-merge, train or changelog_fragments;
|
||||
// why_new=GST-380 added the value to an older key, which the per-key floor check skips; seam=validatePolicy, minimumReader, shipConsequences; no_claim=Step 12's behavior (test/ship-release.test.ts)
|
||||
test('bump never needs its floor and rules out every policy that stamps at merge', () => {
|
||||
const codes = (p: unknown) => validatePolicy(p).map(e => `${e.code}:${e.path}`);
|
||||
const never = { bump: 'never', min_gstack_version: BUMP_NEVER_KEY_VERSION };
|
||||
expect(codes(never)).toEqual([]);
|
||||
expect(codes({ bump: 'never' })).toEqual(['POLICY_INVALID:bump']);
|
||||
expect(codes({ bump: 'never', min_gstack_version: CHANGELOG_FRAGMENTS_KEY_VERSION })).toEqual(['POLICY_INVALID:bump']);
|
||||
const train = JSON.parse(fs.readFileSync(path.join(import.meta.dir, '..', '.gstack', 'ship-policy.json'), 'utf8')).train;
|
||||
for (const extra of [{ queue_mode: 'stamp-at-merge' }, { train }, { changelog_fragments: { dir: 'changelog.d' } }]) expect(codes({ ...never, ...extra })).toContain('POLICY_INVALID:bump');
|
||||
expect(minimumReader({ bump: 'never' })).toBe(BUMP_NEVER_KEY_VERSION);
|
||||
expect(shipConsequences({ ...DEFAULT_POLICY, bump: 'never' }, 'main').some(l => l.startsWith('bump never: Step 12 keeps VERSION'))).toBe(true);
|
||||
});
|
||||
|
||||
test('globs: ** spans directories, * stays in a segment, regex caps hold, regex metacharacters are literal', () => {
|
||||
expect(matchesAny(['docs/**/*.md'], 'docs/a/b/c.md')).toBe(true);
|
||||
expect(matchesAny(['docs/**/*.md'], 'docs/c.md')).toBe(true);
|
||||
@@ -88,7 +102,7 @@ describe('policy key versions against the CHANGELOG', () => {
|
||||
const cmp = (a: number[], b: number[]) => a[0]! - b[0]! || a[1]! - b[1]! || a[2]! - b[2]! || a[3]! - b[3]!;
|
||||
const headings = [...text.matchAll(/^## \[(\d+\.\d+\.\d+\.\d+)\]/gm)].map(m => m[1]!);
|
||||
const newest = headings.map(parse).sort(cmp).at(-1)!;
|
||||
for (const [key, version] of Object.entries(POLICY_KEY_INTRODUCED)) {
|
||||
for (const [key, version] of [...Object.entries(POLICY_KEY_INTRODUCED), ['bump', BUMP_NEVER_KEY_VERSION]]) {
|
||||
if (headings.includes(version)) continue;
|
||||
expect(cmp(parse(version), newest), `${key} is introduced in ${version}, which has no CHANGELOG heading and is not newer than the newest heading ${newest.join('.')}; an unreleased key names the release that will stamp it`).toBeGreaterThan(0);
|
||||
}
|
||||
@@ -109,7 +123,7 @@ describe('policy key versions against the CHANGELOG', () => {
|
||||
}
|
||||
const parse = (v: string) => v.split('.').map(Number);
|
||||
const cmp = (a: number[], b: number[]) => a[0]! - b[0]! || a[1]! - b[1]! || a[2]! - b[2]! || a[3]! - b[3]!;
|
||||
for (const [key, version] of Object.entries(POLICY_KEY_INTRODUCED)) {
|
||||
for (const [key, version] of [...Object.entries(POLICY_KEY_INTRODUCED), ['bump', BUMP_NEVER_KEY_VERSION]]) {
|
||||
if (cmp(parse(version), parse(REVIEW_SCOPE_KEY_VERSION)) < 0) continue;
|
||||
const section = sections.get(version);
|
||||
if (section === undefined) continue;
|
||||
@@ -208,6 +222,15 @@ describe('gstack-ship-policy (bin)', () => {
|
||||
expect(runBin(repo, 'gstack-ship-policy', ['show-effective', '--policy-from', 'head']).out).toMatch(/^policy: head \(unreviewed\)/);
|
||||
});
|
||||
|
||||
// Value: protects=validate reports bump never's own floor as the policy's minimum reader; fails_when=the CLI prints the bump key's 1.91.73.0 and a crew upgrades to a gstack that refuses the policy;
|
||||
// why_new=GST-380 outside-voice review (the CLI passed introduction versions to minimumReader); seam=bin/gstack-ship-policy; no_claim=-
|
||||
test('validate --json names bump never\'s floor as the minimum reader', () => {
|
||||
const repo = fixture();
|
||||
fs.writeFileSync(path.join(repo.work, '.gstack', 'ship-policy.json'), JSON.stringify({ bump: 'never', min_gstack_version: BUMP_NEVER_KEY_VERSION }) + '\n');
|
||||
const j = JSON.parse(runBin(repo, 'gstack-ship-policy', ['validate', '--json']).out);
|
||||
expect([j.valid, j.introduced.bump, j.min_reader]).toEqual([true, BUMP_NEVER_KEY_VERSION, BUMP_NEVER_KEY_VERSION]);
|
||||
});
|
||||
|
||||
test('POLICY_SOURCE_UNAVAILABLE (exit 3) when origin/<base> does not resolve; no fallback to the working tree', () => {
|
||||
const repo = fixture();
|
||||
const r = runBin(repo, 'gstack-ship-policy', ['show-effective', '--base', 'release']);
|
||||
|
||||
@@ -56,7 +56,8 @@ export function shipFixture(base: Record<string, string> = {}, feat: Record<stri
|
||||
must(gitIn(work, ['checkout', '-qb', 'feat']), 'branch');
|
||||
writeIn(work, feat);
|
||||
must(gitIn(work, ['add', '-A']), 'add feat'); must(gitIn(work, ['commit', '-qm', 'feat']), 'feat commit');
|
||||
const env = { ...process.env, PATH: `${stub}:${process.env.PATH}`, GSTACK_STATE_ROOT: state, GSTACK_HOME: state, GIT_AUTHOR_NAME: 'Fixture', GIT_AUTHOR_EMAIL: 'fixture@example.com',
|
||||
const { GSTACK_SESSION_KIND: _k, GSTACK_HEADLESS: _h, OPENCLAW_SESSION: _o, CI: _c, GITHUB_ACTIONS: _g, ...ambient } = process.env;
|
||||
const env = { ...ambient, PATH: `${stub}:${process.env.PATH}`, GSTACK_STATE_ROOT: state, GSTACK_HOME: state, GIT_AUTHOR_NAME: 'Fixture', GIT_AUTHOR_EMAIL: 'fixture@example.com',
|
||||
GIT_COMMITTER_NAME: 'Fixture', GIT_COMMITTER_EMAIL: 'fixture@example.com', GIT_CONFIG_GLOBAL: path.join(root, 'gitconfig') };
|
||||
fs.writeFileSync(path.join(root, 'gitconfig'), '[commit]\n\tgpgsign = false\n');
|
||||
const fx: ShipFx = {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { afterEach, describe, expect, setDefaultTimeout, test } from 'bun:test';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { BUMP_NEVER_KEY_VERSION } from '../lib/ship-policy';
|
||||
import { lineOf, RELEASE, shipFixture, type ShipFx } from './helpers/ship-bin-fixture';
|
||||
|
||||
setDefaultTimeout(60_000);
|
||||
@@ -60,6 +61,92 @@ describe('version (Step 12)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('version (Step 12): keeping VERSION and waiting for the bump answer (GST-380)', () => {
|
||||
const UNATTENDED = { GSTACK_SESSION_KIND: 'unattended' };
|
||||
const untouched = (f: ShipFx) => {
|
||||
expect(read(f, 'VERSION')).toBe('1.0.0.0\n');
|
||||
expect(JSON.parse(read(f, 'package.json')).version).toBe('1.0.0');
|
||||
expect(read(f, 'CHANGELOG.md')).toContain('## [Unreleased]');
|
||||
expect(f.git('status', '--porcelain').stdout).toBe('');
|
||||
};
|
||||
|
||||
// Value: protects=a repo whose unit PRs never change VERSION can pass Step 12 with --keep-current or --version <current> on a FRESH branch, and nothing is written or claimed; fails_when=FRESH demands a level before it reads those flags (gstack-evals#85: BUMP_LEVEL needed for all three flags);
|
||||
// why_new=GST-380; seam=gstack-version-bump classify; no_claim=the queue's live host read
|
||||
test('FRESH under bump ask: --keep-current and --version <current> keep VERSION with no write', () => {
|
||||
for (const args of [['--keep-current'], ['--version', '1.0.0.0']]) {
|
||||
const f = fx();
|
||||
const r = f.run(RELEASE, ['version', '--base', 'main', ...args]);
|
||||
expect([r.status, lineOf(r.stdout, 'VERSION')]).toEqual([0, expect.stringMatching(/^VERSION: 1\.0\.0\.0 kept \(FRESH, /)]);
|
||||
expect(r.stdout).toContain('NEXT: Step 13');
|
||||
untouched(f);
|
||||
}
|
||||
const g = fx();
|
||||
const incomplete = g.run(RELEASE, ['version', '--base', 'main', '--accept-incomplete']);
|
||||
expect([incomplete.status, incomplete.stdout.includes('--keep-current')]).toEqual([3, true]);
|
||||
untouched(g);
|
||||
});
|
||||
|
||||
// Value: protects=in a session no person answers (unattended, spawned, OpenClaw, headless) a bump under bump ask waits for the owner's words before anything is written; fails_when=the bin writes VERSION on a --bump the agent took as the recommended option (gstack-evals#89 wrote 0.0.2 before anyone was asked);
|
||||
// why_new=GST-380; seam=gstack-session-kind's classification, gstack-version-bump write; no_claim=that the words came from the owner
|
||||
test('an unattended --bump under bump ask stops with BUMP_ANSWER_REQUIRED and writes nothing until --answer', () => {
|
||||
const sessions: Record<string, string>[] = [UNATTENDED, { GSTACK_SESSION_KIND: 'spawned' }, { OPENCLAW_SESSION: '1' }, { GSTACK_HEADLESS: '1' }];
|
||||
for (const env of sessions) {
|
||||
const f = fx();
|
||||
const r = f.run(RELEASE, ['version', '--base', 'main', '--bump', 'micro', '--why', 'small'], env);
|
||||
expect([r.status, /^STOP: BUMP_ANSWER_REQUIRED/m.test(r.stdout), r.stdout.includes('--keep-current')]).toEqual([3, true, true]);
|
||||
untouched(f);
|
||||
}
|
||||
const f = fx();
|
||||
expect(f.run(RELEASE, ['version', '--base', 'main', '--bump', 'micro', '--answer', '--why', 'x'], UNATTENDED).status).toBe(2);
|
||||
for (const bad of [' ', 'a\nb', 'x'.repeat(201)]) expect(f.run(RELEASE, ['version', '--base', 'main', '--bump', 'micro', '--answer', bad], UNATTENDED).status).toBe(2);
|
||||
untouched(f);
|
||||
const ok = f.run(RELEASE, ['version', '--base', 'main', '--bump', 'micro', '--answer', 'micro is fine'], UNATTENDED);
|
||||
expect([ok.status, read(f, 'VERSION')]).toEqual([0, '1.0.0.1\n']);
|
||||
const rebump = f.run(RELEASE, ['version', '--base', 'main', '--version', '2.0.0.0'], UNATTENDED);
|
||||
expect([rebump.status, rebump.stdout.includes('BUMP_ANSWER_REQUIRED'), rebump.stdout.includes('Ask: --version 2.0.0.0 (recommended), keep 1.0.0.1'), read(f, 'VERSION')]).toEqual([3, true, true, '1.0.0.1\n']);
|
||||
expect(f.run(RELEASE, ['version', '--base', 'main', '--version', '1.0.0.0'], UNATTENDED).stdout).toContain('STOP: 1.0.0.0 is not above the base version 1.0.0.0');
|
||||
const rewritten = f.run(RELEASE, ['version', '--base', 'main', '--version', '2.0.0.0', '--answer', 'go to 2.0.0.0'], UNATTENDED);
|
||||
expect([rewritten.status, read(f, 'VERSION')]).toEqual([0, '2.0.0.0\n']);
|
||||
const both = fx().run(RELEASE, ['version', '--base', 'main', '--bump', 'micro', '--version', '1.0.0.5'], UNATTENDED);
|
||||
expect([both.status, both.stdout.includes('Ask: --bump micro --version 1.0.0.5 (recommended)')]).toEqual([3, true]);
|
||||
const patch = fx({ '.gstack/ship-policy.json': '{"bump":"patch"}\n' });
|
||||
expect([patch.run(RELEASE, ['version', '--base', 'main'], UNATTENDED).status, read(patch, 'VERSION')]).toEqual([0, '1.0.1.0\n']);
|
||||
});
|
||||
|
||||
// Value: protects=bump never keeps VERSION with no flag and no question, refuses a bump or a different --version, and stops on a branch that moved VERSION; fails_when=a never repo gets a write, a question, or a silently kept bump;
|
||||
// why_new=GST-380 added bump never; seam=gstack-ship-policy show-effective, gstack-version-bump classify; no_claim=the release process's own bump
|
||||
test('bump never keeps VERSION with no flag, refuses a bump, and stops on a bumped branch', () => {
|
||||
const policy = { '.gstack/ship-policy.json': JSON.stringify({ bump: 'never', min_gstack_version: BUMP_NEVER_KEY_VERSION }) + '\n' };
|
||||
const f = fx(policy);
|
||||
const kept = f.run(RELEASE, ['version', '--base', 'main'], UNATTENDED);
|
||||
expect([kept.status, lineOf(kept.stdout, 'VERSION')]).toEqual([0, 'VERSION: 1.0.0.0 kept (policy: bump never; no write)']);
|
||||
for (const args of [['--bump', 'micro', '--answer', 'yes'], ['--version', '1.0.0.1']]) {
|
||||
const r = f.run(RELEASE, ['version', '--base', 'main', ...args]);
|
||||
expect([r.status, r.stdout.includes('STOP: policy bump never: unit PRs keep VERSION at 1.0.0.0')]).toEqual([3, true]);
|
||||
}
|
||||
untouched(f);
|
||||
const bumped = fx(policy, { VERSION: '1.0.0.1\n' });
|
||||
const moved = bumped.run(RELEASE, ['version', '--base', 'main']);
|
||||
expect([moved.status, moved.stdout.includes('STOP: VERSION moved from 1.0.0.0 to 1.0.0.1 but the policy says bump never')]).toEqual([3, true]);
|
||||
const stale = fx(policy, { VERSION: '1.0.0.1\n', 'package.json': '{"name":"fx","version":"0.9.0"}\n' });
|
||||
const drift = stale.run(RELEASE, ['version', '--base', 'main']);
|
||||
expect([drift.status, drift.stdout.includes('but the policy says bump never'), drift.stdout.includes('REPAIR:')]).toEqual([3, true, false]);
|
||||
});
|
||||
|
||||
// Value: protects=a --bump beside --keep-current or --version <current> is a contradiction the bin names instead of picking one; fails_when=it silently keeps or silently bumps;
|
||||
// why_new=GST-380 review F8 (flag precedence); seam=none; no_claim=-
|
||||
test('--bump or --version <other> with --keep-current or --version <current> stops and writes nothing', () => {
|
||||
const f = fx();
|
||||
for (const args of [['--keep-current'], ['--version', '1.0.0.0']]) {
|
||||
const r = f.run(RELEASE, ['version', '--base', 'main', '--bump', 'micro', ...args]);
|
||||
expect([r.status, r.stdout.includes('STOP: --bump micro moves VERSION and')]).toEqual([3, true]);
|
||||
}
|
||||
const keepAndMove = f.run(RELEASE, ['version', '--base', 'main', '--keep-current', '--version', '1.0.0.5']);
|
||||
expect([keepAndMove.status, keepAndMove.stdout.includes('STOP: --version 1.0.0.5 moves VERSION and --keep-current keeps it')]).toEqual([3, true]);
|
||||
untouched(f);
|
||||
});
|
||||
});
|
||||
|
||||
describe('finish (Steps 15-16)', () => {
|
||||
// Value: protects=finish commits only release metadata with the trailer, then checks the reviewed-tree route, docs freshness, each lane receipt and the pregate; fails_when=it commits feature files, skips a stage, or pushes;
|
||||
// why_new=moved from Steps 15-16; seam=gstack-wtree, gstack-docs-candidate compare, gstack-evidence, gstack-pregate; no_claim=the stage 5 report
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"bytes": 252,
|
||||
"why": "GST-380: Step 12 kept-version CHANGELOG route, --answer flag and the BUMP_ANSWER_REQUIRED approval in the driver"
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
import { afterEach, describe, expect, test } from 'bun:test';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { BUMP_NEVER_KEY_VERSION } from '../lib/ship-policy';
|
||||
import { BASE_POLICY, cleanup, makeFixtureRepo, ROOT, type FixtureRepo } from './helpers/restamp-fixture';
|
||||
|
||||
const SCRIPT = path.join(ROOT, 'scripts', 'compare-pr-version.ts');
|
||||
@@ -24,6 +25,24 @@ function run(r: FixtureRepo, head: string, extra: Record<string, string> = {}, c
|
||||
return { code: out.exitCode, out: out.stdout.toString() + out.stderr.toString() };
|
||||
}
|
||||
|
||||
describe('version gate: bump never', () => {
|
||||
// Value: protects=under bump never the Version Gate passes a head that keeps VERSION, and a release head that moves it goes through the ordinary bump and collision rules; fails_when=the gate rejects every kept-version PR as "VERSION not bumped", or rejects every release PR;
|
||||
// why_new=GST-380 added bump never (outside-voice review, fix-check); seam=classifyTrainHead, scripts/compare-pr-version.ts; no_claim=who may open a release PR
|
||||
test('a kept VERSION passes; a moved VERSION takes the ordinary rules', () => {
|
||||
const r = makeFixtureRepo({ policy: { ...BASE_POLICY, queue_mode: 'claim-at-open', release_tool: null, release_outputs: [], bump: 'never', min_gstack_version: BUMP_NEVER_KEY_VERSION }, prefix: 'version-gate-never-' });
|
||||
repos.push(r);
|
||||
r.git('checkout', '-q', '-b', 'k');
|
||||
write(r, 'k.txt', 'k\n');
|
||||
const kept = run(r, commit(r, 'k'));
|
||||
expect([kept.code, kept.out.includes('as the base\'s ship policy (bump never) requires')]).toEqual([0, true]);
|
||||
write(r, 'VERSION', '1.2.4.0\n');
|
||||
const moved = run(r, commit(r, 'bump'));
|
||||
expect([moved.code, moved.out.includes('bump never')]).toEqual([0, false]);
|
||||
const collides = run(r, r.git('rev-parse', 'HEAD').trim(), {}, [{ pr: 7, branch: 'other', version: '1.2.4.0' }]);
|
||||
expect([collides.code, collides.out.includes('VERSION collision')]).toEqual([1, true]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('version gate: changelog fragments', () => {
|
||||
test('a fragment head passes, a dependency or script edit beside it too', () => {
|
||||
const r = fixture();
|
||||
|
||||
Reference in new issue
Block a user