Skip to content

Add local SQLite materialization layer for dashboard#42

Merged
WellDunDun merged 2 commits intodevfrom
custom/prefix/router-1773331115817
Mar 12, 2026
Merged

Add local SQLite materialization layer for dashboard#42
WellDunDun merged 2 commits intodevfrom
custom/prefix/router-1773331115817

Conversation

@WellDunDun
Copy link
Collaborator

This adds a local SQLite materialized view store for selftune's dashboard to eliminate the need to recompute everything from raw JSONL logs on every request. The implementation includes schema definitions (10 tables, 19 indexes), incremental materialization from authoritative JSONL sources, and query helpers (overview, skill report, skills list). All changes are covered by 26 unit tests and use bun:sqlite with no new npm dependencies. The database is treated as a disposable cache that can always be rebuilt from source logs.

Add a local SQLite database (via bun:sqlite) as an indexed materialized
view store so the dashboard/report UX no longer depends on recomputing
everything from raw JSONL logs on every request.

New module at cli/selftune/localdb/ with:
- schema.ts: 10 tables + 19 indexes mirroring canonical telemetry and
  local log shapes
- db.ts: openDb() lifecycle with WAL mode, meta key-value helpers
- materialize.ts: full rebuild and incremental materialization from
  JSONL source-of-truth logs
- queries.ts: getOverviewPayload(), getSkillReportPayload(),
  getSkillsList() query helpers

Raw JSONL logs remain authoritative — the DB is a disposable cache that
can always be rebuilt. No new npm dependencies (bun:sqlite only).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

Warning

Rate limit exceeded

@WellDunDun has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 91137797-9f60-4048-9f65-e68c75ea9b8a

📥 Commits

Reviewing files that changed from the base of the PR and between 9ea8a5c and e5bf9f1.

📒 Files selected for processing (5)
  • cli/selftune/localdb/db.ts
  • cli/selftune/localdb/materialize.ts
  • cli/selftune/localdb/queries.ts
  • cli/selftune/localdb/schema.ts
  • tests/localdb/localdb.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch custom/prefix/router-1773331115817
📝 Coding Plan for PR comments
  • Generate coding plan

Comment @coderabbitai help to get the list of available commands and usage tips.

Auto-fix import ordering, formatting, and replace non-null assertions
with optional chaining in tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@WellDunDun WellDunDun merged commit e68d625 into dev Mar 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant