Skip to content

feat(asset): per-asset lifecycle snooze endpoints#59

Merged
0xmanhnv merged 1 commit into
developfrom
feat/asset-lifecycle-phase0-ext
Apr 23, 2026
Merged

feat(asset): per-asset lifecycle snooze endpoints#59
0xmanhnv merged 1 commit into
developfrom
feat/asset-lifecycle-phase0-ext

Conversation

@0xmanhnv
Copy link
Copy Markdown
Collaborator

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.

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.
@0xmanhnv 0xmanhnv merged commit 1666483 into develop Apr 23, 2026
9 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.

1 participant