feat(reports): notification bell consumes report.ready (B3c)#647
Merged
Conversation
Turn the stubbed TopBar bell into a real, working notification surface driven by the report.ready event (B3a's producer). - useNotificationStore (new): a small Zustand store with a session-scoped unreadReports counter + bumpReportReady / clearReports actions. Shared state between the SSE handler (producer) and the bell (consumer). No server data, not persisted. - useLiveEvents: subscribe to the report.ready topic; its handler bumps the unread counter and invalidates ['reports'] so the library refreshes. A report is fleet-scoped, so no ['host', id] invalidation. - TopBar NotificationBell: was a disabled 'coming soon' stub; now an enabled control that renders the unread count as a badge (only when > 0) and, on click, clears the counter and navigates to /reports. MVP scope is deliberately small and honest: the counter is session-scoped (a refresh resets it), there is no dropdown feed of individual notifications, and report.ready is the only event type. A durable per-user feed with a notification list is a deferred follow-on, not faked here. Specs: - frontend-live-events v1.3.0: C-08 + AC-10 (report.ready -> bell bump + ['reports'] invalidation; AC-01 updated to the 7-topic closed set). - frontend-notifications v1.0.0 (new, registered in specter.yaml): C-01/C-02 + AC-01/AC-02 over the store + the bell (source inspection).
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.
Summary
Phase B3c turns the stubbed TopBar bell into a real, working notification surface driven by the
report.readyevent (#646's producer). This completes Phase B: the operator who generates a Framework Attestation is now notified in-app when its bulk faces finish rendering.What changes
useNotificationStore(new): a small Zustand store with a session-scopedunreadReportscounter +bumpReportReady/clearReportsactions — the shared state between the SSE handler (producer) and the bell (consumer). No server data, not persisted.useLiveEvents: subscribes to thereport.readytopic; the handler bumps the unread counter and invalidates['reports']so the library refreshes. A report is fleet-scoped, so no['host', id]invalidation.NotificationBell: was a disabled "coming soon" stub; now an enabled control that renders the unread count as a badge (only when > 0) and, on click, clears the counter and navigates to/reports.Scope (deliberately small and honest)
The counter is session-scoped (a refresh resets it), there is no dropdown feed of individual notifications, and
report.readyis the only event type. A durable per-user feed (a dropdown list, multiple event types, cross-session persistence) is the deferred follow-on and is not faked here — the bell shows a truthful count ofreport.readyevents received this session.Spec / tests
frontend-live-eventsv1.3.0: C-08 + AC-10 (report.ready→ bell bump +['reports']invalidation, no host invalidation; AC-01 updated to the 7-topic closed set).frontend-notificationsv1.0.0 (new, registered inspecter.yaml): C-01/C-02 + AC-01/AC-02 over the store + the bell (source inspection).tsc/eslint/prettierclean; full frontendvitestsuite 333 passed;specter check112 specs structural + structural coverage 100%.Validation