Next release#1708
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds notification email preheader generation, updates notification tests and template wiring, lowers several log levels across workflow/reporting code, removes device-history debug output, and adjusts device page and loading skeleton CSS spacing. ChangesNotification Preheader Preview
Log Level Downgrades
Device Page and Skeleton Styling
Sequence Diagram(s)sequenceDiagram
participant NotificationInstance
participant NotificationsBuilder
participant EmailTemplate
NotificationInstance->>NotificationsBuilder: build preheader preview text
NotificationsBuilder->>NotificationInstance: return html, text, preheader_preview
NotificationInstance->>EmailTemplate: replace PREHEADER placeholder
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
test/backend/test_notification_templates.py (2)
97-97: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUnused
preheader_previewvariable triggers Ruff RUF059.
preheader_previewis unpacked but never used in this test. Use_to suppress the warning and match the pattern used by other tests.♻️ Proposed fix
- html, text, preheader_preview = construct_notifications(json_data, "new_devices") + html, text, _ = construct_notifications(json_data, "new_devices")🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/backend/test_notification_templates.py` at line 97, The unpacking in the test that calls construct_notifications for "new_devices" binds preheader_preview but never uses it, triggering Ruff RUF059. Update the assignment to ignore that value with a placeholder like _ so the test matches the existing unpacking style used elsewhere and removes the unused variable warning.Source: Linters/SAST tools
97-97: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNo test asserts on
preheader_previewcontent for non-empty sections.All tests that unpack the third return value either ignore it (
_) or only assert it's empty. Consider adding a test that verifiesbuild_preheaderproduces the expected preview string (e.g., title prefix, first-three-rows/cols,(+N more)suffix).♻️ Suggested test addition
`@patch`("models.notification_instance.get_setting_value") def test_preheader_preview_content(self, mock_setting): from models.notification_instance import construct_notifications mock_setting.side_effect = self._setting_factory({ "NTFPRCS_TEXT_SECTION_HEADERS": True, "NTFPRCS_TEXT_TEMPLATE_new_devices": "", }) json_data = _make_json( "new_devices", SAMPLE_NEW_DEVICES, NEW_DEVICE_COLUMNS, "🆕 New devices" ) _, _, preheader_preview = construct_notifications(json_data, "new_devices") self.assertIn("🆕 New devices:", preheader_preview) self.assertIn("MyPhone", preheader_preview) self.assertIn("Laptop", preheader_preview)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/backend/test_notification_templates.py` at line 97, Add a test that exercises the third return value from construct_notifications for a non-empty section, since current coverage only checks empty or ignored previews. Use the construct_notifications and build_preheader flow in test_notification_templates.py to assert the preheader_preview contains the expected title prefix and sample content (for example, the first visible rows/columns and any (+N more) suffix when applicable). Make the new test similar to the existing notification template tests and verify the generated preview string directly instead of unpacking it as _.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/backend/test_notification_templates.py`:
- Line 97: The unpacking in the test that calls construct_notifications for
"new_devices" binds preheader_preview but never uses it, triggering Ruff RUF059.
Update the assignment to ignore that value with a placeholder like _ so the test
matches the existing unpacking style used elsewhere and removes the unused
variable warning.
- Line 97: Add a test that exercises the third return value from
construct_notifications for a non-empty section, since current coverage only
checks empty or ignored previews. Use the construct_notifications and
build_preheader flow in test_notification_templates.py to assert the
preheader_preview contains the expected title prefix and sample content (for
example, the first visible rows/columns and any (+N more) suffix when
applicable). Make the new test similar to the existing notification template
tests and verify the generated preview string directly instead of unpacking it
as _.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 54848eae-db39-4216-81ea-7742bfa49a74
📒 Files selected for processing (10)
front/css/app.cssfront/plugins/unifi_api_import/unifi_api_import.pyfront/report_templates/report_template.htmlserver/messaging/reporting.pyserver/models/device_history_instance.pyserver/models/notification_instance.pyserver/workflows/conditions.pyserver/workflows/manager.pyserver/workflows/triggers.pytest/backend/test_notification_templates.py
💤 Files with no reviewable changes (1)
- server/models/device_history_instance.py
Summary by CodeRabbit
New Features
Bug Fixes
Internal