mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-27 02:14:30 +01:00
Merge main 1ccab0d8 into gsta258-l4-ready-receipts (rule 19 grant)
test/review-packets-removed.test.ts takes main's version (#3903 moved the review pins to test/fixtures/review-pins/). This branch's two pin entries become pin files with GSTA-202's recipe: a new replays/GST-508+GST-464+GST-967+GSTA-258-L4.json and the files/ship/sections/review-army.md.json repin to 22c37a64. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
commit
04a02bce2b
180 files changed
+3123
-433
No files matched your search
@@ -53,6 +53,25 @@ describe('E18: a repository without a version source or CHANGELOG', () => {
|
||||
expect(JSON.parse(fs.readFileSync(path.join(out, 'ship-run.json'), 'utf8')).version).toBe('none');
|
||||
});
|
||||
|
||||
// Value: protects=a receipt write --version named in a repository with no version source keeps that version through a
|
||||
// carry (GST-1030 review); fails_when=the carry refuses because HEAD has no readable version, or drops the version;
|
||||
// seam=bin/gstack-ship-receipt cmdCarry
|
||||
test('a carry keeps the version write --version named when HEAD has no version source (GST-1030)', () => {
|
||||
const repo = fixture();
|
||||
for (const f of ['VERSION', 'package.json', 'package-lock.json']) fs.rmSync(path.join(repo.work, f));
|
||||
repo.git('add', '-A'); repo.git('commit', '-qm', 'changelog only'); repo.git('push', '-q', 'origin', 'main');
|
||||
makePr(repo, 'pr-unversioned');
|
||||
const body = path.join(repo.root, 'body.md');
|
||||
fs.writeFileSync(body, '## Summary\n');
|
||||
expect(runBin(repo, 'gstack-ship-receipt', ['write', '--pr', '3', '--base', 'main', '--session-kind', 'x', '--version', '2.0.0', '--body', body]).status).toBe(EXIT.ok);
|
||||
fs.mkdirSync(path.join(repo.work, 'test'), { recursive: true });
|
||||
fs.writeFileSync(path.join(repo.work, 'test', 'a.test.ts'), 'test a\n');
|
||||
repo.git('add', '-A'); repo.git('commit', '-qm', 'a test-only change');
|
||||
const carried = runBin(repo, 'gstack-ship-receipt', ['carry', '--body', body, '--base', 'main']);
|
||||
expect(carried.out, carried.err).toContain('CARRY: carried');
|
||||
expect(extractReceipt(fs.readFileSync(body, 'utf8')).receipt?.version).toBe('2.0.0');
|
||||
});
|
||||
|
||||
test('a repository with a version source keeps its version, and one with only a CHANGELOG records no version rather than "none"', () => {
|
||||
const repo = fixture();
|
||||
const w = runBin(repo, 'gstack-ship-receipt', ['write', '--base', 'main', '--session-kind', 'x', '--json']);
|
||||
@@ -248,6 +267,25 @@ describe('carry follow-ups: git floor, named refusal, branch-touched walk, digit
|
||||
expect(stampOnlyText({ before, after: lines(key('1.2.3.0'), key('1.2.4.0')), oldVersion: '1.2.4.0', newVersion: '1.2.4.0', templates })).toBe(false);
|
||||
});
|
||||
|
||||
// Value: protects=the carry classifier reads a declared placeholder moved to the new version on the branch's own row
|
||||
// as a stamp, through the same predicate as finish and the tree receipt (GST-1026); fails_when=stampOnlyText ignores
|
||||
// the policy's placeholders, or accepts an undeclared one or a base row; seam=lib/ship-receipt.ts stampOnlyText
|
||||
test('stampOnlyText reads a declared placeholder moved on the branch\'s own row as a stamp, and nothing else (GST-1026)', () => {
|
||||
const templates = ["since: '{version}'"];
|
||||
const row = (v: string, id: string) => ` { since: '${v}', id: '${id}' },`;
|
||||
const text = (...rows: string[]) => ['export const ROWS = [', ...rows, '];', ''].join('\n');
|
||||
const before = text(row('TBD', 'base'), row('TBD', 'mine'));
|
||||
const side = { fork: '0.60.552.0', added: new Set([row('TBD', 'mine')]), at: new Set([3]) };
|
||||
const change = (after: string, extra: Record<string, unknown> = {}) => stampOnlyText({ before, after, oldVersion: '0.60.552.0', newVersion: '0.60.553.0', templates, side, placeholders: ['TBD'], ...extra });
|
||||
expect(change(text(row('TBD', 'base'), row('0.60.553.0', 'mine')))).toBe(true);
|
||||
expect(change(text(row('TBD', 'base'), row('0.60.553.0', 'mine')), { oldVersion: '0.60.553.0' })).toBe(true);
|
||||
expect(change(text(row('TBD', 'base'), row('0.60.553.0', 'mine')), { placeholders: [] })).toBe(false);
|
||||
expect(change(text(row('TBD', 'base'), row('0.60.553.0', 'mine')), { placeholders: ['WIP'] })).toBe(false);
|
||||
expect(change(text(row('TBD', 'base'), row('0.60.553.0', 'mine')), { templates: [] })).toBe(false);
|
||||
expect(change(text(row('TBD', 'base'), row('0.60.553.0', 'mine')), { side: undefined })).toBe(false);
|
||||
expect(change(text(row('0.60.553.0', 'base'), row('TBD', 'mine')))).toBe(false);
|
||||
});
|
||||
|
||||
test('planCarry names at most CARRY_NAMED_PATHS paths', () => {
|
||||
const many = Array.from({ length: CARRY_NAMED_PATHS + 3 }, (_, i) => `src/f${i}.ts`);
|
||||
const plan = planCarry({ from: 'a'.repeat(40), head: 'b'.repeat(40), changed: many.map(p => ({ path: p, class: 'product' as const })), productPatchId: { from: 'x', head: 'y' }, testPatchId: { from: '', head: '' }, changedProduct: many, mergeCommits: 0, rangeDiff: '' });
|
||||
|
||||
Reference in new issue
Block a user