Merge remote-tracking branch 'github/master' into xtr/session-format-migration

# Conflicts:
#	docs/config-catalog.i18n.yaml
#	docs/config-catalog.md
#	docs/config-catalog.zh.md
#	packages/session/session-persistence-jsonl/src/index.ts
#	packages/session/session-persistence/src/coordinator.ts
#	packages/session/session-persistence/src/index.ts
This commit is contained in:
_Kerman
2026-08-25 12:41:23 +08:00
2357 changed files with 46214 additions and 18025 deletions
@@ -17,6 +17,7 @@ import {
DEFAULT_PREPARED_SESSION_CACHE_SIZE,
DEFAULT_WRITE_BATCH_MAX_DELAY_MS,
MAX_WRITE_BATCH_DELAY_MS,
type BorrowedSessionSource,
PersistenceCoordinator,
SessionPersistence,
type SessionInspection,
@@ -119,6 +120,10 @@ export class SqliteSessionPersistence extends SessionPersistence {
return this.coordinator.inspect(id, signal)
}
override borrowSession(id: SessionId, signal?: AbortSignal): Promise<BorrowedSessionSource> {
return this.coordinator.borrowSession(id, signal)
}
readFrom(
id: SessionId,
fromSeq: number,
@@ -505,19 +505,28 @@ describe('SessionPersistenceSqlite schema ownership', () => {
})
it('paces repeated busy journal-mode attempts', async () => {
let attempts = 0
const BusyDatabase = databaseWithJournalFailure(() => {
attempts += 1
return Object.assign(new Error('database is locked'), { errcode: 5 })
const attemptedAt: number[] = []
const BusyTwiceDatabase = databaseWithJournalFailure(() => {
attemptedAt.push(performance.now())
return attemptedAt.length <= 2
? Object.assign(new Error('database is locked'), { errcode: 5 })
: undefined
})
await expect(openDatabase(
BusyDatabase,
const db = await openDatabase(
BusyTwiceDatabase,
await freshDbPath('dsh-sqlite-journal-paced-'),
'wal',
50,
)).rejects.toThrow('database is locked')
expect(attempts).toBeGreaterThan(1)
expect(attempts).toBeLessThanOrEqual(6)
DEFAULT_BUSY_TIMEOUT_MS,
)
db.close()
expect(attemptedAt).toHaveLength(3)
for (let index = 1; index < attemptedAt.length; index += 1) {
const previous = attemptedAt[index - 1]
const current = attemptedAt[index]
if (previous === undefined || current === undefined) throw new Error('missing journal attempt timestamp')
expect(current - previous).toBeGreaterThanOrEqual(5)
}
})
it('rejects unversioned, incompatible, and foreign-application databases', async () => {