Files
memind/release-gate/incremental.test.mjs
john a6a9bb4eab feat(release): add incremental gate and auto CI status for 103 publish
When the runtime artifact is unchanged, carry forward prior gate results and
re-run only REL scenarios; resolve REL-02 from Gitea commit status and allow
stable promotion when canary matches the same artifact bundle.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 08:32:12 +08:00

47 lines
1.5 KiB
JavaScript

import assert from 'node:assert/strict';
import test from 'node:test';
import {
diffTouchesRuntimePaths,
isReleaseOnlyPath,
isReleaseScenario,
mergeIncrementalScenarios,
} from './incremental.mjs';
test('isReleaseScenario identifies REL family only', () => {
assert.equal(isReleaseScenario('REL-02'), true);
assert.equal(isReleaseScenario('CHAT-01'), false);
});
test('isReleaseOnlyPath accepts release workflow files only', () => {
assert.equal(isReleaseOnlyPath('scripts/release-portal-runtime-prod.sh'), true);
assert.equal(isReleaseOnlyPath('release-gate/runner.mjs'), true);
assert.equal(isReleaseOnlyPath('server.mjs'), false);
});
test('diffTouchesRuntimePaths flags runtime-impacting changes', () => {
assert.equal(
diffTouchesRuntimePaths(['scripts/release-portal-runtime-prod.sh']),
false,
);
assert.equal(
diffTouchesRuntimePaths(['scripts/release-portal-runtime-prod.sh', 'server.mjs']),
true,
);
});
test('mergeIncrementalScenarios carries forward unchanged scenarios', () => {
const merged = mergeIncrementalScenarios({
baselineScenarios: [
{ id: 'CHAT-01', status: 'passed', evidence: ['suite=chat'] },
{ id: 'REL-02', status: 'passed', evidence: ['old'] },
],
reexecutedScenarios: [
{ id: 'REL-02', status: 'passed', evidence: ['new'] },
],
});
assert.equal(merged[0].evidence.includes('carried_forward=true'), true);
assert.equal(merged[1].evidence.includes('carried_forward=false'), true);
assert.equal(merged[1].evidence.includes('new'), true);
});