audit_view
Audit log view and query utilities for pending queue operations.
PendingQueueAuditEvent
Bases: BaseModel
Single audit log entry tied to a pending change.
Source code in src/horde_model_reference/pending_queue/audit_view.py
PendingQueueAuditChange
Bases: BaseModel
Lifecycle view of a pending change reconstructed from audit events.
Source code in src/horde_model_reference/pending_queue/audit_view.py
PendingQueueAuditBatchSummary
Bases: BaseModel
High-level aggregate for a processed pending queue batch.
Source code in src/horde_model_reference/pending_queue/audit_view.py
PendingQueueAuditBatchDetail
Bases: PendingQueueAuditBatchSummary
Detailed view combining batch summary with per-change timelines.
Source code in src/horde_model_reference/pending_queue/audit_view.py
changes
class-attribute
instance-attribute
PendingQueueAuditBatchPage
Bases: BaseModel
Cursor-based page of batch summaries.
Source code in src/horde_model_reference/pending_queue/audit_view.py
PendingQueueAuditCurrentResponse
Bases: BaseModel
Snapshot of currently pending (unapproved) changes.
Source code in src/horde_model_reference/pending_queue/audit_view.py
_BatchState
dataclass
Source code in src/horde_model_reference/pending_queue/audit_view.py
approved_change_ids
class-attribute
instance-attribute
rejected_change_ids
class-attribute
instance-attribute
applied_change_ids
class-attribute
instance-attribute
__init__
__init__(
batch_id: int,
batch_title: str | None = None,
approved_by: str | None = None,
approved_at: int | None = None,
applied_at: int | None = None,
last_event_id: int | None = None,
approved_change_ids: set[int] = set(),
rejected_change_ids: set[int] = set(),
applied_change_ids: set[int] = set(),
) -> None
to_summary
Source code in src/horde_model_reference/pending_queue/audit_view.py
_ChangeState
dataclass
Source code in src/horde_model_reference/pending_queue/audit_view.py
events
class-attribute
instance-attribute
__init__
__init__(
change_id: int,
status: PendingChangeStatus = PendingChangeStatus.PENDING,
operation: AuditOperation | None = None,
category: MODEL_REFERENCE_CATEGORY | None = None,
model_name: str | None = None,
requested_by: str | None = None,
requested_at: int | None = None,
approved_by: str | None = None,
approved_at: int | None = None,
rejected_by: str | None = None,
rejected_at: int | None = None,
reject_reason: str | None = None,
applied_by: str | None = None,
applied_at: int | None = None,
applied_job_id: str | None = None,
batch_id: int | None = None,
batch_title: str | None = None,
events: list[PendingQueueAuditEvent] = list(),
) -> None
to_public
Source code in src/horde_model_reference/pending_queue/audit_view.py
PendingQueueAuditDataset
Reconstruct pending queue lifecycle details from audit events.
Source code in src/horde_model_reference/pending_queue/audit_view.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |
__init__
Initialize the dataset by replaying the provided audit events.
Source code in src/horde_model_reference/pending_queue/audit_view.py
_build_state
Source code in src/horde_model_reference/pending_queue/audit_view.py
_process_enqueue
Source code in src/horde_model_reference/pending_queue/audit_view.py
_process_approve
Source code in src/horde_model_reference/pending_queue/audit_view.py
_process_reject
Source code in src/horde_model_reference/pending_queue/audit_view.py
_process_apply
Source code in src/horde_model_reference/pending_queue/audit_view.py
_process_batch_split
Handle partial-apply batch split audit events by reassigning change ids.
Source code in src/horde_model_reference/pending_queue/audit_view.py
_ensure_batch
Source code in src/horde_model_reference/pending_queue/audit_view.py
pending_changes
Return pending changes (no approvals yet) newest-first.
Source code in src/horde_model_reference/pending_queue/audit_view.py
batches_page
batches_page(
*, cursor: int | None, limit: int
) -> tuple[list[PendingQueueAuditBatchSummary], int | None]
Return a cursor slice of batch summaries sorted from newest to oldest.
Source code in src/horde_model_reference/pending_queue/audit_view.py
batch_detail
Return full change information for the requested batch id.
Source code in src/horde_model_reference/pending_queue/audit_view.py
ModelNetChange
Bases: BaseModel
Net change for a single model across a batch.
Source code in src/horde_model_reference/pending_queue/audit_view.py
field_diffs
class-attribute
instance-attribute
BatchNetChangeResponse
Bases: BaseModel
Response containing net changes for all models in a batch.
Source code in src/horde_model_reference/pending_queue/audit_view.py
model_changes
class-attribute
instance-attribute
_payload_dict
Source code in src/horde_model_reference/pending_queue/audit_view.py
_parse_change_id
Source code in src/horde_model_reference/pending_queue/audit_view.py
_coerce_operation
_coerce_category
_coerce_int
load_pending_queue_audit_dataset
load_pending_queue_audit_dataset(
*, root_path: Path, domain: CanonicalFormat
) -> PendingQueueAuditDataset
Create a dataset by scanning audit segments for the pending queue category.
Source code in src/horde_model_reference/pending_queue/audit_view.py
compute_batch_net_changes
compute_batch_net_changes(
*,
root_path: Path,
domain: CanonicalFormat,
batch_id: int,
) -> BatchNetChangeResponse | None
Compute net changes for all models affected by a batch.
Replays audit events before and after the batch to detect the net effect of all operations (add, update, delete) on each model. Models that are deleted and re-added with identical content show net_operation=UNCHANGED.
Parameters:
-
root_path(Path) –Path to audit trail root directory.
-
domain(CanonicalFormat) –Audit domain (legacy or v2).
-
batch_id(int) –The batch ID to analyze.
Returns:
-
BatchNetChangeResponse | None–BatchNetChangeResponse with per-model diffs, or None if batch not found.
Source code in src/horde_model_reference/pending_queue/audit_view.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |