- #3124: Session tools now merge SDK and file-backed sessions for SQLite backend - #3125: Cache priming fixed for OpenCode >=1.3.14 empty workspace - #3127: Activity-based progress detection prevents infinite compaction on Kimi/Minimax All 29 new tests pass, 4885 total tests passing.
This commit is contained in:
@@ -6,6 +6,7 @@ import { randomUUID } from "node:crypto"
|
||||
|
||||
const TEST_STORAGE = join(tmpdir(), `omo-msgdir-test-${randomUUID()}`)
|
||||
const TEST_MESSAGE_STORAGE = join(TEST_STORAGE, "message")
|
||||
let sqliteBackend = false
|
||||
|
||||
mock.module("./opencode-storage-paths", () => ({
|
||||
OPENCODE_STORAGE: TEST_STORAGE,
|
||||
@@ -15,7 +16,7 @@ mock.module("./opencode-storage-paths", () => ({
|
||||
}))
|
||||
|
||||
mock.module("./opencode-storage-detection", () => ({
|
||||
isSqliteBackend: () => false,
|
||||
isSqliteBackend: () => sqliteBackend,
|
||||
resetSqliteBackendCache: () => {},
|
||||
}))
|
||||
|
||||
@@ -25,6 +26,7 @@ const { getMessageDir } = await import("./opencode-message-dir")
|
||||
|
||||
describe("getMessageDir", () => {
|
||||
beforeEach(() => {
|
||||
sqliteBackend = false
|
||||
mkdirSync(TEST_MESSAGE_STORAGE, { recursive: true })
|
||||
})
|
||||
|
||||
@@ -73,6 +75,19 @@ describe("getMessageDir", () => {
|
||||
expect(result).toBe(sessionDir)
|
||||
})
|
||||
|
||||
it("returns file fallback path even when SQLite backend is active", () => {
|
||||
//#given
|
||||
sqliteBackend = true
|
||||
const sessionDir = join(TEST_MESSAGE_STORAGE, "subdir", "ses_123")
|
||||
mkdirSync(sessionDir, { recursive: true })
|
||||
|
||||
//#when
|
||||
const result = getMessageDir("ses_123")
|
||||
|
||||
//#then
|
||||
expect(result).toBe(sessionDir)
|
||||
})
|
||||
|
||||
it("returns null for path traversal attempts with ..", () => {
|
||||
//#given - sessionID containing path traversal
|
||||
//#when
|
||||
@@ -106,4 +121,4 @@ describe("getMessageDir", () => {
|
||||
//#then
|
||||
expect(result).toBe(null)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user