Separate encrypted reasoning from actual compaction, stop migration after native return, and retain full history and recent exchanges. Add typed settings, Gemini fallback, verified provider windows, bounded summaries and durable concurrent checkpoints. Validation: 245 bridge tests plus focused concurrency tests; 71 settings/connection tests; 66 supplementary tests; TypeScript checks; renderer and Electron bundles; real primary/native/fallback summary probes and 700K input acceptance.
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import fs from 'node:fs'
|
|
import os from 'node:os'
|
|
import path from 'node:path'
|
|
|
|
import { afterEach, expect, it } from 'vitest'
|
|
|
|
import { createCompressionStore } from './compression-settings'
|
|
|
|
const dirs: string[] = []
|
|
afterEach(() => { for (const dir of dirs.splice(0)) fs.rmSync(dir, { recursive: true, force: true }) })
|
|
|
|
it('persists complete settings and survives reopening', () => {
|
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'compression-store-'))
|
|
dirs.push(dir)
|
|
const store = createCompressionStore(dir)
|
|
const settings = { ...store.get(), keepTurns: 12, primaryModel: 'ide/primary', fallbackModel: 'ide/backup' }
|
|
store.save(settings)
|
|
expect(createCompressionStore(dir).get()).toEqual(settings)
|
|
expect(fs.readdirSync(dir)).toEqual(['compression-settings.json'])
|
|
})
|
|
|
|
it('rejects invalid thresholds without replacing saved settings', () => {
|
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'compression-store-'))
|
|
dirs.push(dir)
|
|
const store = createCompressionStore(dir)
|
|
const original = store.save(store.get())
|
|
for (const patch of [{ keepTurns: 0 }, { targetPercent: 70 }, { maxTokens: NaN }, { autoEnabled: 'yes' }]) {
|
|
expect(() => store.save({ ...original, ...patch })).toThrow()
|
|
expect(store.get()).toEqual(original)
|
|
}
|
|
})
|