Purpose
PITR Recovery lets users load a current Firestore document and a historical point-in-time version, inspect the diff, and restore the historical version with guardrails.
Flow
- Select a project and Firestore database.
- Enter a document path.
- Enter a whole-minute recovery timestamp.
- Load current and historical versions.
- Review field diff, JSON, and logs.
- Restore the historical document version only after explicit confirmation.
Outputs
TABLE: field-level diff and recovery summaryJSON: current and historical document JSONLOGS: REST read/write, validation, and task logs
Validation
- Document path is required.
- Recovery timestamp must be valid and whole-minute aligned.
- Restore requires that a historical version was loaded successfully.
Use the module for incident response when a single Firestore document needs careful review before restoration. The operator should select the Firebase project, Firestore database, document path, and historical timestamp, then compare the current data against the recovered snapshot before approving any write. That keeps recovery evidence visible instead of hiding it inside an external script.
The table and JSON outputs are useful for different review styles. Table output summarizes changed fields, missing fields, and restored values, while JSON output keeps the raw document payload available for copying into a ticket or runbook. Logs should capture request timing, selected target details, PITR API errors, and restore validation failures.
Safety
- Restore is a Firestore write and is blocked for read-only projects.
- Production restore requires explicit confirmation.
- Restore should run through the task queue.
- The diff should make changed, added, removed, and unchanged fields clear before confirmation.
Source Anchors
Sources/FirestructApp/Features/PITR/UI/PITRRecoveryView.swiftSources/FirestructApp/Features/PITR/Services/AppModel+PITRActions.swiftSources/FirestructApp/Features/PITR/Model/PITRStore.swiftSources/FirestructCore/FirestorePITRService.swift