Zusammenfassung: Fügt im „Run Inventory Sync“-Modal einen include_dependencies-Toggle hinzu und persistiert die Auswahl in der InventorySyncRun.selection_payload. Tests, Quickstart und Tasks wurden entsprechend aktualisiert. Files: InventoryLanding.php, InventorySyncButtonTest.php, quickstart.md, tasks.md Motivation: Ermöglicht explizites Ein-/Ausschalten der Dependency-Extraktion pro Sync-Run (z. B. Assignments/Scope Tags/Foundations), statt starrer Defaults. Passt zur bestehenden selection_hash-Logik (InventorySelectionHasher) und zur deterministischen Selektionspersistenz. Verhalten: include_dependencies ist im Modal standardmäßig true. Wird die Option gesetzt, landet der Wert als bool im selection_payload und beeinflusst selection_hash über die Normalisierung. Tests: Neuer/angepasster Pest-Test stellt sicher, dass include_dependencies in selection_payload persistiert. Lokaler Testlauf: ./vendor/bin/sail artisan test tests/Feature/Inventory/InventorySyncButtonTest.php → alle Tests für diese Datei bestanden. ./vendor/bin/pint --dirty wurde ausgeführt (Formatting ok). How to test (quick): Start Sail + Queue: Im Admin → Inventory: „Run Inventory Sync“ öffnen, Include dependencies umschalten, ausführen. Prüfen: neu erstellter InventorySyncRun.selection_payload.include_dependencies ist der gesetzten Auswahl entsprechend. Oder laufen lassen: Notes / Next steps: Diese Änderung bereitet den Weg, später die Dependency-Extraction (042-inventory-dependencies-graph) optional tiefer zu integrieren. Working tree ist sauber; es gibt ein nicht eingebundenes Verzeichnis 0800-future-features (unrelated). Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local> Reviewed-on: #47
2.3 KiB
2.3 KiB
Phase 1 Design: Data Model (046)
Entities
InventorySyncRun
Existing table: inventory_sync_runs
Purpose: Observable record of one inventory sync execution for a tenant + selection.
Existing fields (selected)
idtenant_id(FK)selection_hash(sha256)selection_payload(jsonb)status(running|success|partial|failed|skipped)had_errors(bool)error_codes(jsonb)error_context(jsonb)started_at,finished_atitems_observed_count,items_upserted_count,errors_count
Planned additions (to satisfy FR-008)
user_id(nullable FK tousers.id)- Meaning: initiator of the run (UI-triggered).
nullallowed for system/scheduled runs.
- Meaning: initiator of the run (UI-triggered).
Relationships
InventorySyncRun belongsTo TenantInventorySyncRun belongsTo User(new, nullable)
Validation rules (selection payload)
policy_types: list of strings; filtered throughPolicyTypeResolver::filterRuntime(...)categories: list of strings (optional; currently not used for the UI-triggered “full inventory” run)include_foundations: booleaninclude_dependencies: boolean
BulkOperationRun
Existing table: bulk_operation_runs
Purpose: Generic progress tracking for background operations. Used by the bottom-right progress widget.
Relevant fields
tenant_id,user_idresource,action(used for display)status(pending|running|completed|completed_with_errors|failed|aborted)- Counters:
total_items,processed_items,succeeded,failed,skipped audit_log_id(FK)
Usage for Inventory Sync
resource = 'inventory',action = 'sync'total_items = 1item_ids = [selection_hash](or[inventory_sync_run_id]after creation)
AuditLog
Existing table: audit_logs
Purpose: Immutable audit trail with actor identity snapshot.
Usage for Inventory Sync
- Emit
inventory.sync.dispatchedand a terminal event likeinventory.sync.completed/inventory.sync.failed. resource_type = 'inventory_sync_run',resource_id = (string) $run->id- Actor fields filled from authenticated user.
State transitions
InventorySyncRun
running→success|partial|failedrunning→skipped(lock/concurrency)
BulkOperationRun
pending→running→completed|completed_with_errors|failed|aborted