Repository navigation
Description
Context
perima ran an architectural audit in April 2026 against the v0.6.x codebase to identify structural drift that would compound into real debt if unaddressed before the next major phase (Local HTTP API). The audit's ranked top-10 actions focus on: a repo-root conventions doc, extracting an application-service layer, fixing repository trait shape, killing IPC type-drift, adopting a write-actor + read-pool connection model, typing errors across the IPC boundary, replacing the sync event bus, and templating FTS5 triggers.
This umbrella tracks follow-up work from that audit. A dedicated design spec will be authored after the library/stack audit umbrella (#80) completes — this issue is the pre-anchor so the follow-up spec doesn't lose the thread across sessions.
Ranked items (A1-A10)
- A1. Repo-root conventions doc (CLAUDE.md expansion) — distinct from AGENTS.md which is library-pinning
- A2. Repository traits take
&selfinstead of&mut self— DONE on main (commits081c694+333c4b6desktop cascade) - A3. Extract
crates/appwith one UseCase struct per user-visible workflow +AppContainer— refactor(app): extract crates/app UseCase layer (Phase 6 prep) #66 - A4. Delete
apps/desktop/src/types.ts, commitbindings.ts, always-export (not undercfg(debug_assertions)), feature-gated specta derives on core types — refactor(desktop): kill hand-written types.ts mirror + adopt typed CoreError at IPC boundary #68 - A5. Write-actor + read-pool SQLite connection model (
flume+deadpool-sqlite; publish-after-COMMIT ordering) — refactor(db): write-actor + read-pool SQLite connection model (Phase 6 prep) #67 - A6. Typed
CoreErrorvia serde-tagged discriminated union + specta derive +invokeResult<T>()frontend wrapper — refactor(desktop): kill hand-written types.ts mirror + adopt typed CoreError at IPC boundary #68 covers type-drift scope including this - A7. Replace sync fan-out EventBus with
async-broadcastbackpressure mode + ring-buffer replay — refactor(core,db,cli,desktop): hoist duplicated CompositeEventBus + DbEventHandler + LogEventHandler #69 covers consolidation; bus-redesign adds async-broadcast - A8. Templatize the 24 FTS5 triggers via
build.rs+minijinja+instasnapshots +proptestround-trip - A9. Split
search_repo.rs(1825 LOC) into submodule directory by access pattern (mod.rs + filters.rs + query.rs + rows.rs) - A10. Decompose
App.tsx— adopt TanStack Query (or defer Query to Phase 6, decision open) + Zustand + TanStack Router withcreateHashHistory
Existing issues absorbed as sub-items
- refactor(app): extract crates/app UseCase layer (Phase 6 prep) #66 — refactor(app): extract crates/app UseCase layer
- refactor(db): write-actor + read-pool SQLite connection model (Phase 6 prep) #67 — refactor(db): write-actor + read-pool SQLite connection model
- refactor(desktop): kill hand-written types.ts mirror + adopt typed CoreError at IPC boundary #68 — refactor(desktop): kill types.ts mirror + adopt typed CoreError at IPC boundary
- refactor(core,db,cli,desktop): hoist duplicated CompositeEventBus + DbEventHandler + LogEventHandler #69 — refactor(core,db,cli,desktop): hoist duplicated CompositeEventBus + DbEventHandler + LogEventHandler
Explicitly NOT covered here (scope boundary)
Library/stack picks (Tailwind v4, Vite 8, React Compiler, fast_image_resize, nom-exif, path crate consolidation, miette, official tauri-plugins) are owned by the library/stack audit follow-up umbrella (#80). Post-v1 concerns (CRDT integration, mobile, sync, plugins v2) are out of scope.
Open decisions to resolve during spec authoring
- TanStack Query adoption timing (Phase 6 vs pre-Phase-6) — architecture audit says now; the library audit's own Q8 partially supports deferring until HTTP fetch layer exists.
miette::Diagnosticderive onCoreError— architecture spec must decide whether core gains the derive (feature-gated or unconditional).- Pre-v1 CRDT schema actions (HLC columns,
shared_doctable) — cheap insurance per audit; spec must commit.
Source
Architectural audit response generated April 2026. Companion design spec authored after library-audit umbrella (#80) ships.
Activity