diff --git a/packages/cli/src/commands/review/lib/run-ledger.test.ts b/packages/cli/src/commands/review/lib/run-ledger.test.ts index 6febecd92e1..d501e8f3259 100644 --- a/packages/cli/src/commands/review/lib/run-ledger.test.ts +++ b/packages/cli/src/commands/review/lib/run-ledger.test.ts @@ -686,23 +686,28 @@ describe('the properties the threat model rests on', () => { expect(priorSessionIds(plan, envOf('S2'))).toEqual([]); }); - it('refuses to append over a ledger it could not read', () => { - // A present-but-unreadable REGULAR file holds every recorded entry, and - // this append rewrites the whole file from what it read — proceeding on - // a transient fault would clobber attempt 1's address exactly when a - // resume needs it. - appendRunSession(plan, envOf('S1')); - const before = readFileSync(runSessionsPath(plan), 'utf8'); - chmodSync(runSessionsPath(plan), 0o000); - try { - appendRunSession(plan, envOf('S2')); - } finally { - chmodSync(runSessionsPath(plan), 0o644); - } - expect(readFileSync(runSessionsPath(plan), 'utf8')).toBe(before); - authorize('S3'); - expect(priorSessionIds(plan, envOf('S3'))).toEqual(['S1']); - }); + it.skipIf(process.platform === 'win32' || process.getuid?.() === 0)( + 'refuses to append over a ledger it could not read', + () => { + // A present-but-unreadable REGULAR file holds every recorded entry, and + // this append rewrites the whole file from what it read — proceeding on + // a transient fault would clobber attempt 1's address exactly when a + // resume needs it. chmod 0o000 is a POSIX-only fault: on Windows it + // toggles the read-only attribute and the file stays readable, and root + // bypasses the mode entirely — the repo convention for this shape. + appendRunSession(plan, envOf('S1')); + const before = readFileSync(runSessionsPath(plan), 'utf8'); + chmodSync(runSessionsPath(plan), 0o000); + try { + appendRunSession(plan, envOf('S2')); + } finally { + chmodSync(runSessionsPath(plan), 0o644); + } + expect(readFileSync(runSessionsPath(plan), 'utf8')).toBe(before); + authorize('S3'); + expect(priorSessionIds(plan, envOf('S3'))).toEqual(['S1']); + }, + ); it('does not write at all when the id fails the charset gate', () => { // The write-side guard, discriminated from the read-side one by looking