Phase A (security red lines) — CLOSED: - B8: 3x command injection fixed (execFileSync + args array in CMake/CppBuilder/Cppcheck) - B6: ToolRegistry permission bypass fixed (real task_scope/profile passed) - B7: ACTION_BRANCHES this-binding crash fixed (instance method) - B17: DeveloperLogEncryptor hardcoded 'dev-key' removed (throws if no key) - B22: CommandRiskAnalyzer 'in' operator bug fixed (includes) - B1: EventStore.project() transaction handle now passed to all repos - B2: workspace projection illegal enum fixed (active/merged) - B4: route_prefix separator unified to '/' - B5: TaskAttempt column mapping fixed Other blockers fixed: - B3: project-level DB schema aligned to db-schema §20 (.air/local, learned_memories) - B9: cpp.* tools registered through PermissionEngine path - B11: Scheduler BLOCKED/CANCELLED states added - B18: CapabilityTrustLevel 5-level enum aligned - B19: PermissionEngine block/refuse/announce_then_run + grant_scope - B20: Worker exit code 4 = parent_cancelled - B24: project_id now randomUUID Regression fix (introduced by B3 schema refactor): - wiring.ts capture_debug_record/promote_memory_entry realigned to refactored DebugRecord/MemoryEntry interfaces (was compile-level decoupling) Tests: 128 regression/unit tests pass (22 regression + 3 unit + 3 e2e suites) Still open (tracked for next round): B10 (INV-2 outbox emit), B12 (Scheduler event projection), B13 (MainAgent LLM classify), B14 (IPC envelope fields), B15 (TUI OpenTUI), B16 (api_key strict), B21 (CLI init INV-3), B23 (e2e real), B25 (MVP tools), B26 (ContextAssembler L6-L9) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
60 lines
1.8 KiB
TypeScript
Executable File
60 lines
1.8 KiB
TypeScript
Executable File
/**
|
|
* Regression test: EvidenceStore SQLite persistence
|
|
*
|
|
* Verifies that EvidenceStore uses SQLite (bun:sqlite) instead of
|
|
* in-memory Map for persistent storage.
|
|
*/
|
|
|
|
import { describe, test, expect } from 'bun:test'
|
|
import { readFileSync } from 'fs'
|
|
import { join } from 'path'
|
|
|
|
const SOURCE_PATH = join(
|
|
import.meta.dir,
|
|
'..',
|
|
'..',
|
|
'src',
|
|
'artifacts',
|
|
'EvidenceStore.ts'
|
|
)
|
|
|
|
const source = readFileSync(SOURCE_PATH, 'utf-8')
|
|
|
|
describe('EvidenceStore SQLite persistence', () => {
|
|
test('EvidenceStore does not use in-memory Map', () => {
|
|
// Should not have Map< for storage
|
|
expect(source).not.toMatch(/evidenceStore:\s*Map</)
|
|
// Should not use .set() on a map
|
|
expect(source).not.toContain('this.evidenceStore.set(')
|
|
})
|
|
|
|
test('EvidenceStore constructor accepts Database parameter', () => {
|
|
// Constructor should accept a Database parameter
|
|
expect(source).toContain('db: Database')
|
|
// Should import Database from bun:sqlite
|
|
expect(source).toContain("from 'bun:sqlite'")
|
|
})
|
|
|
|
test('EvidenceStore has initSchema method', () => {
|
|
expect(source).toContain('initSchema()')
|
|
// Should be called in constructor
|
|
expect(source).toContain('this.initSchema()')
|
|
})
|
|
|
|
test('EvidenceStore creates evidence_refs table', () => {
|
|
expect(source).toContain('CREATE TABLE IF NOT EXISTS evidence_refs')
|
|
// Should have key columns
|
|
expect(source).toContain('evidence_ref_id TEXT PRIMARY KEY')
|
|
expect(source).toContain('session_id TEXT NOT NULL')
|
|
expect(source).toContain('kind TEXT NOT NULL')
|
|
})
|
|
|
|
test('EvidenceStore uses INSERT INTO for create', () => {
|
|
expect(source).toContain('INSERT INTO evidence_refs')
|
|
})
|
|
|
|
test('EvidenceStore applies WAL PRAGMA', () => {
|
|
expect(source).toContain('PRAGMA journal_mode = WAL')
|
|
})
|
|
})
|