Files
gstack/test/cso-history.test.ts
Garry TanandOpenAI Codex 4a3c6a8a3c v1.87.0.0 feat: add verified CSO audits and replayable repair bundles (#2852)
* feat(cso): add verified audits and replayable repair bundles

* fix(cso): harden qualification and setup boundaries

* fix(cso): assemble security canaries at runtime

* fix(cso): bound release proof and maintenance work

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* fix(cso): require complete evaluation reports

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* fix(cso): replay expired snapshots from supplied source

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* test(cso): synchronize DNS cancellation assertion

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* chore(ship): exempt repository owner from liveness proof

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* test(cso): make recheck retention overlap deterministic

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* chore: bump version and changelog (v1.85.0.0)

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* fix(cso): pass native release gates

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* chore: move release to v1.86.0.0

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* fix(cso): resolve rechecks by finding

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* chore: move release to v1.87.0.0

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* fix(cso): pass macOS and Windows release gates

Normalize BSD wc output, compare Windows paths by filesystem identity, preserve portable snapshot race coverage, and narrow POSIX-only Windows fixtures.

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* fix(cso): harden native verification gates

* fix(cso): refine Windows native diagnostics

* test(cso): isolate Windows Git startup failure

* test(cso): stabilize Windows native diagnostics

* fix(cso): support hardened Git on Windows

* fix(cso): close final verification gaps

* test(cso): bound cold Docker fixture setup

* fix(cso): restore cross-platform free-suite gates

---------

Co-authored-by: OpenAI Codex <noreply@openai.com>
2026-09-14 15:14:58 -07:00

33 lines
1.3 KiB
TypeScript

import { describe,expect,test } from 'bun:test';
import { gitDiffHeaderPaths,historyForPath } from '../lib/cso/history';
describe('CSO retained Git history path filtering',()=>{
test('matches exact paths without leaking a prefix sibling hunk',()=>{
const raw=`commit ${'a'.repeat(40)}
Author: Fixture
diff --git a/foo b/foo
--- a/foo
+++ b/foo
+wanted
diff --git a/foo-extra b/foo-extra
--- a/foo-extra
+++ b/foo-extra
+must-not-leak
`;
const selected=historyForPath(raw,'foo')!;
expect(selected).toContain('+wanted');
expect(selected).not.toContain('must-not-leak');
});
test('decodes Git C-quoted UTF-8 and space-bearing header paths',()=>{
expect(gitDiffHeaderPaths('diff --git "a/caf\\303\\251 file.ts" "b/caf\\303\\251 file.ts"')).toEqual(['a/café file.ts','b/café file.ts']);
const raw=`commit ${'b'.repeat(40)}\nSubject: Unicode\ndiff --git "a/caf\\303\\251 file.ts" "b/caf\\303\\251 file.ts"\n+unicode-only\n`;
expect(historyForPath(raw,'café file.ts')).toContain('+unicode-only');
});
test('rejects malformed quoted headers instead of broadening the match',()=>{
expect(gitDiffHeaderPaths('diff --git "a/foo b/foo')).toBeUndefined();
expect(historyForPath('diff --git "a/foo b/foo\n+secret\n','foo')).toBeUndefined();
});
});