Skip to content

feat(cache): schema v11 — analytics columns on runs table (dashboard PR 1/10)#19

Merged
Exelord merged 1 commit into
mainfrom
claude/dashboard-schema
May 11, 2026
Merged

feat(cache): schema v11 — analytics columns on runs table (dashboard PR 1/10)#19
Exelord merged 1 commit into
mainfrom
claude/dashboard-schema

Conversation

@Exelord
Copy link
Copy Markdown
Member

@Exelord Exelord commented May 11, 2026

Summary

Dashboard sequence PR 1 of 10. Lays the foundation for the analytics dashboard (docs/design/dashboard.md): the data the UI will visualize gets a column to land in. Producer PRs (CPU/RSS capture in runner.ts/sandbox.ts, run_id + hrtime spans in orchestrator.ts, bytes-up/down in layered-cache.ts) come next; all of them feed this table.

Schema additions on runs

ALTER TABLE runs ADD COLUMN run_id              TEXT;
ALTER TABLE runs ADD COLUMN cpu_ms              INTEGER;
ALTER TABLE runs ADD COLUMN peak_rss_bytes      INTEGER;
ALTER TABLE runs ADD COLUMN wallclock_start_ns  INTEGER;
ALTER TABLE runs ADD COLUMN wallclock_end_ns    INTEGER;
ALTER TABLE runs ADD COLUMN cache_hit           INTEGER;
ALTER TABLE runs ADD COLUMN bytes_uploaded      INTEGER;
ALTER TABLE runs ADD COLUMN bytes_downloaded    INTEGER;
CREATE INDEX runs_run_id ON runs(run_id);

(We don't actually ALTER — we bump SCHEMA_VERSION and recreate. Pre-alpha policy from PR #7. Existing on-disk outputs become orphans; they get cleaned up by the next vzn cache prune or rebuilt naturally on a cache miss.)

All columns are nullable. RunRecord gains the same fields as optionals. recordRun() accepts them; callers that omit them get NULLs.

Cache identity

  • CACHE_VERSIONvzn-cache-v11
  • SCHEMA_VERSIONv11
  • On version mismatch: nuke entries + runs and store the new version. Pre-alpha.

Test plan

  • bun run format:check — clean
  • bun run lint — clean
  • bun test src/234 / 232 (+2)

New tests

  • recordRun() persists all v11 columns when provided (verified via direct SQLite read).
  • recordRun() stores NULL for omitted columns.

Docs

  • docs/caching.md cache-version history extended with the v11 entry.
  • CLAUDE.md decision log.

Dashboard sequence (10 PRs total)

# PR Status
1 Schema v11 — analytics columns this PR
2 runner.ts / sandbox.ts CPU + RSS capture next
3 orchestrator.ts ULID run_id + hrtime spans next
4 vzn dashboard local Bun.serve() + /api/*
5 UI: Overview + Cache pages
6 UI: Tasks + Runs pages
7 UI: Run detail + d3 flamegraph
8 cf-dashboard/ template (Worker + D1)
9 Push ingestion (POST /api/ingest/runs)
10 Docs sweep

https://claude.ai/code/session_016HXj6HW6bxSn8EYuKcxTD9


Generated by Claude Code

First PR of the 10-PR dashboard sequence (docs/design/dashboard.md).
Lays the foundation: the data the dashboard will visualize gets a
column to land in. Producer PRs (runner CPU/RSS capture, orchestrator
run_id + hrtime spans, layered-cache bytes-up/down) follow.

Schema additions on `runs`
- run_id              TEXT  — ULID shared by all tasks in one vzn run
- cpu_ms              INTEGER — user+system CPU time for the child
- peak_rss_bytes      INTEGER — max RSS observed for the child
- wallclock_start_ns  INTEGER — hrtime span start, ns from run t=0
- wallclock_end_ns    INTEGER — hrtime span end
- cache_hit           INTEGER — 0/1 derivable from status, kept for
                                 fast flamegraph color queries
- bytes_uploaded      INTEGER — bytes pushed to remote cache (NULL
                                 when no remote layer)
- bytes_downloaded    INTEGER — bytes pulled from remote on hit
- new index runs_run_id ON runs(run_id)

All columns are nullable. RunRecord interface gains the optional
fields. recordRun() takes them; older callers (which omit them) get
NULLs in the row — fully backwards-compatible at the API surface.

Cache identity
- CACHE_VERSION       → vzn-cache-v11
- SCHEMA_VERSION      → v11
- On version mismatch the existing pre-alpha policy applies: nuke
  the entries + runs tables, store the new version. Old on-disk
  outputs become orphans (already handled).

Tests: 234 / 232 (+2)
- recordRun persists all v11 columns when provided.
- recordRun stores NULL for omitted columns.

Docs
- docs/caching.md cache-version history extended with the v11 entry.
- CLAUDE.md decision log entry.
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.

2 participants