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
30 lines
1.6 KiB
Markdown
30 lines
1.6 KiB
Markdown
# Feature Specification: Backup Version Reuse (016)
|
||
|
||
**Feature Branch**: `016-backup-version-reuse`
|
||
**Created**: 2026-01-02
|
||
**Status**: Draft
|
||
|
||
## User Scenarios & Testing
|
||
|
||
### User Story 1 — Avoid unnecessary version growth (Priority: P1)
|
||
As an admin, I want adding policies to a backup set to reuse an existing recent policy version when safe, so backups don’t create redundant versions and operations stay fast.
|
||
|
||
**Acceptance Scenarios**
|
||
1. Given a policy already has an identical captured snapshot, when I add it to a backup set, then the backup item links to the existing version (no new version is created).
|
||
2. Given a policy has no suitable version, when I add it to a backup set, then a new version is captured and linked.
|
||
|
||
## Requirements
|
||
|
||
### Functional Requirements
|
||
- **FR-001**: Adding policies to a backup set SHOULD avoid creating redundant `PolicyVersion` records by reusing an existing version when the captured snapshot is unchanged.
|
||
- **FR-002**: If reuse is not safe/possible, the system MUST capture a new `PolicyVersion` as it does today.
|
||
- **FR-003**: Reuse MUST respect capture options:
|
||
- If assignments are requested, the reused version must include assignments.
|
||
- If scope tags are requested, the reused version must include scope tags.
|
||
- **FR-005**: Adding a policy to a backup set MUST capture from Intune to ensure the backup reflects the current state.
|
||
- **FR-004**: Behavior changes MUST be covered by automated tests.
|
||
|
||
## Success Criteria
|
||
- **SC-001**: Backups avoid creating redundant policy versions in the common case.
|
||
- **SC-002**: Backup correctness is preserved (no missing required data for restore/preview).
|