Skip to content

Commit ec3dd7f

Browse files
committed
fix(scripts): read check-osv-exemptions selfTest() before destructuring it
The handshake was placed after `const { passed, lines } = selfTest()`, so an early return made the destructuring throw a TypeError before the check could run — the very accident that made this gate read HELD without a handshake. The census now reports the named refusal instead of a stack trace. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LAwHpn4uVuf4N1geBcD5i3
1 parent 53c4e2f commit ec3dd7f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

scripts/check-osv-exemptions.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,10 @@ function selfTest() {
500500

501501
function main() {
502502
if (process.argv.includes('--self-test')) {
503-
const { passed, lines } = selfTest();
503+
// Read BEFORE destructuring: an early return yields `undefined`, and
504+
// destructuring that throws a TypeError before the handshake is reached —
505+
// an accidental non-zero exit is not a verdict handshake (#13798).
506+
const selfTestResult = selfTest();
504507
if (!selfTestReachedVerdict) {
505508
console.error(
506509
'\n✗ check-osv-exemptions self-test: selfTest() returned without reaching its verdict,\n'
@@ -509,6 +512,7 @@ function main() {
509512
);
510513
process.exit(1);
511514
}
515+
const { passed, lines } = selfTestResult;
512516
console.log('check-osv-exemptions self-test (both directions):');
513517
for (const line of lines) console.log(line);
514518
if (!passed) {

0 commit comments

Comments
 (0)