mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-20 15:13:47 +01:00
train S2: merge #3884 at 523de7d435 v1.93.19.0
This commit is contained in:
commit
2dff7c8e35
8 files changed
+123
-26
No files matched your search
@@ -142,6 +142,57 @@ describe('the Review-loop exception line (GST-977, gstack-evals #139)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('the Documentation exception line (GST-983)', () => {
|
||||
const excepted = {
|
||||
...receipt,
|
||||
gate: { status: 'green', run: '983', unit: { pass: 1181, skip: 70 } },
|
||||
docs: { status: 'blocked', scope: 'docs/', exception: { accepted_by: 'Garry', date: '2026-11-02', via: 'GSTA-36', reason: 'sections 1 and 2 skip the audit' } },
|
||||
};
|
||||
const line = 'Documentation exception: accepted by Garry 2026-11-02 via GSTA-36: sections 1 and 2 skip the audit';
|
||||
|
||||
// Value: protects=a body that carries the docs exception line write requires can also pass --check-prose; fails_when=the
|
||||
// owner's reason is read as counter claims ("2 skip" against 70); seam=lib/ship-receipt-prose.ts checkReceiptProse
|
||||
test('the exact line the receipt\'s docs exception requires is not prose; the rest of the body still is', () => {
|
||||
expect(checkReceiptProse(excepted, `## Documentation\n\n${line}\n\nGate: 70 skip.\n`)).toEqual({ checked: 1, mismatches: [] });
|
||||
expect(checkReceiptProse(excepted, ` ${line}\r\nGate: 69 skip.`).mismatches).toEqual([{ field: 'gate.unit.skip', prose: 69, receipt: 70 }]);
|
||||
});
|
||||
|
||||
test('the same words anywhere else, a line for a different exception, or a receipt with no exception stay prose', () => {
|
||||
const twoSkip = [{ field: 'gate.unit.skip', prose: 2, receipt: 70 }];
|
||||
expect(checkReceiptProse(excepted, `Note: ${line}`).mismatches).toEqual(twoSkip);
|
||||
expect(checkReceiptProse(excepted, line.replace('GSTA-36', 'GSTA-37')).mismatches).toEqual(twoSkip);
|
||||
expect(checkReceiptProse({ ...excepted, docs: { status: 'current', scope: 'docs/' } }, line).mismatches).toEqual(twoSkip);
|
||||
});
|
||||
});
|
||||
|
||||
describe('code fences are not prose (GST-984, gstack-evals #142)', () => {
|
||||
const lanes = { ...receipt, gate: { status: 'green', run: '142', passed: 1181, failed: 0, unit: { pass: 1181, fail: 0 } } };
|
||||
const evidence = '```text\n- // one none trial per band task (the first 35 fail) and one told trial per pilot task.\nr3-drop, r3, r3-sol: 113 passed, 0 failed with the real list\nunit: 113 pass, 0 fail\n```\n';
|
||||
|
||||
// Value: protects=pasted test output and quoted code in a fence never count as this PR's counters; fails_when=the
|
||||
// fenced "113 passed" or "35 fail" is read against the receipt; seam=lib/ship-receipt-prose.ts checkReceiptProse
|
||||
test('numbers inside a closed fence are skipped; counts outside it are still checked', () => {
|
||||
expect(checkReceiptProse(lanes, `Gate: 1181 passed.\n\n${evidence}\nUnit: 1181 pass.\n`)).toEqual({ checked: 2, mismatches: [] });
|
||||
expect(checkReceiptProse(lanes, `${evidence}\nUnit: 113 pass.\n`).mismatches).toEqual([{ field: 'gate.unit.pass', prose: 113, receipt: 1181 }]);
|
||||
expect(checkReceiptProse(lanes, evidence.replace(/```/g, '~~~~').replace(/~~~~\n$/, '~~~~~\n'))).toEqual({ checked: 0, mismatches: [] });
|
||||
});
|
||||
|
||||
test('a fence closes only on its own run, an unclosed fence stays prose, and the fence still separates the text around it', () => {
|
||||
const short = '````\n113 pass\n```\nstill fenced 113 pass\n````\n';
|
||||
expect(checkReceiptProse(lanes, short)).toEqual({ checked: 0, mismatches: [] });
|
||||
expect(checkReceiptProse(lanes, 'Intro\n```text\n113 pass\n').mismatches).toEqual([{ field: 'gate.unit.pass', prose: 113, receipt: 1181 }]);
|
||||
expect(checkReceiptProse(lanes, 'Shipped 3\n```\nx\n```\npass rates are below.\n')).toEqual({ checked: 0, mismatches: [] });
|
||||
});
|
||||
|
||||
// Value: protects=a line that only looks like a fence opener, or a shorter fence inside an unclosed one, cannot hide a
|
||||
// claim GitHub shows as prose; fails_when=either shape skips the "113 pass" after it; seam=lib/ship-receipt-prose.ts checkReceiptProse
|
||||
test('inline triple backticks open no fence, and nothing after an unclosed fence is skipped', () => {
|
||||
const wrong = [{ field: 'gate.unit.pass', prose: 113, receipt: 1181 }];
|
||||
expect(checkReceiptProse(lanes, '```npm test``` ran.\nUnit: 113 pass.\n\n```text\nlog\n```\n').mismatches).toEqual(wrong);
|
||||
expect(checkReceiptProse(lanes, '````\n```\nUnit: 113 pass.\n```\n').mismatches).toEqual(wrong);
|
||||
});
|
||||
});
|
||||
|
||||
describe('gstack-ship-receipt read --check-prose', () => {
|
||||
const run = (body: string) => {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'receipt-prose-'));
|
||||
|
||||
Reference in new issue
Block a user