Skip to content

test: add offline alert service tests for billing alerts and digests - #508

Merged
Ayinkx merged 3 commits into
AyinkxLab:mainfrom
Felamsy:fix/issue-475-phase-10-alert-service-tests
Oct 19, 2026
Merged

Ayinkx merged 3 commits into
AyinkxLab:mainfrom
Felamsy:fix/issue-475-phase-10-alert-service-tests

Conversation

@Felamsy

@Felamsy Felamsy commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR adds offline test coverage for billing alerts and digests, covering thresholds, dedupe, notification preferences, and email fallback. Supporting changes in the notification and email services and the notification preference model make the alert behavior testable without network access.

Related Issue

Changes

🔔 Alert Service Tests

  • [ADD] tests/test_alerts.py

    • Covers threshold triggering for billing alerts.
    • Covers dedupe behavior so repeated alerts are not re-sent.
    • Covers notification preference handling.
    • Covers email fallback path.
    • Runs fully offline (no live email or network calls).
  • [MODIFY] app/services/notifications.py

    • Adjustments needed to support threshold, dedupe, and preference behavior under test.
  • [MODIFY] app/services/email.py

    • Adjustments needed to support the email fallback path offline.
  • [MODIFY] app/models/notification_preference.py

    • Adjustments needed to support preference handling in alert tests.

Verification Results

ruff check .
black --check .
pytest
Acceptance Criteria Status
Alert behavior is fully covered ✅ Thresholds, dedupe, preferences, and email fallback covered in tests/test_alerts.py
The suite runs offline ✅ Tests avoid live network/email calls
ruff check ., black --check . and pytest stay green ✅ Lint, format, and test suite pass

Closes #475

@Felamsy

Felamsy commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

this PR is ready for another review. I resolved the merge conflicts with the main branch (pushed 70c16d9).
Files changed: app/services/email.py, tests/test_alerts.py

@ghost ghost 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.

CodeYinkx review

0 finding(s): 0 at high/critical severity, 0 lower.
Mode: static-only. Inline comments: 0.

Diagnostics
  • ruff is not installed; Python linting was skipped
  • bandit is not installed; Python security scanning was skipped
  • ruff is not installed; Python linting was skipped
  • bandit is not installed; Python security scanning was skipped
  • ruff is not installed; Python linting was skipped
  • bandit is not installed; Python security scanning was skipped
  • ruff is not installed; Python linting was skipped
  • bandit is not installed; Python security scanning was skipped

AI review was not used. Configure AI_ENABLED to enable it for opted-in repositories.

CodeYinkx never approves, merges, closes or modifies a pull request.

@Ayinkx
Ayinkx merged commit a4b1145 into AyinkxLab:main Oct 19, 2026
5 of 6 checks passed
Felamsy added a commit to Felamsy/ai-code-assistant that referenced this pull request Oct 22, 2026
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.

Phase 10: Alert service tests

2 participants