Conversation
A triage queue needs to exclude snoozed alerts in the query and to say who owns one. `snooze()` kept its wake time inside the `meta` JSON, so a list of open-but-not-snoozed alerts had to load every row and ask each one. Move it to an indexed `snoozed_until` column (reading the old meta value for rows written before it existed), record who snoozed it, add `assigned_to_uuid` for an owner distinct from the acknowledger, and `planned_at` for a time the owner chose to handle it. `acknowledge()` now also moves an open alert to `acknowledged`, which the status column always documented but nothing wrote. New `snoozed()` and `active()` scopes, plus `unsnooze()` and `assignTo()`.
4 tasks
The coverage gate wanted the three one-line members the alert tests never reached: the snoozedBy and assignedTo relations and the assigned_to_name accessor. Assert their foreign keys and the null fallback alongside the existing relationship contracts.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v1.6.62 #258 +/- ##
===================================================
Coverage 100.00% 100.00%
- Complexity 6750 6764 +14
===================================================
Files 398 398
Lines 22505 22548 +43
===================================================
+ Hits 22505 22548 +43
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
A triage queue (FleetOps Radar, fleetbase/fleetops#325) keeps its acknowledge / snooze / assign state on
alerts, and needs to exclude snoozed alerts in the query and say who owns one.Alert::snooze()kept its wake time inside themetaJSON, so a list of open-but-not-snoozed alerts had to load every row and ask each one.snoozed_until(indexed),snoozed_by_uuid,assigned_to_uuid,planned_at(indexed), plus a(company_uuid, status, snoozed_until)index.snooze()writes the column (and who snoozed it) while keepingmeta.snooze_reason;isSnoozed()reads the column and falls back to the oldmeta.snoozed_untilfor rows written before it existed.unsnooze(),assignTo(),scopeSnoozed(),scopeActive(), andassigned_to_name/is_snoozedappends.acknowledge()now moves an open alert tostatus = acknowledged, which the status column always documented but nothing wrote.Test plan
tests/Unit/Models/OperationalModelsTest.phpextended for the new columns, snooze/unsnooze/assign, the legacy meta fallback and the two scopes (12 pass)php artisan migrateon a database with existing alerts, then a FleetOps Radar snooze round-trip