Rebuild terminal UI and repair aggregate_records migration #3
Loading…
Reference in a new issue
No description provided.
Delete branch "rebuild-tui"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Non-interactive visual overhaul of the kMarc terminal UI ("calm scaffolding, loud signal": quiet dim structure, colour reserved for meaning), plus a fix for a database migration gap that broke
exportandreporton pre-existing databases. No new runtime dependencies; the compile-to-binary setup is preserved.Terminal UI
Commands, flags, data, ordering and counts are unchanged - only presentation.
src/ui.tsrewritten as a small design system:theme- single source of truth for verdict colour + glyph (auth / disposition / authorization / risk), still readable under NO_COLOR.sectionrules replace the old two-line cyan headings; width-cappedbanner;subheading(meta); additive sharebar;statRow.truncate; width-fittingtable(flex-shrink widest-first, per-columnnarrow:"drop", optional footer row).NO_COLOR/FORCE_COLOR,KMARC_ASCII/KMARC_UNICODE,COLUMNS;terminalWidthclamped to [60, 200].report.ts/cli.ts/mailbox.tsterminal output restyled to the shared vocabulary. Wide report tables transpose to stacked key-value blocks on narrow terminals so no security column is ever dropped.tests/ui.test.ts.Fix: aggregate_records migration
migrate()only ranCREATE TABLE IF NOT EXISTS, so databases created beforeaggregate_records.policy_override_reasons_jsonwas added never received the column, andexport/reportfailed withno such column. Added a guardedALTER TABLEmigration (mirrors the existinguid_validitymigration), covered bytests/repo.test.ts.Scope note
This branch also carries pre-existing reliability / performance / security hardening that was already in the working tree (aggregate, config, dmarc, forensic, processor, spf, types, util and their tests). It was entangled with the UI edits in the same files, so it is included here rather than split out.
Verification
bunx tsc --noEmitcleanbun test- 81 passbun run check:unused(knip) cleanbun run build- binary compilesKMARC_ASCII=1) andNO_COLORmodes; no rendered line exceeds the terminal width at 62 / 72 / 100 columns.Generated with Claude Code.
Codex review
Verdict: 1 medium
Overall risk is moderate; the main concern is that failed message handling can now delete messages that were not successfully imported.
Medium (1)
src/mailbox.ts:187A message that fails during import can be permanently removed from the remote mailbox even though it was not saved locally. The new per-message catch increments
failedMessagesand continues, but because the delete step for already-processed UIDs batches all UIDs present in the repository, a message whose failed aggregate artifact was partially persisted and whose message row exists can be treated as already processed on the next sync and deleted whendeleteRemoteis enabled.Suggested fix: Track failed or incomplete imports separately from successfully processed UIDs, and exclude them from the already-processed remote-delete batch until the import has completed successfully.
Reviewed by Codex at
f32bec583c. This comment is conservative and based only on the PR diff, metadata, and supplied repository context.Est. cost ~$0.36 (70.6k in / 733 out / gpt-5.5).