TenantAtlas/specs
ahmido 30ad57baab feat/053-unify-runs-monitoring (#60)
Summary

This PR introduces Unified Operations Runs + Monitoring Hub (053).

Goal: Standardize how long-running operations are tracked and monitored using the existing tenant-scoped run record (BulkOperationRun) as the canonical “operation run”, and surface it in a single Monitoring → Operations hub (view-only, tenant-scoped, role-aware).

Phase 1 adoption scope (per spec):
	•	Drift generation (drift.generate)
	•	Backup Set “Add Policies” (backup_set.add_policies)

Note: This PR does not convert every run type yet (e.g. GroupSyncRuns / InventorySyncRuns remain separate for now). This is intentionally incremental.

⸻

What changed

Monitoring / Operations hub
	•	Moved/organized run monitoring under Monitoring → Operations
	•	Added:
	•	status buckets (queued / running / succeeded / partially succeeded / failed)
	•	filters (run type, status bucket, time range)
	•	run detail “Related” links (e.g. Drift findings, Backup Set context)
	•	All hub pages are DB-only and view-only (no rerun/cancel/delete actions)

Canonical run semantics
	•	Added canonical helpers on BulkOperationRun:
	•	runType() (resource.action)
	•	statusBucket() derived from status + counts (testable semantics)

Drift integration (Phase 1)
	•	Drift generation start behavior now:
	•	creates/reuses a BulkOperationRun with drift context payload (scope_key + baseline/current run ids)
	•	dispatches generation job
	•	emits DB notifications including “View run” link
	•	On generation failure: stores sanitized failure entries + sends failure notification

Permissions / tenant isolation
	•	Monitoring run list/view is tenant-scoped and returns 403 for cross-tenant access
	•	Readonly can view runs but cannot start drift generation

⸻

Tests

Added/updated Pest coverage:
	•	BulkOperationRunStatusBucketTest.php
	•	DriftGenerationDispatchTest.php
	•	GenerateDriftFindingsJobNotificationTest.php
	•	RunAuthorizationTenantIsolationTest.php

Validation run locally:
	•	./vendor/bin/pint --dirty
	•	targeted tests from feature quickstart / drift monitoring tests

⸻

Manual QA
	1.	Go to Monitoring → Operations
	•	verify filters (run type / status / time range)
	•	verify run detail shows counts + sanitized failures + “Related” links
	2.	Open Drift Landing
	•	with >=2 successful inventory runs for scope: should queue drift generation + show notification with “View run”
	•	as readonly: should not start generation
	3.	Run detail
	•	drift.generate runs show “Drift findings” related link
	•	failure entries are sanitized (no secrets/tokens/raw payload dumps)

⸻

Notes / Ops
	•	Queue workers must be restarted after deploy so they load the new code:
	•	php artisan queue:restart (or Sail equivalent)
	•	This PR standardizes monitoring for Phase 1 producers only; follow-ups will migrate additional run types into the unified pattern.

⸻

Spec / Docs
	•	SpecKit artifacts added under specs/053-unify-runs-monitoring/
	•	Checklists are complete:
	•	requirements checklist PASS
	•	writing checklist PASS

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local>
Reviewed-on: #60
2026-01-16 15:10:31 +00:00
..
001-rbac-onboarding docs: deprecate .specify specs and update references (#53) 2026-01-10 21:40:46 +00:00
002-filament-json spec: add 002 filament json 2025-12-14 19:56:17 +01:00
003-settings-catalog-readable dev-merges/c709b36 (#3) 2025-12-21 23:15:12 +00:00
004-assignments-scope-tags docs: deprecate .specify specs and update references (#53) 2026-01-10 21:40:46 +00:00
005-bulk-operations feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
006-sot-foundations-assignments feat(006): foundations + assignment mapping and preview-only restore guard (#7) 2025-12-26 23:44:31 +00:00
007-device-config-compliance feat(007): device config & compliance snapshot/restore improvements (#9) 2025-12-29 12:46:20 +00:00
008-apps-app-management docs: deprecate .specify specs and update references (#53) 2026-01-10 21:40:46 +00:00
009-app-protection-policy feat/009-app-protection-policy (#11) 2025-12-29 16:11:50 +00:00
010-admin-templates docs: deprecate .specify specs and update references (#53) 2026-01-10 21:40:46 +00:00
011-restore-run-wizard feat/011-restore-run-wizard (#37) 2026-01-07 01:40:04 +00:00
012-windows-update-rings feat/012-windows-update-rings (#18) 2026-01-01 10:44:17 +00:00
013-scripts-management 013-scripts-management (#19) 2026-01-01 22:02:30 +00:00
014-enrollment-autopilot 014-enrollment-autopilot (#20) 2026-01-02 11:59:21 +00:00
015-policy-picker-ux 015-policy-picker-ux (#21) 2026-01-02 13:59:15 +00:00
016-backup-version-reuse feat: always capture policy when adding to backup (#22) 2026-01-02 14:33:29 +00:00
017-policy-types-mam-endpoint-security-baselines feat/017-policy-types-mam-endpoint-security-baselines (#23) 2026-01-03 02:06:35 +00:00
018-driver-updates-wufb feat/018-driver-updates-wufb (#27) 2026-01-04 00:38:54 +00:00
023-endpoint-security-restore feat/018-driver-updates-wufb (#27) 2026-01-04 00:38:54 +00:00
024-terms-and-conditions spec/024-additional-intune-types (#28) 2026-01-04 02:27:44 +00:00
025-policy-sets spec/024-additional-intune-types (#28) 2026-01-04 02:27:44 +00:00
026-custom-compliance-scripts spec/024-additional-intune-types (#28) 2026-01-04 02:27:44 +00:00
027-enrollment-config-subtypes feat/027-enrollment-config-subtypes (#31) 2026-01-04 13:25:15 +00:00
028-device-categories spec/024-additional-intune-types (#28) 2026-01-04 02:27:44 +00:00
029-wip-policies spec/024-additional-intune-types (#28) 2026-01-04 02:27:44 +00:00
030-intune-rbac-backup spec/024-additional-intune-types (#28) 2026-01-04 02:27:44 +00:00
031-tenant-portfolio-context-switch feat/031-tenant-portfolio-context-switch (#32) 2026-01-04 21:28:08 +00:00
032-backup-scheduling-mvp feat/032-backup-scheduling-mvp (#36) 2026-01-07 01:12:12 +00:00
039-inventory-program spec: add inventory specs 039-044 (#42) 2026-01-07 14:01:07 +00:00
040-inventory-core feat/040-inventory-core (#43) 2026-01-07 14:54:24 +00:00
041-inventory-ui feat/041-inventory-ui (#44) 2026-01-07 17:10:57 +00:00
042-inventory-dependencies-graph feat/042-inventory-dependencies-graph (#50) 2026-01-10 12:50:08 +00:00
043-cross-tenant-compare-and-promotion spec: add inventory specs 039-044 (#42) 2026-01-07 14:01:07 +00:00
044-drift-mvp feat/044-drift-mvp (#58) 2026-01-14 23:16:10 +00:00
045-settingscatalog-classification 046-inventory-sync-button (#47) 2026-01-09 22:15:04 +00:00
046-inventory-sync-button 046-inventory-sync-button (#47) 2026-01-09 22:15:04 +00:00
047-inventory-foundations-nodes feat/047-inventory-foundations-nodes (#51) 2026-01-10 20:47:29 +00:00
048-backup-restore-ui-graph-safety feat/048-backup-restore-ui-graph-safety (#55) 2026-01-11 00:14:35 +00:00
049-backup-restore-job-orchestration feat/049-backup-restore-job-orchestration (#56) 2026-01-11 15:59:06 +00:00
051-entra-group-directory-cache 051-entra-group-directory-cache (#57) 2026-01-11 23:24:12 +00:00
052-async-add-policies feat/052-async-add-policies (#59) 2026-01-15 22:20:16 +00:00
053-unify-runs-monitoring feat/053-unify-runs-monitoring (#60) 2026-01-16 15:10:31 +00:00
900-policy-lifecycle feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
0800-future-features 046-inventory-sync-button (#47) 2026-01-09 22:15:04 +00:00
.gitkeep chore(specs): add baseline specs folder 2025-12-14 19:42:35 +01:00