feat(asset): per-asset lifecycle snooze endpoints#59
Merged
Conversation
Adds operator-controlled snooze for the asset lifecycle worker.
POST /api/v1/assets/{id}/lifecycle/snooze with {days, reactivate}
pauses the worker's status transitions on that asset for the given
duration (1-365 days). DELETE the same path clears the snooze.
When reactivate=true the same call also flips a stale/inactive
asset back to active, avoiding the flap where the worker re-demotes
it on the next run.
Implementation keeps scope tight by adding a narrow
LifecycleRepository side-interface rather than extending the main
asset Repository — every mock in tests would otherwise need to
grow a method it does not use. AssetService takes the side-
interface via SetLifecycleRepository; the Postgres implementation
uses a single direct UPDATE so we do not have to extend the full
scan pipeline just to flip two columns.
Duration 0 (the UNSNOOZE endpoint path) is a neutral clear — the
worker takes over on its next run. Reactivate is ignored on
unsnooze: operators who want an asset active call the existing
status toggle explicitly.
Tests: existing domain tests still cover SnoozeLifecycle behavior
(Asset.SnoozeLifecycle / UnsnoozeLifecycle). Repository-level and
handler-level tests for the new SQL and HTTP surface are covered
by follow-up UI work that will exercise them end-to-end.
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.
Adds operator-controlled snooze for the asset lifecycle worker. POST /api/v1/assets/{id}/lifecycle/snooze with {days, reactivate} pauses the worker's status transitions on that asset for the given duration (1-365 days). DELETE the same path clears the snooze. When reactivate=true the same call also flips a stale/inactive asset back to active, avoiding the flap where the worker re-demotes it on the next run.
Implementation keeps scope tight by adding a narrow LifecycleRepository side-interface rather than extending the main asset Repository — every mock in tests would otherwise need to grow a method it does not use. AssetService takes the side- interface via SetLifecycleRepository; the Postgres implementation uses a single direct UPDATE so we do not have to extend the full scan pipeline just to flip two columns.
Duration 0 (the UNSNOOZE endpoint path) is a neutral clear — the worker takes over on its next run. Reactivate is ignored on unsnooze: operators who want an asset active call the existing status toggle explicitly.
Tests: existing domain tests still cover SnoozeLifecycle behavior (Asset.SnoozeLifecycle / UnsnoozeLifecycle). Repository-level and handler-level tests for the new SQL and HTTP surface are covered by follow-up UI work that will exercise them end-to-end.