Skip to content

feat: US-005 - Restore points from the external companion (atomic backups, safety-first restore) - #10

Merged
Varonal merged 3 commits into
mainfrom
ralph/external-companion
Nov 20, 2026
Merged

Varonal merged 3 commits into
mainfrom
ralph/external-companion

Conversation

@Varonal

@Varonal Varonal commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Summary (US-005)

Domain (pure, unit-tested) — src/PKForge.Domain/ExternalRestorePoints.cs:

  • RestorePointRules.ForGame(all, documentId, open) — restore points of one save, newest first, filtered via BackupInfo.BelongsTo (direct documentId match, legacy format+generation+name fallback).
  • OrderNewestFirst (stable), NameFor(kind, utc, french) — localized, invariant-culture timestamped naming (Point de restauration · 2026-11-19 16:50 / Restore point · …) for Manual and SafetyBeforeRestore.

App — ExternalRestorePointService (registered in MauiProgram), on the existing atomic backup pipeline IBackupService:

  • ListForAsync(savePath) → newest-first CompanionRestorePoints for that save.
  • CreatePointAsync(savePath) → named + timestamped backup (CreateAsync(snapshot, name, documentId: savePath)) — never an in-place write of the game's save.
  • RestoreAsync(host, savePath, backupId) → mandatory confirmation (PadMenu.ConfirmAsync, destructive) → safety backup of the live save first → hash-checked ReadAsync (corrupt point = clean failure) → atomic temp+move write of the .sav.

UI strings: 10 new FR-default/EN keys in AppStrings. 8 new Domain tests.

prd.json: US-005 passes: true + on-device notes. progress.txt: appended.

Verification

  • CI (this PR): dotnet test tests/PKForge.Domain.Tests -c Release + dotnet build src/PKForge.App -f net10.0-android.
  • Local: no .NET SDK in this sandbox — static checks (contracts, localization of every new key, Domain purity, DI) passed.
  • Manual on device (US-007 wires the companion view): create a point from the external companion, see it on top of the list, restore with confirmation → .sav replaced + safety point exists; no crash on a corrupt point.

mistral-vibe and others added 3 commits November 20, 2026 07:54
Domain (pure, tested): RestorePointRules.ForGame filters backups via
BackupInfo.BelongsTo (documentId, legacy format+gen+name fallback) newest
first; OrderNewestFirst stable; NameFor(kind, utc, french) localized,
invariant-culture timestamped naming for Manual and SafetyBeforeRestore points.

App: ExternalRestorePointService (DI) on the existing atomic IBackupService
pipeline - ListForAsync (BelongsTo(savePath, snapshot)), CreatePointAsync
(named+timestamped backup, documentId=savePath, never in-place), RestoreAsync
(mandatory PadMenu.ConfirmAsync, safety backup of the live save first,
hash-checked ReadAsync, atomic temp+move write of the .sav). 10 new FR/EN UI
strings in AppStrings. 8 new Domain tests.

prd.json: US-005 passes=true. progress.txt: appended learnings.

Co-authored-by: Varonal <Varonal@users.noreply.github.com>
…ore/RestoreThisPoint), drop duplicates

Co-authored-by: Varonal <Varonal@users.noreply.github.com>
Co-authored-by: Varonal <Varonal@users.noreply.github.com>
@Varonal
Varonal merged commit 6f6ac7a into main Nov 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants