You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test day phase fit against stated mail habits - #907
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.
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.
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: 4
Check name
Status
Explanation
Title check
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
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
[#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
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.
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.
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
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.
What this changes
Adds direct cases for
day_phase_fitso the email attention gate is checked against the persona's statedplatform_habitsand 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
day_phase_fitfunction from the source against all five cases; all passed.python3 -m py_compile backend/tests/test_email_test.pyandgit diff --checkpassed.Prepared and checked by OpenAI Codex at the submitter's request.
Summary by CodeRabbit