Skip to content

Show live spike notifications without refresh - #170

Merged
sofeikov merged 5 commits into
mainfrom
feature/live-notification-refresh
Jul 21, 2026
Merged

sofeikov merged 5 commits into
mainfrom
feature/live-notification-refresh

Conversation

@sofeikov

@sofeikov sofeikov commented Jul 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • refresh the sidebar unread-alert count every five seconds while the bell is mounted
  • prevent overlapping unread-count requests and stop polling when the component is destroyed
  • keep large notification inboxes usable with a viewport-bounded scroll region
  • add a full Playwright journey from API-key evaluation through spike notification, linked cases, duplicate suppression, cooldown updates, and acknowledgement persistence
  • reconcile the two pre-existing Alembic heads with a no-op merge revision so canonical clean installs and CI can run alembic upgrade head
  • release the user-visible fix as 1.29.2 and update README, monitoring guidance, and What’s New

Verification

  • uv run poe check
  • uv run mkdocs build --strict
  • npm run build
  • npx playwright test e2e/tests/alert-live-traffic.spec.ts --project=chromium --workers=1 --repeat-each=10 --timeout=60000 — 10/10 passed
  • repeated the same 10-run command without resetting the private database — 10/10 passed
  • final single targeted Playwright run — passed
  • fresh PostgreSQL database: uv run alembic heads reports only 20260720_0040; uv run alembic upgrade head completes to the mergepoint

Known gaps

  • production-scale polling load beyond one browser session was not measured
  • downgrade traversal through both pre-merge migration branches was not exercised
  • the merge revision is intentionally schema-neutral and preserves both existing migration branches

Documentation and assets

  • README, monitoring guide, and docs/whatsnew.md updated
  • existing screenshots/GIFs reviewed; none capture the notification dropdown or require regeneration

sofeikov added 3 commits July 20, 2026 19:28
Outcome-spike notifications can arrive while the sidebar remains mounted, so the notification bell now polls the unread count with lifecycle-safe teardown and keeps large inboxes usable with a bounded scroll region. The browser journey proves the production-facing chain from API-key evaluation through alert cases and acknowledgement.

Constraint: Alert delivery remains asynchronous and the sidebar can stay mounted across the entire response window
Rejected: Add WebSocket or server-sent events | unnecessary backend protocol expansion for a lightweight unread-count signal
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep unread refresh lifecycle-bound and prevent overlapping requests
Tested: uv run poe check; uv run mkdocs build --strict; npm run build; targeted Playwright 10 repeats twice on the same database plus final single pass
Not-tested: Production-scale polling load beyond one browser session
Two independently merged migrations both descended from the alert-case revision, leaving fresh databases unable to use the repository's canonical upgrade target. A no-op merge revision records that both branches are required without changing schema state.

Constraint: CI and documented installation flows use alembic upgrade head
Rejected: Change workflows to upgrade heads | would hide divergent migration history and requires protected CI edits
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: New migrations must descend from 20260720_0040 unless another explicit branch is intentional
Tested: fresh PostgreSQL database upgraded from base to 20260720_0040 with alembic upgrade head; uv run poe check; uv run mkdocs build --strict
Not-tested: downgrade traversal through both pre-merge branches
The full browser suite retains seeded active rules, so the alert journey must submit a complete low-risk transaction rather than a marker-only payload. This keeps the test on the real multi-rule evaluation path without mutating global rule state.

Constraint: Full Playwright CI evaluates against seeded active demo rules.

Rejected: Archive or reorder unrelated rules | would mutate shared suite state and weaken the production-path signal.

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: Keep live evaluation fixtures compatible with the seeded rule catalog.

Tested: Targeted Chromium run repeated 10 times, then repeated 10 times again without database reset; uv run poe check.

Not-tested: Full Playwright suite locally; GitHub Actions is the source of truth.
@sofeikov
sofeikov marked this pull request as ready for review July 20, 2026 18:57

@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: 1fdc6d7a6d

ℹ️ 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".

Comment thread ezrules/frontend/src/app/components/notification-bell.component.ts
Unread polling now reloads the notification list when its count changes while the menu is open. The live traffic journey opens the inbox before generating a spike, proving the new incident appears without closing or reopening the menu.

Constraint: Polling must remain bounded and avoid a second always-on notification request.

Rejected: Poll the full notification list continuously | adds unnecessary payload and request load while the menu is closed.

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: Keep badge and open-menu state synchronized when notification polling changes.

Tested: Seeded targeted Chromium run repeated 10 times, then repeated 10 times without database reset; npm build; uv run poe check; mkdocs strict build.

Not-tested: Production-scale concurrent browser polling load.

@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: 11b9b7a385

ℹ️ 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".

Comment thread ezrules/frontend/src/app/components/notification-bell.component.ts
Notification list loads now carry a monotonic sequence so only the latest request can update menu state. The browser journey deterministically delivers a captured pre-spike response after the refreshed response and proves the incident remains visible.

Constraint: Opening the menu and unread-count polling may issue concurrent list requests.

Rejected: Serialize every list request | a slow obsolete request would delay fresh incident visibility.

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: Any future notification-list loader must preserve latest-response-wins semantics.

Tested: Deterministic stale-response Chromium journey repeated 10 times, then repeated 10 times without database reset; npm build; uv run poe check.

Not-tested: Artificial high-latency behavior outside the notification list endpoint.
@sofeikov
sofeikov merged commit 62ad9d7 into main Jul 21, 2026
6 checks passed
@sofeikov
sofeikov deleted the feature/live-notification-refresh branch July 21, 2026 18:17
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