feat(session-manager): add version-gated SDK read path for OpenCode beta
- Add SDK client injection via setStorageClient() - Version-gate getMainSessions(), getAllSessions(), readSessionMessages(), readSessionTodos() - Add comprehensive tests for SDK path (beta mode) - Maintain backward compatibility with JSON fallback
This commit is contained in:
@@ -19,6 +19,12 @@ beforeAll(async () => {
|
||||
join: mock((...args: string[]) => args.join("/")),
|
||||
}))
|
||||
|
||||
// Mock storage detection to return false (stable mode)
|
||||
mock.module("./opencode-storage-detection", () => ({
|
||||
isSqliteBackend: () => false,
|
||||
resetSqliteBackendCache: () => {},
|
||||
}))
|
||||
|
||||
;({ getMessageDir } = await import("./opencode-message-dir"))
|
||||
})
|
||||
|
||||
@@ -110,4 +116,21 @@ describe("getMessageDir", () => {
|
||||
// then
|
||||
expect(result).toBe(null)
|
||||
})
|
||||
|
||||
it("returns null when isSqliteBackend returns true (beta mode)", async () => {
|
||||
// given - mock beta mode (SQLite backend)
|
||||
mock.module("./opencode-storage-detection", () => ({
|
||||
isSqliteBackend: () => true,
|
||||
resetSqliteBackendCache: () => {},
|
||||
}))
|
||||
|
||||
// Re-import to get fresh module with mocked isSqliteBackend
|
||||
const { getMessageDir: getMessageDirBeta } = await import("./opencode-message-dir")
|
||||
|
||||
// when
|
||||
const result = getMessageDirBeta("ses_123")
|
||||
|
||||
// then
|
||||
expect(result).toBe(null)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user