Skip to content

Test day phase fit against stated mail habits - #907

Merged
DarkWorldCoder merged 1 commit into
DarkWorldCoder:mainfrom
RaV-u:test/day-phase-fit-habits
Nov 28, 2026
Merged

DarkWorldCoder merged 1 commit into
DarkWorldCoder:mainfrom
RaV-u:test/day-phase-fit-habits

Conversation

@RaV-u

@RaV-u RaV-u commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Adds direct cases for day_phase_fit so the email attention gate is checked against the persona's stated platform_habits and occupation: morning commute, evening after work, a night-shift worker, a mismatched time, and an unknown time. Every case also checks the documented 0.6–1.2 range. Closes #243.

How I tested it

  • Extracted and ran the actual day_phase_fit function from the source against all five cases; all passed.
  • python3 -m py_compile backend/tests/test_email_test.py and git diff --check passed.
  • The full pytest suite was not run locally: the project environment attempted to download multiple multi-gigabyte GPU/ML dependencies. CI should run the tests in its configured environment.
  • Docs, API routes, and dashboard did not change.

Prepared and checked by OpenAI Codex at the submitter's request.

Summary by CodeRabbit

  • Tests
    • Expanded coverage for email send-time compatibility across different habits and schedules.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Adds parameterized tests for day_phase_fit. The cases cover matching and conflicting send-time cues, night-shift occupation, and unknown send time. Each case checks an expected value and the documented 0.6–1.2 bounds.

Changes: day_phase_fit test coverage

Layer / File(s) Summary
Parameterize day-phase fit cases
backend/tests/test_email_test.py
Adds the pytest import and parameterized tests for send-time cues, night-shift occupation, and unknown send time. The tests check expected values and the 0.6–1.2 bounds.

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

Change: Other

Possibly related issues

  • Issue 228 — Adds a morning commuter test for day_phase_fit, but does not change the data population behavior identified in the issue.

Suggested reviewers: ayushniroula9

Merge Risk: Minimal · up to 07ec7

This PR adds test coverage for the day-phase fit calculation and changes no production behavior. It carries no meaningful merge risk beyond CI confirming that the tests pass.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: adding tests that check day_phase_fit against the persona's stated mail habits. It matches the single file changed (backend/tests/test_email_test.py) and the test cases des…
Description check Passed The description follows the template's main section. The 'What this changes' section explains the five test cases, the 0.6-1.2 range check, and links issue #243. The 'How I tested it' section lists th…
Linked Issues check Passed [#243] The issue requires tests for morning commuter, evening after-work, night shift worker, and unknown send time, plus a check that values stay within 0.6-1.2. At head, backend/tests/test_email_tes…
Out of Scope Changes check Passed The PR description and the change summary (+15/-0) both limit the change to backend/tests/test_email_test.py: an added pytest import and the parametrized day_phase_fit test. The head file content show…
Full details: Title check

Explanation

The title names the change: adding tests that check day_phase_fit against the persona's stated mail habits. It matches the single file changed (backend/tests/test_email_test.py) and the test cases described in the summary and objectives. It is specific enough for a reader scanning history.

Full details: Description check

Explanation

The description follows the template's main section. The 'What this changes' section explains the five test cases, the 0.6-1.2 range check, and links issue #243. The 'How I tested it' section lists the commands run and states that the full pytest suite was not run locally. The template checklist is not ticked. It still lacks the required command 'cd backend && uv run --no-sync python -m pytest tests claude_cli/tests -q', and it does not state whether docs were updated. The author states that docs, API routes, and dashboard did not change. The description is mostly complete.

Full details: Linked Issues check

Explanation

[#243] The issue requires tests for morning commuter, evening after-work, night shift worker, and unknown send time, plus a check that values stay within 0.6-1.2. At head, backend/tests/test_email_test.py contains a parametrized test_day_phase_fit_uses_person_habits_and_stays_bounded with cases for morning/commute (1.15), evening/after work (1.15), night/shift occupation (1.1), unknown send time (0.9), and a mismatched morning/night-habit case (1.0). Each case asserts the exact value and asserts 0.6 <= fit <= 1.2. Reading backend/app/services/email_test.py day_phase_fit at head confirms each expected value follows from its branches: night uses 'night' in habits or 'shift' in occupation; morning uses 'commute' or 'morning'; evening uses 'evening' or 'after work'; other send times fall through to 1.0 (morning/evening) or 0.9. The PR adds the mismatched case, which the issue does not forbid. The full pytest suite was not run, so the pass result rests on source reading and the author's extraction run, not on a test run in this review.

Full details: Out of Scope Changes check

Explanation

The PR description and the change summary (+15/-0) both limit the change to backend/tests/test_email_test.py: an added pytest import and the parametrized day_phase_fit test. The head file content shows that test in the expected location. No docs, API routes, or dashboard changes are reported. The whole-PR text diff could not be read because changed blobs are missing from the checkout, so the claim that no other lines changed rests on the summary and not on a direct diff. No unrelated change is demonstrated.

Finishing Touches

Generate unit tests (beta)

  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 24d085a8-4f11-4c20-96d3-e864f840c398
Commits

Reviewing files that changed from the base of the PR and between 74bbdf4 and 07ec7c2.

Files selected for processing: 1

  • backend/tests/test_email_test.py

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

@DarkWorldCoder
DarkWorldCoder merged commit d7d033f into DarkWorldCoder:main Nov 28, 2026
6 checks passed
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.

Test email_test.day_phase_fit

2 participants