@@ -4,6 +4,7 @@ import { join } from "node:path";
44import { Database } from "bun:sqlite" ;
55import { afterEach , describe , expect , setDefaultTimeout , test } from "bun:test" ;
66import { classifyRecoverableHistoryError , countPendingOpencodexHistory , historyBackupPathFor , isRecoverableHistoryError , migrateHistoryToOpenai , restoreLegacyOpenaiHistory , restoredUserEventFor , setAfterNoopPendingCountForTests , setAfterStrictHistoryRolloutAppendForTests , setBeforeHistoryApplyTransactionForTests , setBeforeHistoryBackupConsumeForTests , setBeforeStrictHistoryRolloutAppendForTests , setHistoryDbBusyTimeoutForTests , snapshotCodexHistoryNoop , syncCodexHistoryProvider , withHistoryRetry } from "../../src/codex/history-provider" ;
7+ import { sameCodexHistoryPath } from "../../src/codex/history-manifest" ;
78import { INVALID_HISTORY_BACKUP_FIXTURES , validHistoryBackupFixture } from "../helpers/codex-history-manifest-fixtures" ;
89import { preflightCodexHistoryInjection , setHistoryAppendHooksForTests } from "../../src/codex/history-provider" ;
910
@@ -1513,4 +1514,23 @@ describe("Design B migration helpers", () => {
15131514 expect ( db . query ( "SELECT model_provider FROM threads WHERE id = 'thread-1'" ) . get ( ) ) . toEqual ( { model_provider : "openai" } ) ;
15141515 db . close ( ) ;
15151516 } ) ;
1517+
1518+ test ( "sameCodexHistoryPath normalizes Windows extended-length and device path prefixes" , ( ) => {
1519+ if ( process . platform !== "win32" ) return ;
1520+ const std = "C:\\Users\\test\\state.db" ;
1521+ const ext = "\\\\?\\C:\\Users\\test\\state.db" ;
1522+ const dev = "\\\\.\\C:\\Users\\test\\state.db" ;
1523+ const fwd = "//?/C:/Users/test/state.db" ;
1524+ expect ( sameCodexHistoryPath ( std , ext ) ) . toBe ( true ) ;
1525+ expect ( sameCodexHistoryPath ( ext , std ) ) . toBe ( true ) ;
1526+ expect ( sameCodexHistoryPath ( std , dev ) ) . toBe ( true ) ;
1527+ expect ( sameCodexHistoryPath ( std , fwd ) ) . toBe ( true ) ;
1528+ } ) ;
1529+
1530+ test ( "sameCodexHistoryPath normalizes Windows UNC paths with extended prefix" , ( ) => {
1531+ if ( process . platform !== "win32" ) return ;
1532+ const unc = "\\\\server\\share\\rollout.jsonl" ;
1533+ const extUnc = "\\\\?\\UNC\\server\\share\\rollout.jsonl" ;
1534+ expect ( sameCodexHistoryPath ( unc , extUnc ) ) . toBe ( true ) ;
1535+ } ) ;
15161536} ) ;
0 commit comments