Repository navigation
feat(replication): epoch fencing and manual promotion (ADR 0002) - #7
Open
ChromaBeast wants to merge 8 commits into
Open
ChromaBeast wants to merge 8 commits into
ChromaBeast wants to merge 8 commits into
Conversation
- 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 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.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ADR 0002 plus the first safe slice of manual promotion.
docs/adr/0002-replication-membership-and-manual-promotion.mdcovers membership, epochs, fencing, promotion preconditions, client discovery, failure cases, what automatic election would still need, and open owner decisions.cluster-state.json; epoch carried inStreamWAL, records,Ackand the newFenceRPC (not yet in WAL frames).POST /api/replication/promote(admin-only, audited asreplication.promote). Fences the old leader, waits for its final LSN, then promotes. If the leader is unreachable it refuses unlessacceptDataLossis set.Reviewer notes
claude/figma-ui-comparison-4d2e45(Phases 0-2), so the diff againstmainincludes those commits. The promotion work is the last two commits.api/proto/*.pb.goregenerated withbuf(noprotochere).bun test.go build ./... && go vet ./... && go test ./... -race,bun test.