fix(verdict-gate): accept only a full 40- or 64-hex reviewed commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7566b71674
commit
cf7af30b46
3 changed files with 77 additions and 15 deletions
|
|
@ -406,10 +406,16 @@ test('release-check r3 — the review and the approval log committed after the r
|
|||
} finally { fx.cleanup(); }
|
||||
});
|
||||
|
||||
test('release-check r3 — scope_sha_end is read as written: an all-digit sha keeps its leading zero', () => {
|
||||
test('[M11] sibling: release-check r3 — scope_sha_end is read as written: an all-digit 40-character sha keeps its leading zero, a 7-character id is refused', () => {
|
||||
assert.equal(typeof mod.reviewedSha, 'function');
|
||||
assert.equal(mod.reviewedSha('---\ntype: trekreview\nscope_sha_end: 0123456\n---\nbody\n'), '0123456');
|
||||
assert.equal(mod.reviewedSha('---\nscope_sha_end: "00ab12c"\n---\n'), '00ab12c');
|
||||
const digits = '0123456789012345678901234567890123456789';
|
||||
assert.equal(mod.reviewedSha(`---\ntype: trekreview\nscope_sha_end: ${digits}\n---\nbody\n`), digits);
|
||||
const quoted = '00ab12c'.padEnd(40, '0');
|
||||
assert.equal(mod.reviewedSha(`---\nscope_sha_end: "${quoted}"\n---\n`), quoted);
|
||||
const sha256 = '00ab12c'.padEnd(64, 'f');
|
||||
assert.equal(mod.reviewedSha(`---\nscope_sha_end: ${sha256}\n---\n`), sha256, 'a 64-hex (SHA-256) id is read');
|
||||
assert.equal(mod.reviewedSha('---\ntype: trekreview\nscope_sha_end: 0123456\n---\nbody\n'), '', 'a 7-character id is refused');
|
||||
assert.equal(mod.reviewedSha('---\nscope_sha_end: "00ab12c"\n---\n'), '', 'a quoted 7-character id is refused');
|
||||
assert.equal(mod.reviewedSha('---\ntype: trekreview\n---\nscope_sha_end: 1\n'), '', 'only the frontmatter counts');
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue