Files
orca/mobile/src/mobile-web-shell/process-generation-store.ts
T
Jinwoo Hong 3f9582bc90 fix(mobile): removing a host deletes its page cache through the one process store (#22352)
* fix(mobile): removing a host deletes its page cache through the one process store

Host removal never deleted the removed host's page generation cache, so it sat on disk
until four other hosts were activated and a re-pair could reopen the old tree. Every
caller also minted its own GenerationStore with its own queue, so a removal's index or
update-failure-log write could drop the mounted session's write landing inside it.

The store is now one per process (processGenerationStore, with a reset-for-tests seam);
the shell runtime, host removal and Troubleshoot all share it, and removal deletes the
host's cache after the metadata commits, fire-and-forget beside the failure forget.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* test(mobile): the cold-start store per mount is the test's, not production's

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-22 19:57:19 -04:00

17 lines
727 B
TypeScript

import { createGenerationStore, type GenerationStore } from './generation-store'
import { createExpoGenerationFileSystem } from './generation-store-file-system'
let processStore: GenerationStore | null = null
/** The one store every native caller shares. Its queue is what orders writes to the host index and
* the update-failure log, and a second instance has its own: a removal issued through one loses
* the write the mounted session's lands inside it. */
export function processGenerationStore(): GenerationStore {
processStore ??= createGenerationStore({ fileSystem: createExpoGenerationFileSystem() })
return processStore
}
export function resetProcessGenerationStoreForTests(): void {
processStore = null
}