Skip to content

Studio redesign, audit log, backups, collections, encryption at rest and promotion - #10

Merged
ChromaBeast merged 17 commits into
mainfrom
claude/figma-ui-comparison-4d2e45
Nov 20, 2026
Merged

ChromaBeast merged 17 commits into
mainfrom
claude/figma-ui-comparison-4d2e45

Conversation

@ChromaBeast

Copy link
Copy Markdown
Owner

Summary

Brings the Studio redesign and the engine features behind it to main.

  • Studio aligned to the Figma design: sidebar and shell, stat cards, Settings sub-menu, API Keys role cards, Logs table with CSV export and audit tab, Metrics history ranges, Backups page.
  • Server additions: token last-used (in memory), log source filter, server-side metric history, hash-chained audit log, runtime settings (WAL checkpoint threshold, sign-in rate limit, backup schedule), server-managed backups (create, verify, download, schedule).
  • Phase 3 first slices: collections catalog (ADR 0002), opt-in encryption at rest (ADR 0003), epoch fencing and manual promotion (ADR 0004).
  • Fixes: Windows free-space check for backups, Windows-safe settings test, dependency and toolchain updates for all govulncheck and bun audit findings (Go 1.27.4).

Supersedes #7, whose commits are included here.

Known limits

  • Backups pause reads and writes during the copy and live on the same host. Restore is offline via beastctl.
  • Promotion is manual: no automatic election, no client leader lookup.
  • Encryption is opt-in; no KMS or online key rotation yet; Studio user store and audit log are not encrypted.
  • Collections are a first slice; no query builder or secondary indexes yet.

Status

main gained storage format v2 (#8, #9) after this branch was cut. It conflicts with the encryption page layout in 10 files. The resolution is in progress and will be pushed to this branch before merge.

Test plan

  • go build ./... && go vet ./... && go test ./... -race on this branch before the main merge
  • bun test, bun run build, govulncheck, bun audit
  • Same after merging main (format v2 with encryption)
  • CI green on Windows

- Sidebar: 232px width, 10px item padding and gap, panel background,
  solid active item in dark mode.
- Add StatCard/StatGrid and use them for summary tiles on Overview,
  Indexes and Backups, all fed by real engine values.
- API Keys: four role cards on top, explanation note below the list.
- Settings: left sub-menu (General, Storage, Networking, Security,
  Limits); card definitions moved to settings/SettingsCards.tsx.
- Logs: Time/Level/Event header row and Export CSV (toLogCsv, tested).
- docs: add studio-figma-gap-plan.md with the phased plan for the
  Figma features the engine does not back yet.
Server:
- metrics: in-memory History ring and RequestMetrics.Total; the web
  server samples gauges every 10s for 24h and serves them at
  GET /api/metrics/history (admin only, window capped at 24h).
- auth: TokenStore tracks last use in memory only, so authenticating
  never writes to the engine; List reports last_used_at.
- logbuf: entries carry a source derived from the message text;
  /api/logs accepts source=.

Studio:
- Keys: Last used column.
- Logs: Source column, source and time-range filters, source in the
  text and CSV exports.
- Metrics: Live / 1h / 24h range picker backed by the server history.
- Overview: requests-per-second chart for the last hour.
- docs: record the Phase 1 differences in studio-figma-gap-plan.md.
- audit: append-only, hash-chained audit.log in the data directory.
  Records sign-ins, key and record changes, user deletes, checkpoints,
  settings changes and backup actions; never values or secrets. The
  server refuses to start if the existing chain is broken. Served at
  GET /api/audit and shown on a new Audit tab on the Logs page.
- runtimecfg: WAL checkpoint threshold, sign-in rate limit and backup
  schedule can be changed live at /api/settings/runtime, are validated,
  saved to runtime-settings.json (overriding the flags on restart) and
  audited. Engine and rate limiter gain runtime setters.
- backup: create, verify, list and download (tar) backups of a running
  node, with an optional schedule and retention. Built on
  Engine.CreateSnapshot, so reads and writes pause for the copy. Bundles
  match beastctl's format; a test proves beastctl verify and restore
  accept them. Restore stays an offline beastctl step.
- Studio: Backups table with Back up now, Verify, Download and a copy
  restore command; editable settings cards; Audit tab.
- docs: record Phase 2 in studio-figma-gap-plan.md.
Persisted catalog binding names to key prefixes; create/list/drop in the
engine, gRPC and /api/collections; Table Editor rail shows and manages them.
Existing uint64 keys are unchanged; catalog key is protected from plain writes.
Persisted epoch and role, epoch carried in replication RPCs, Fence RPC,
stale-epoch rejection by followers, leader step-down on a higher epoch,
admin promote endpoint with audit entry, and a Studio Promote action
gated on the node being caught up. Promotion is manual; no automatic
election and not high availability.
AES-256-GCM on data pages, checkpoint journal, spill file and WAL records;
key file plus wrapped data key in <db>.keyring; format flag in page 0;
beastctl keygen/encrypt/decrypt/rekey; encrypted backups with keyed verify
and restore; Studio Settings reports the running engine's state.
Tests cover crash recovery, wrong key, tamper detection and migration.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T05:20:35.736442Z a00500d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a00500d071

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

w.Header().Set("Content-Type", "application/x-tar")
w.Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s.tar"`, id))
tw := tar.NewWriter(w)
for _, name := range []string{"manifest.json", "data.bin"} {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include the keyring in encrypted backup downloads

When a server-managed backup is encrypted, Create stores keyring.json in the bundle, but this tar loop includes only manifest.json and data.bin. beastctl restore requires that keyring for encrypted bundles, so a downloaded backup cannot be restored even with the correct master key. Include keyring.json when it exists.

Useful? React with 👍 / 👎.

…rage format v2

Encrypted pages replace the v2 checksum trailer with the AES-GCM tag (usable
page end 4064 instead of 4092); chains, the free list and new pages take the
end from DiskManager.PageEnd. Page 0 flags move to bytes 64..68. The encrypted
WAL gets torn-tail trimming, ErrCorruptLog and the truncate option. Tests cover
encrypted v2 page reuse and saved maps, v1 migration with and without a key,
WAL rotation and truncation with the cipher. ADR 0003 records the decisions.
@ChromaBeast
ChromaBeast merged commit 2436a37 into main Nov 20, 2026
4 checks passed
@ChromaBeast
ChromaBeast deleted the claude/figma-ui-comparison-4d2e45 branch November 20, 2026 08:49
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