Skip to content

test(api): make notification load event delivery deterministic - #2127

Merged
Eli Bosley (elibosley) merged 3 commits into
mainfrom
fix/notification-load-event-count
Oct 26, 2026
Merged

Eli Bosley (elibosley) merged 3 commits into
mainfrom
fix/notification-load-event-count

Conversation

@elibosley

@elibosley Eli Bosley (elibosley) commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Make the notification load tests deterministic by delivering fixed event batches to the real service handler after fixture writes complete.

Why This Exists

Work intent: remove the filesystem-event cardinality assumption that intermittently blocks API CI while preserving notification correctness and read-cost coverage. Release PR #2122 failed Test API because 100 writes produced 157 change events. The test waited for exactly 100 events and could never complete once the count exceeded that value. Closing the watcher at a transient exact count could also discard later deliveries.

Resolution

Close the real watcher after initialization, then deliver the workload through the existing handleNotificationEvent implementation. Keep real fixture files, parsing, index updates, subscriptions, warning scans, and all existing read-cost and final-state assertions. Add repeated-change workloads at each history/burst size to verify duplicate changes preserve exact counts and do not publish additions.

Reviewer Considerations

This separates the fixed workload used to measure handler costs from OS scheduling. The existing notifications.overview.spec.ts tests continue to cover real watcher delivery, legacy writes, subscriptions, bursts, hydration, and directory changes. The broadcast tests cover events arriving during scans. Production notification behavior and timeout limits are unchanged.

Behavior Changes

CI no longer requires one filesystem event per logical file write. No customer-facing or API behavior changes.

Implementation Summary

One test file changes. The load matrix grows from 12 to 15 cases, including duplicate change delivery. No production modules or dependencies change.

Verification

  • Unchanged baseline: 12 load tests passed locally.
  • Linux/Node 22/Chokidar 4.0.3 probe: 100 writes produced 200 change events when paused between truncation and content writes; all 100 paths were observed.
  • pnpm --filter @unraid/api test src/unraid-api/graph/resolvers/notifications/notifications.load.spec.ts src/unraid-api/graph/resolvers/notifications/notifications.overview.spec.ts src/unraid-api/graph/resolvers/notifications/notifications.broadcast.spec.ts: 45 passed.
  • pnpm --filter @unraid/api run lint: passed.
  • pnpm --filter @unraid/api run type-check: passed.

Risk

The load test now measures an explicit event batch rather than OS timing. Real watcher and in-flight broadcast integration coverage remains in the adjacent suites. Full Linux CI is pending.

Summary by CodeRabbit

  • Tests
    • Expanded notification load-test coverage to include repeated changes and verify expected event counts across change and creation operations.
    • Load-test results now use a consistent handler workload rather than relying on filesystem watcher delivery.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T19:50:10.212572Z f2ad094 PR opened
ℹ️ About Codex in GitHub

Your 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.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f8259a4c-6217-41fb-9dc2-3c9cb62bb82d
Commits

Reviewing files that changed from the base of the PR and between da7b87d and f2ad094.

Files selected for processing: 2
  • .limetech/ai-review-markers/fix-notification-load-event-count-057e17c1ef19.json
  • api/src/unraid-api/graph/resolvers/notifications/notifications.load.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The notification load test now measures a controlled handler workload. It closes the filesystem watcher after initialization, records synthetic events for each operation, and invokes the handler directly. The cases include repeated changes.

Changes

Notification load test

Layer / File(s) Summary
Controlled handler workload
api/src/unraid-api/graph/resolvers/notifications/notifications.load.spec.ts, .limetech/ai-review-markers/fix-notification-load-event-count-057e17c1ef19.json
The test closes the watcher, records synthetic events, and invokes the notification handler directly. It adds a repeated-change case and updates event and warning expectations. A final-stage AI review marker was added.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

  • unraid/api#2123: Changes notification count behavior that this load test asserts.
Merge Risk: Minimal · up to f2ad0

The controlled workload checks that repeated changes do not publish additions. No merge-blocking issue is identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: making notification load event delivery deterministic in API tests.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit counts each change in flight
Two hops for changes repeated right
The watcher rests; the handler runs
With recorded events, the work is done
And carrots mark the test tonight

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.95%. Comparing base (da7b87d) to head (f2ad094).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2127      +/-   ##
==========================================
- Coverage   53.97%   53.95%   -0.03%     
==========================================
  Files        1046     1046              
  Lines       73610    73610              
  Branches     8833     8831       -2     
==========================================
- Hits        39730    39714      -16     
- Misses      33752    33768      +16     
  Partials      128      128              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

This plugin has been deployed to Cloudflare R2 and is available for testing.
Download it at this URL:

https://preview.dl.unraid.net/unraid-api/tag/PR2127/dynamix.unraid.net.plg

@elibosley
Eli Bosley (elibosley) merged commit 7febc84 into main Oct 26, 2026
12 of 14 checks passed
@elibosley
Eli Bosley (elibosley) deleted the fix/notification-load-event-count branch October 26, 2026 19:59
@github-actions

Copy link
Copy Markdown
Contributor

🔄 PR Merged - Plugin Redirected to Staging

This PR has been merged and the preview plugin has been updated to redirect to the staging version.

For users testing this PR:

  • Your plugin will automatically update to the staging version on the next update check
  • The staging version includes all merged changes from this PR
  • No manual intervention required

Staging URL:

https://preview.dl.unraid.net/unraid-api/dynamix.unraid.net.plg

Thank you for testing! 🚀

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