models
Pydantic models for the pending change queue: records, status, and payload schemas.
PendingChangeStatus
Bases: StrEnum
Lifecycle states for queued changes.
State transitions::
PENDING → APPROVED → APPLYING → APPLIED
PENDING → REJECTED
The APPLYING state is a transient lock held while the backend write is
in progress. If the process crashes during this window, records stuck in
APPLYING are detected on restart and logged as warnings.
Source code in src/horde_model_reference/pending_queue/models.py
PendingChangeRecord
Bases: BaseModel
Single pending change tracked by the queue.
Source code in src/horde_model_reference/pending_queue/models.py
change_id
class-attribute
instance-attribute
change_id: int = Field(
description="Unique monotonic identifier for this change, allocated by PendingQueueStore. Callers should pass 0 as a sentinel when constructing new records; the store replaces it with the next available ID in enqueue_change(). After persistence, this is the canonical identifier used to approve, reject, apply, and audit-trail this change."
)
payload
class-attribute
instance-attribute
payload: dict[str, Any] | None = Field(
default=None,
description="Serialized model payload for apply job",
)
requested_at
class-attribute
instance-attribute
batch_id
class-attribute
instance-attribute
batch_id: int | None = Field(
default=None,
description="Groups approved changes for atomic application. Allocated by the store's separate batch-ID counter when changes are approved. Multiple changes can share a batch_id. After partial application, remaining approved changes are reassigned to a new batch_id (see PendingQueueService._handle_partial_batch_apply).",
)
applied_job_id
class-attribute
instance-attribute
applied_job_id: str | None = Field(
default=None,
description="Reservation token set during the APPLYING phase to prevent concurrent apply attempts on the same change. This is a caller-supplied string (typically a UUID), not a store-allocated integer like change_id or batch_id.",
)
updated_at
class-attribute
instance-attribute
request_metadata
class-attribute
instance-attribute
Additional metadata for downstream jobs (e.g., original request body).
related_models
class-attribute
instance-attribute
Backend-prefixed variant names affected by this change (text_generation only).
When a text model is created/updated/deleted, the server auto-generates backend duplicates (aphrodite/, koboldcpp/). This field lists those variants so UI can display them and the apply job writes them atomically.
PendingQueueFilter
Bases: BaseModel
Filter options when listing pending queue entries.
Source code in src/horde_model_reference/pending_queue/models.py
categories
class-attribute
instance-attribute
PendingBatchResult
Bases: BaseModel
Result of processing a batch of pending changes.
Source code in src/horde_model_reference/pending_queue/models.py
BatchSplitInfo
Bases: BaseModel
Information about a batch split that occurred during partial application.
When a batch is partially applied (some changes applied, others remain APPROVED), the remaining changes are reassigned to a new batch ID. This model captures the details of that reassignment for client notification.
Source code in src/horde_model_reference/pending_queue/models.py
original_batch_id
class-attribute
instance-attribute
new_batch_id
class-attribute
instance-attribute
MarkAppliedResult
Bases: BaseModel
Result of marking a change as applied, including any batch split info.
Source code in src/horde_model_reference/pending_queue/models.py
PendingQueuePage
Bases: BaseModel
Paginated list of pending change records.
Source code in src/horde_model_reference/pending_queue/models.py
PendingChangeDiff
Bases: BaseModel
Diff between current model state and proposed pending change.
This model provides a detailed view of what would change if the pending change were applied, including field-level diffs for update operations.
Source code in src/horde_model_reference/pending_queue/models.py
current_state
class-attribute
instance-attribute
current_state: dict[str, Any] | None = Field(
default=None,
description="The current model state in the backend (None if model doesn't exist for CREATE)",
)
proposed_state
class-attribute
instance-attribute
proposed_state: dict[str, Any] | None = Field(
default=None,
description="The proposed new state from the pending change payload (None for DELETE)",
)
net_operation
class-attribute
instance-attribute
net_operation: str = Field(
description="Computed net change type: 'added', 'modified', 'deleted', or 'unchanged'"
)
field_diffs
class-attribute
instance-attribute
field_diffs: list[dict[str, Any]] = Field(
default_factory=list,
description="List of field-level differences between current and proposed state",
)
is_critical
class-attribute
instance-attribute
is_critical: bool = Field(
default=False,
description="True if any critical fields (baseline, nsfw, etc.) are affected",
)
fields_added
class-attribute
instance-attribute
fields_added: list[str] = Field(
default_factory=list,
description="List of field paths that will be added",
)
PendingChangeDiffPage
Bases: BaseModel
Bulk diff response for multiple pending changes.