TenantAtlas/specs/016-backup-version-reuse/plan.md
ahmido a8bdfc5a77 feat: always capture policy when adding to backup (#22)
Problem: Beim Hinzufügen zu einem Backup Set kann ein lokaler “Reuse” dazu führen, dass ein Backup nicht den aktuellen Intune-Stand reflektiert, wenn last_synced_at nicht frisch ist.
Lösung: BackupService führt beim Add immer orchestrated capture aus (Graph Fetch), damit “Backup = current state” gilt.
Trotzdem kein unnötiges Version-Wachstum: PolicyCaptureOrchestrator re-used bestehende PolicyVersions via Snapshot-Hash, wenn sich nichts geändert hat.
Tests: Added BackupServiceVersionReuseTest.php
Specs: Updated spec.md + plan.md + tasks checked off.

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local>
Reviewed-on: #22
2026-01-02 14:33:29 +00:00

19 lines
783 B
Markdown

# Plan: Backup Version Reuse (016)
**Branch**: `016-backup-version-reuse`
**Date**: 2026-01-02
**Input**: [spec.md](./spec.md)
## Goal
Reduce unnecessary `PolicyVersion` creation when policies are added to backup sets by reusing an existing suitable latest version where safe.
## Approach
1. Always capture from Intune when a policy is added to a backup set (admin expectation: "backup = current state").
2. Rely on `PolicyCaptureOrchestrator` snapshot-hash reuse to avoid redundant `PolicyVersion` creation when nothing changed.
3. Still respect capture options (assignments / scope tags) via orchestrator backfill behavior.
4. Add tests for both reuse and capture paths.
## Out of scope
- UI toggles/config flags unless required.
- Cross-policy dedup or historical compaction.