feat(db): add DeckyLifecycle table for async deploy/mutate tracking

One row per (decky, operation) attempt. State machine:
pending -> running -> succeeded | failed (+ error text). Rows are
append-only after terminal; retries write a new row.

Sibling of DeckyShard rather than a rework -- DeckyShard tracks
runtime container state observed via heartbeat, this tracks
operation lifecycle. New table, UUID PK.

Adds BaseRepository abstract methods (create_lifecycle,
update_lifecycle, get_lifecycle_by_ids, find_open_lifecycle,
sweep_stale_lifecycle) with SQLModelRepository mixin impl.
Backbone for the upcoming 202-Accepted async API.
This commit is contained in:
2026-05-22 16:20:00 -04:00
parent ade8bbe30a
commit 05c0721a51
7 changed files with 451 additions and 0 deletions

View File

@@ -82,6 +82,15 @@ from .decky import (
ServiceConfigFieldDTO,
ServiceSchemaResponse,
)
from .decky_lifecycle import (
DeckyLifecycle,
DeckyLifecycleListResponse,
DeckyLifecycleView,
LifecycleAcceptedResponse,
LifecycleDelta,
LifecycleOperation,
LifecycleStatus,
)
from .fleet import (
LOCAL_HOST_SENTINEL,
FleetDecky,
@@ -278,6 +287,14 @@ __all__ = [
"FleetDecky",
"ServiceConfigFieldDTO",
"ServiceSchemaResponse",
# decky_lifecycle
"DeckyLifecycle",
"DeckyLifecycleListResponse",
"DeckyLifecycleView",
"LifecycleAcceptedResponse",
"LifecycleDelta",
"LifecycleOperation",
"LifecycleStatus",
# health
"ComponentHealth",
"HealthResponse",