feature(web): cache proposals UI#138
Merged
jamby77 merged 4 commits intoApr 29, 2026
Merged
Conversation
Add /cache-proposals route with Pending and History tabs. Pending cards render four (cache_type, proposal_type) variants with approve, reject, and edit-and-approve flows. Edit hidden on invalidate cards. History table filters by status/cache_name and opens a detail panel with full reasoning, payload, and audit trail. Sidebar shows an unread badge for new pending proposals.
Use a module-level subscription store with useSyncExternalStore so the sidebar badge clears when CacheProposals.markAllRead() runs. Wraps markAllRead in useCallback to avoid firing the page-level effect every render. Drops the unused cacheProposalQueryKeys export.
- proposalSource now reads proposed_by only (was falling through to reviewed_by, mislabelling UI-proposed/MCP-reviewed entries as 'mcp'). - Track unread by last-seen timestamp instead of id, so when the marker proposal is approved/rejected/expired it doesn't inflate the unread count to all remaining (already-seen) pending proposals.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 88beada. Configure here.
…sion Math.max guards setLastSeenAt so a markAllRead call where the newest pending proposal has a smaller timestamp (e.g. the previous newest was approved by another user) cannot move the marker backward and resurrect already-seen proposals as unread.
jamby77
merged commit Apr 29, 2026
6901271
into
feature/cache-apply-logic-and-approval-api
2 checks passed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Summary
/cache-proposals) with Pending and History sub-views.(cache_type, proposal_type)variants — semantic threshold adjust, agent tool TTL adjust, semantic invalidate, agent invalidate. Approve is optimistic ("Applying…"), Reject opens an inline reason input, Edit swaps the proposed value for an inline numeric input that posts via/edit-and-approve. Edit is hidden on invalidate cards.estimated_affected > 10000triggers a warn visual.lib/formatters.ts(formatTtlSeconds,formatTimeAgo,formatExpiresIn).Stacked on #137 — merge after the apply-dispatcher PR lands.
Closes the UI portion of issue-179753285 (Days 7–9). Spec:
docs/plans/specs/spec-cache-proposals-ui.md.Test plan
pnpm --filter @betterdb/web test— all web tests pass (175 tests, 27 files).pnpm --filter @betterdb/web build— typecheck + Vite build clean./cache-proposals, verify all 4 card variants render correctly, approve/reject/edit flows POST to the right endpoint, history filters work, detail panel opens with audit trail, unread badge clears on tab visit.var(--chart-*)/ shadcn theme variables.Note
Medium Risk
Medium risk because it introduces new approve/reject/edit-and-approve mutation flows that trigger operational changes via new API endpoints, plus polling/unread state persisted in localStorage.
Overview
Introduces a new
/cache-proposalspage with Pending and History views for reviewing agent-submitted cache proposals.Pending proposals render as actionable cards (approve, reject with optional reason, and edit+approve for supported proposal types) with basic validation and “high impact” highlighting; history adds filtering and a row-click detail sheet that shows payload, apply result, and audit events.
Adds a
cacheProposalsApiclient plus React Query hooks (including pending polling and query invalidation) and a sidebar unread badge backed bylocalStorage, along with new time/TTL formatting utilities and targeted component/unit tests.Reviewed by Cursor Bugbot for commit 1bef37b. Bugbot is set up for automated code reviews on this repo. Configure here.