diff --git a/Docs/Investigations/2026-11-06-backup-import-export-audit.md b/Docs/Investigations/2026-11-06-backup-import-export-audit.md new file mode 100644 index 00000000..36a82224 --- /dev/null +++ b/Docs/Investigations/2026-11-06-backup-import-export-audit.md @@ -0,0 +1,312 @@ +# PlotDirector JSON import/export and backup/restore audit + +Date: 6 November 2026. Application source inspected: `87c94f124ac29a0d835f95f86c6bc60c731f8fc6`, branch `codex/word-companion-native-phase1-20261104`. + +## 1. Executive summary + +**Retain the existing recovery engines.** PlotDirector already has a substantially developed, versioned project backup and restore implementation, including manuscript sources, maps, floor plans, files, planning, continuity decisions and much retained Story Intelligence history. It is considerably more complete than the legacy JSON outline importer. + +The source exposes several different operations: + +- **Download project backup:** exports a whole project as JSON inside a `.plotdirector` file, currently format `PlotDirector.ProjectBackup`, version `1.3`. +- **Import a downloaded backup:** the existing JSON Import page recognises that format, validates/previews it and creates a **new project**, remapping identities. It does not replace the selected project or import into an existing book. +- **Saved Restore Points:** snapshots held inside the application database. Restore replaces the **same project**, first creating a complete safety snapshot. It is a different service path from uploaded-file import. +- **Restore archived project/book/item:** unhides retained records. It does not read a backup or rewind content. +- **Legacy JSON import:** creates structure/planning from a different, smaller outline format. It still has a legitimate advanced portability purpose. No standalone exporter producing that legacy package was found. + +The Projects header currently says **“Import JSON”**, not simply “Import”. Its underlying page handles both legacy packages and project backups, but presents a sample/textarea-oriented technical experience. The legacy schema is **already collapsed** under `
`. The visible “Download backup” More menu is on **project cards** and passes `projectId`; no standalone book-backup implementation was found. This corrects two assumptions in the request without diminishing the usability problem. + +**Strong runtime evidence:** the existing guarded synthetic database harness passed a populated copy and in-place restore: **103 persistent collections**, **2,467 remapped stored-value comparisons** for copy and **2,563** for same-project restore. Real HTTP download tests retained **12 uploaded files** and gallery metadata. Invalid input, SQL rollback, ownership, omission and upload-transport tests are described below. These are synthetic tests, not a claim of compatibility with every historical author backup. + +**High-priority new coverage gap:** the live Development schema now has **171 tables**, versus the previous classified census of 167. The four additions—`NativeChapterReviews`, `NativeImportOperations`, `NativeReviewImports`, `WritingIntentAssessments`—are absent from the backup DTO/selectors, restore lists, omission detection and copy remapping. Canonical prose/planning created by native imports is covered; pending native review decisions, native import receipts/range provenance, and Intent assessment evidence/author decisions are not portable. These four tables were empty in the read-only Development census. This is a confirmed silent-loss exposure for future populated backups, **not evidence of an author already losing those records**. + +**Confirmed browser defect:** the actual import FileReader script allows an older file read to overwrite the newer selected file's textarea/carried JSON. Reproduced in a browser fixture without submitting any import. + +Recommended direction: separate author-facing **Restore a backup as a new project** and **Restore this project from a saved point** navigation, reuse the existing services and confirmations, retain legacy JSON under Advanced Data Tools, and close the new data/lifecycle gaps before claiming complete recovery. + +## 2. Scope, safety and evidence conventions + +The worktree was clean; the configured remote was inspected (`origin`, `git@git.catherinelynwood.com:nick/PlotDirector.git`), fetched, and the existing branch fast-forward check reported already up to date. No branch/worktree was created. + +This investigation changed no application code, migration or deployed service. No Production access or deployment occurred. Live `PlotDirector_Development` access was read-only: database identity, table/procedure metadata and four aggregate counts. Its author projects, users, subscriptions and story data were not modified. + +Round trips used the **existing separately named disposable database** `PlotDirector_Phase2_20261103_2305`, not the running Development database. Its literal database name and `PlotDirector.Phase2.SyntheticOnly=true` marker were verified before writes. Existing test code refuses another target. Fixtures create their own synthetic actors/projects and private files under `/srv/repos/plotdirector-phase2-artifacts/synthetic-uploads/`; no real account credentials or production manuscript were used. Fixtures remain there as test evidence; no broad cleanup/reset was performed. + +Before those writes, a COPY_ONLY/CHECKSUM backup was made and VERIFYONLY succeeded: + +`/var/opt/mssql/backups/PlotDirector_Phase2_20261103_2305-backup-audit-20261106T114958.bak` + +No schema migrations were applied, including to the synthetic database. Test-only assertions/fixtures are existing code, run without `--apply-required-migrations`. + +Evidence levels below distinguish **source-confirmed**, **runtime verified in this audit**, **prior recorded qualification**, and **unverified/inferred consequence**. Existing detailed census/coverage files under `Docs/Sprints/2026-11-03-phase2-*` were used as prior evidence and checked against current metadata; their historical completeness claim does not automatically extend to migrations231–235. + +### Source evidence index + +| Ref | Actual components | +|---|---| +| E1 | `PlotLine/Controllers/ImportsController.cs`: `Index`, `Sample`, `Preview`, `Import`, `ValidationReport`; `Views/Imports/Index.cshtml`, `Result.cshtml`; `ViewModels/ImportViewModels.cs` | +| E2 | `Services/ImportServices.cs`: `DetectImportFormat` (656), `TryReadProjectBackup` (577), `BuildProjectBackupPreviewAsync` (337), `ImportProjectBackupAsync` (384), `RemapProjectBackupForImport` (875), `ReadJsonTextAsync` (3093); `Models/ImportModels.cs` | +| E3 | `Controllers/ExportsController.cs`: `ProjectBackup`; `Services/ProjectExportService.cs`: `ExportCoreAsync`, `BuildFileName`; `Data/ProjectBackupRepository.cs`: `GetProjectBackupAsync`; `Models/ProjectBackupModels.cs` | +| E4 | `Controllers/ProjectRestorePointsController.cs`; `Services/ProjectRestorePointService.cs`; `Services/ProjectRestoreService.cs`: `RestoreAsync`, `ValidateBackup`; `Data/ProjectRestorePointRepository.cs` | +| E5 | `Services/ProjectBackupFiles.cs`, `ProjectBackupMapValidation.cs`, `ProjectBackupGraphValidation.cs`, `ProjectBackupCollectionPresence.cs`, `ProjectBackupStoredFieldContract.cs` / `.Schema.cs`, `ProjectBackupTimelineState.cs`, `ProjectBackupStoryMemory.cs`, `ProjectBackupEntityReview.cs`, `ProjectBackupNarrative.cs` | +| E6 | SQL034/035/036, 084, 209, 213–229; current selector/restore implementations principally in214 and229; `Data/ImportRepository.cs` | +| E7 | `Services/ProjectAccessFilter.cs` (controller maps, owner-only map99, execution161); `ProjectAccessServices.cs`; `Tests/ProjectAccessRegressionTests.cs` | +| E8 | `Views/Projects/Index.cshtml` (header14, first-run97, project More196, archive restore273); `Views/Projects/Details.cshtml` (project Actions56–58); `Views/Books/Details.cshtml`; `Controllers/ProjectsController.cs`, `BooksController.cs`, `ArchivesController.cs` | +| E9 | `Services/CoreServices.cs`: `ExportService` (7225); `Controllers/ExportsController.cs`; `Data/Repositories.cs`: `ExportRepository`; `Controllers/WritingSolverReviewController.cs`, `Services/WritingSolverReview.cs` | +| E10 | SQL230–235; `Services/NativeCompanion/NativeImportService.cs`, `NativePresenceStore.cs`; `Services/IntentAssessmentService.cs`; `Data/NativeImportRepository.cs`, `NativePositionRepository.cs`, `IntentAssessmentRepository.cs` | +| E11 | `PlotLine.Tests/ProjectTransferDatabaseTests.cs`, `ProjectExportDatabaseTests.cs`, `LegacyImportDatabaseTests.cs`, `ImportTransportTests.cs`, `ProjectBackupStoredFieldTests.cs`, `ProjectBackupConsistencyTests.cs`, `ProjectBackupImageConsistencyTests.cs` and `ProjectTransfer*Assertions` / `ProjectTransferPlanning.sql` fixtures | +| E12 | Help `Articles/Imports/Overview.md`, `RestorePoints/Overview.md`; `wwwroot/js/site.js` shared confirmation modal; Imports view inline FileReader/carried-JSON script (388 onward) | + +Paths in the index are relative to `PlotLine/` unless `PlotLine.Tests/` or `Docs/` is stated. Line numbers are investigation-baseline aids, not promises after future edits. + +## 3. Existing feature inventory and UI entry points + +| Mechanism / entry | Intention and actual behaviour | Format / storage / validation | Tests and overlap | +|---|---|---|---| +| Projects header **Import JSON** → `GET /Imports` | Prepared outline/data import; same page also accepts full backups. Does not parse `.docx`, merge existing projects, or upload to Word. | Prefilled legacy sample, paste or `.json`/`.plotdirector` upload; preview/report/dry run/confirmation. | E1/E2/E11. Shared UI with backup-copy import is the confusing overlap. | +| Legacy `POST /Imports/Import` | Creates new project/books/chapters/scenes plus supported named references. Useful for structured outlines or external generators. | `PlotLineImportPackage`; `packageVersion=1.0` is expected but other versions warn rather than automatically refuse if structure is valid. No `format` discriminator like backups. Required titles/orders; aliases, number bounds, reference diagnostics. | Legacy SQL and transport tests passed. No corresponding full-fidelity legacy-package export discovered. | +| `GET /Imports/Sample`, `POST /Imports/ValidationReport` | Downloads sample legacy JSON or text validation diagnostics. Not a backup. | `plotline-import-sample.json`; `plotline-import-validation-report.txt`. | Actual published sample and real MVC transport tested. | +| Project card More → `GET /Exports/ProjectBackup?projectId=…` | Downloads **entire project**, all included books and project-scoped data. Owner-only HTTP gate. | Camel-case indented UTF-8 JSON; MIME `application/json`; filename `_.plotdirector`; root `format`, `formatVersion`, `exportedAtUtc`, `sourceApplication`, `project`, `data`, `files`, `diagnostics`. | E3; actual HTTP/file checks passed. “Book backup” would be an inaccurate label. | +| Project dashboard Actions → Download Project Backup / Restore Points | Correctly names project scope. Actual book cards have book actions, not a separate book-backup engine. | Same download route; points link below. | E8. Reuse these entries rather than inventing another backup. | +| Upload `.plotdirector` through Imports → Preview → Import | Restores file contents **as a new project owned by the importing user**. No destination project/book selector or replace-uploaded-file path. | Versions1.0–1.3 accepted with differing completeness/file semantics. Revalidation, warning acknowledgement, duplicate-title consent, subscription/storage/book-slot checks. | Full populated copy/remapping passed. Uses same SQL apply engine as saved-point restore after creating a new shell. | +| `GET /ProjectRestorePoints/Index?projectId=…`; POST Create | Database-held manual snapshot generated by the same project-export service. Not a separate file format. | `ProjectRestorePoints.JsonData`, metadata and byte count. Service blocks manual creation once total point count is10; pre-restore safety snapshots bypass manual cap. | E4/E6. Points are inside the same DB failure domain; download off-host for disaster recovery. | +| Point Download | Downloads stored snapshot, not a fresh export of current state. | Same `.plotdirector` JSON; filename adds `_RestorePoint_`. | Actual HTTP download retained12 embedded files. | +| Point POST Restore | Replaces current contents of that same project; explicit Bootstrap confirmation modal; creates safety backup first. File cannot be uploaded here. | Requires point/project match, supported format, complete stored-field/collection checks, graph/files validation; SQL apply and history. | Actual service/in-place value comparisons, safety/refusal and rollback tests. | +| Point POST Delete | Deletes only the selected snapshot. Existing modal and POST antiforgery. | Stored snapshot deletion, not deletion of the project itself. | E4; preserve while improving navigation. | +| Archived Projects / Books / Archives Restore | Unarchives retained entities; no historical reconstruction or JSON read. Project archive restore enforces ownership in its service/repository path rather than the general skipped filter action. | `IsArchived` and archive metadata; separate archive procedures. Hard deletion is an independent destructive action. | E8; distinguish “Unarchive” from backup restore in future terminology. | +| Story Bible, Narrative Timeline, Character, Scene/Chapter Brief, Writing Session, Research Pack, Search exports | Readable reference/report documents, not recovery files. | HTML default; Markdown/md and text/txt. An unknown format—including `json`—falls back to HTML, not a legacy JSON export. `Export_*` stored procedures. | Eight packet types × five formats/aliases passed real HTTP/SQL tests. No matching importer. | +| Solver review JSON | Development-only, AdminOnly diagnostic review capture, not a project backup. | `GET /admin/writing-solver-review/{id}/export`, `solver-review-.json`; `App_Data/WritingSolverReview`, no project import counterpart. | E9. Keep in diagnostics; not an ordinary author's recovery flow. | +| Word/onboarding/native approved import | Word authority → bounded extraction → AI review → approved canonical data. Different contracts and author workflow. | Existing Onboarding `POST StartImport`, Book create `BeginMode=Import`; native review/preview/confirm routes. | Not a JSON project-restore replacement. Once approved prose is stored in canonical source tables it enters existing backup scope. | + +The Projects first-run screen already provides **Import an existing manuscript** via `Onboarding.StartImport`; ordinary nonempty Projects retains the more prominent technical header link. Book creation already supports a manuscript begin mode. Reuse those author-facing entry points without redirecting JSON files into manuscript analysis. + +## 4. Current storage and coverage matrix + +**Column meaning:** “JSON export” refers to the actual project JSON export in E3. No independent legacy JSON exporter exists to compare against it. “Backup” is the database-saved restore-point snapshot generated from that same export. Thus two Yes columns do **not** represent independent recovery implementations. Legacy DTO import coverage is stated separately below. `C/R` = new-project copy / same-project restore. `Partial` describes an explicit scope boundary, not an assumed missing implementation. + +| Feature | Stored data / actual tables | JSON export | Backup | Restore | Evidence | Gap/risk | +|---|---|---|---|---|---|---| +| Project / book metadata | `Projects`, `Books` incl subtitle, era, locale, explicit-scene mode, covers, archive state | Yes | Same | C/R; project ID new on C | E3, SQL213; populated tests | Whole project scope; no standalone book package. | +| Chapter/scene structure | `Chapters`, `Scenes`, `ScenePurposes`, `SceneOutcomes` | Yes | Same | C remaps; R retains IDs | E3/E6/E11 | Word document itself is not rewound. | +| Manuscript prose / document metadata | `SceneManuscriptSources`, `ManuscriptStructuralChapterSources`, `ManuscriptDocuments` | Yes | Same | C/R; copied bindings inactive/reconnect | SQL214; full stored-text tests | Saved source only, not original `.docx`, unsaved edits, comments or tracked changes. Unimported prose is not guaranteed in project backup. | +| Core import provenance | `OnboardingManuscriptBuilds`, `OnboardingManuscriptBuildChapterMap`, `…SceneMap`, `…CharacterMap` | Yes | Same | C/R with IDs/preview IDs remapped; unfinished copy history inactive | SQL220, E2 | Does not include newer native receipt/ledger below. | +| Characters / aliases / appearance | `Characters`, `CharacterAliases`, `SceneCharacters`, `CharacterImages` | Yes | Same | C/R plus image bytes | SQL214/217/220; gallery/Unicode tests | Deleted gallery metadata retained; deleted file bytes intentionally not required. | +| Character attributes / knowledge | `CharacterAttributeTypes`, `CharacterAttributeEvents`, `CharacterKnowledge` | Yes, mixed project/shared types | Same | C/R; project definitions remapped | E3/E6/E11 | Shared vocabulary authority is separate. | +| Relationships | `CharacterRelationships`, `RelationshipEvents` | Yes | Same | C/R with endpoint/state/type resolution | E2/E5/E11 | Import checks relationship-map diagnostics; not an arbitrary cross-instance shared-vocabulary clone. | +| Locations / hierarchy | `Locations`, `LocationAliases`, `LocationRelationships` | Yes | Same | C/R parent/edge remapping | E5/E11 | Core location hierarchy differs from Story Memory parent portability caveat below. | +| Floor plans / occupancy | `FloorPlans`, `FloorPlanFloors`, `FloorPlanBlocks`, `FloorPlanTransitions`, `SceneFloorPlanOccupancy`, `SceneAssetLocations` | Yes | Same | C/R; background bytes staged | SQL084/217; populated fixture | Linked rooms, floors and entity mappings included; not merely plan titles. | +| Story Maps / shapes | `StoryMaps`, `MapFeatures`, `MapRelationships`, `MapJourneyNotes`, `MapReferenceImages` | Yes | Same | C/R incl parent maps/features, geometry, routes and image placement | SQL209/215; actual geometry tests | Opaque geometry/extensions, locks/labels/unplaced features are tested. Map revision is safely advanced on restore. | +| Plot lines / developments | `PlotLines`, `PlotThreads`, `ThreadEvents`, `PlotEventTargetPlotLines`, `AuthorPlotSeeds` | Yes | Same | C/R incl multiple target associations | SQL214/228; full fixture | Historical source references remapped/detached according to declared provenance. | +| Timeline / calendar | Scene dates/time modes/confidence plus `ProjectTimelineSettings`, `ProjectTimelineMetricSettings`, `TimelineViewPresets` | Yes | Same | C/R | E3/E5/E11 | Calendar is a view of saved timeline/scene data, not a second missing calendar-event engine. | +| Metrics | `SceneMetricTypes`, `SceneMetricValues`; `GenreMetricPresets`, `GenreMetricPresetMetrics` diagnostic vocab | Yes | Same | Project values/types yes; shared presets not overwritten | E3/E5/E6 | Shared/admin configuration is not restored from author JSON. | +| Intent / planning / writing workflow | Scene purpose/outcome; `ChapterGoals`, `SceneChecklistItems`, `SceneNotes`, `SceneWorkflow`, `WritingPlans`, `WritingScheduleItems` | Yes | Same | C/R incl completion, dates, schedule ownership remapping | SQL214; explicit writing-plan and planning tests | Recent AI evidence/author decisions in `WritingIntentAssessments` are absent. | +| Story assets / custody | `StoryAssets`, `AssetAliases`, `AssetStates`, `AssetEvents`, `AssetDependencies`, `AssetCustodyEvents`, `AssetCustodyEventCharacters`, `SceneAssetLocations` | Yes | Same | C/R | E3/E6/E11 | Shared state lookups remapped; not restored globally. | +| Scene dependencies | `SceneDependencies` | Yes | Same | C/R | E5/E11 | Cross-project/unknown scene references validated. | +| Continuity | `ValidationRuns`, `ContinuityWarnings`, `ContinuityWarningAcknowledgements` | Yes | Same | C/R incl saved author decisions | SQL214; acknowledgement tests | Restored results are historical observations, not proof prose was freshly reanalysed. | +| Alternative scenarios | `Scenarios`, `ScenarioSceneOrder`, `ScenarioValidationRuns`, `ScenarioWarnings` | Yes | Same | C/R | E3/E6/E11 | Separate scenario order retained. | +| Companion entity suggestions / counts | `WordCompanionSceneAssets`, `WordCompanionSceneLocations`, `SceneAssetSuggestions`, `SceneCharacterSuggestions`, `SceneLocationSuggestions`, `SceneTextStatistics` | Yes | Same | C/R | SQL216/221 | These legacy/canonical scene links are not the new native session/ledger. | +| Basic location import review | `CoreImportBasicLocationReviews`, `…Candidates`, `…Evidence` | Yes | Same | C/R review/build/preview links remapped | SQL222; populated tests | Human decisions are already included here; retain this precedent. | +| Retained Story Intelligence analysis | `StoryIntelligenceRuns`, `StoryIntelligenceChapterResults`, `StoryIntelligenceSceneResults`, `StoryIntelligenceImportCommits` | Yes | Same | C/R; unfinished copied runs cancelled | SQL223; retained raw-result tests | Audit/history, not permission to restart paid jobs. | +| Story Memory / intelligence profiles | `StoryIntelligenceBookPipelines`; `StoryMemoryCharacters`, `…CharacterAliases`, `…CharacterAttributes`, `…Locations`, `…Assets`, `…Relationships`, `…ProcessedSceneResults`, `…ImportPreferences`; `CharacterIntelligenceProfiles`, `CharacterIntelligenceEvidenceEvents` | Yes | Same | C/R with typed embedded-reference remapping | SQL224/E5 | Copy explicitly refuses Story Memory location ParentLocationID whose portable meaning is undefined; same-project restore can retain it. | +| Persisted entity review | `StoryIntelligenceReviewCandidateGenerations`, `StoryIntelligenceReviewCandidates`, `StoryIntelligenceReviewCandidateEvidence` | Yes | Same | C/R; preparing copies become failed/inactive | SQL225/E11 | Retains evidence/decisions; not all AI state is disposable cache. | +| Character enrichment | `CharacterEnrichmentRuns`, `CharacterEnrichmentEvidence` | Yes | Same | C/R, inactive unfinished copies | SQL227 | Existing active work can block same-project restore. | +| Narrative review | `WholeBookPlotSynthesisRuns`, `StoryIntelligenceNarrativeCandidates`, `…CandidateEvidence`, `…CandidateEvents` | Yes | Same | C/R incl ignored/tombstone decisions | SQL228/E11 | Do not silently restart synthesis. | +| Project illustration history | `StoryMemoryIllustrationAssignments`, `StoryMemoryIllustrationDemands`, `StoryIntelligenceIllustrationDemands` | Yes | Same | C/R; copies inactive, shared catalogue IDs detached | SQL229/E11 | Shared illustration catalogue/artwork files/approval/usage are deliberately outside project recovery. | +| Uploaded files | Referenced character/avatar/gallery/asset images, covers, floor backgrounds, `SceneAttachments`; map reference image bytes | v1.3 bytes + SHA256 | Same | Fresh paths staged before SQL; failure removes new files | E5/SQL217; 12-file HTTP and byte tests | JSON is not encrypted. Old formats lack these upload bytes. Shared catalogue files excluded. | +| Project ACL / file accounting | `ProjectUserAccess`, `UserFile` (`ProjectAccess`, `UserFiles` JSON) | Diagnostic/reference | Same | Original collaborators/account authority not recreated | E3 diagnostics, SQL226 | Includes names/email/actor metadata; keep downloaded files private. New copy owned by importer. | +| Activity / recovery history | `ProjectActivity`, `ProjectRestorePoints`, `ProjectRestoreHistory` | Not portable project history / no recursive point archive | Stored separately | Existing activity retained; new restore history appended; points not copied | E4/E6, account-state tests | A downloaded backup is not an archive of every restore point or the entire server DB. | +| Native chapter review (231/232) | `NativeChapterReviews`: result, edited decisions, encrypted selected-chapter capture | **No** | **No** | C loses it; R leaves outside snapshot | E10; absent DTO + live selectors | Human approvals/title edits can be lost on file-only recovery; encrypted source is server-key-bound. Logical30-day visibility/lazy cleanup, not permanent canonical storage. | +| Native import idempotency / positions (232–234) | `NativeImportOperations`, `NativeReviewImports` incl document/session/revision/range JSON | **No** | **No** | C absent; R leaves old rows outside rewind | E10; current live SQL metadata | Stale receipts/ledger can disagree with restored chapters; needs integration lifecycle policy. | +| Intent assessment (235) | `WritingIntentAssessments`: input hash, evidence, **author decisions**, model/time | **No** | **No** | C loses evidence/decisions; R does not rewind them | E10; current live metadata | Evidence may be regenerable, author defer/dismiss/keep decisions are not. | +| Identity/billing/runtime state | `AppUser`, subscriptions, consents/jobs, account onboarding, PWA appearance; in-memory presence/auth/session queues | Excluded by design | Not a project snapshot concern | Never replay credentials, consent, account authority or active session commands | SQL226; existing table census | Full administrator DB/files/keys backup is a separate disaster-recovery responsibility. | + +The prior all-table classification is `Docs/Sprints/2026-11-03-phase2-data-coverage.csv`; model/row/value matrices and independent census there remain useful evidence for the 167-table baseline. Current metadata adds only the four explicitly identified tables. A field inventory generated solely from existing `ProjectBackupData` properties would **not discover an entirely new omitted table**; retain a full schema ownership census as well as DTO field tests. + +### Legacy package scope + +Legacy `PlotLineImportPackage` supports project description, ordered books/chapters/scenes, summaries/purpose/outcome/time text, POV/location/character appearances, aliases, location hierarchy, plot lines/threads/events, assets/states/events/custody and scene dependencies. It does not represent canonical manuscript source prose, full relationship graphs, maps, floor plans, metrics, continuity history or the full workflow/AI/review schema. Its unmatched-reference warnings and mapping defaults are intentional structured-outline semantics, not backup fidelity. Retain it under Advanced Data Tools; do not claim it is a current project backup schema. + +## 5. Round-trip and negative-test evidence + +### Reproducible commands actually run + +All use the unchanged existing executable test harness, not `dotnet test`. No full application rebuild was necessary for this documentation-only investigation; the current built harness was available. + +```bash +dotnet run --no-build --project PlotLine.Tests/PlotLine.Tests.csproj -- \ + --project-transfer-database --require-writing-plans PlotDirector_Phase2_20261103_2305 + +dotnet run --no-build --project PlotLine.Tests/PlotLine.Tests.csproj -- \ + --project-transfer-database --exports-only PlotDirector_Phase2_20261103_2305 + +dotnet run --no-build --project PlotLine.Tests/PlotLine.Tests.csproj -- \ + --project-transfer-database --legacy-import-only PlotDirector_Phase2_20261103_2305 + +dotnet run --no-build --project PlotLine.Tests/PlotLine.Tests.csproj -- --import-transport + +dotnet run --no-build --project PlotLine.Tests/PlotLine.Tests.csproj -- \ + --project-transfer-database --restore-omission-only PlotDirector_Phase2_20261103_2305 + +dotnet run --no-build --project PlotLine.Tests/PlotLine.Tests.csproj -- \ + --project-transfer-database --restore-field-omission-only PlotDirector_Phase2_20261103_2305 +``` + +The database modes read Development connection settings as data, verify the configured source catalog, **substitute the hard-coded synthetic catalog**, then verify database name/marker. They do not run the fixtures against `PlotDirector_Development` or apply migrations. Authenticated HTTP export fixtures use production controllers/services/filter and real SQL under isolated Kestrel with synthetic principals; the import HTTP transport fixture uses production MVC binding/controller metadata/antiforgery with an isolated test service. Import/restore semantics and stored-row comparisons run through the actual production services/repositories/SQL separately. This is strong layered evidence; it is **not** a claim of a single normal-browser upload/restore acceptance session with a real author's login. + +### Results + +| Check | Result / actual evidence | +|---|---| +| Export content vs source SQL | PASS:106 populated entities /2,599 stored field values compared. Independent row census:106 scoped entities /183 owned rows, shared vocabulary classified separately. | +| New-project backup import | PASS:103 populated persistent collections /2,467 remapped stored values compared. New owner/project/book/scene IDs and internal references checked; source/other-author boundaries retained. | +| Same-project saved-point restore | PASS:103 populated persistent collections /2,563 stored values compared; actual safety snapshot and restore paths exercised. | +| Manuscript / planning | Exact long Unicode/plain text, source prose, decimal chapter/scene numbers and ordering retained. Writing plan source=1/imported=1; goals, schedule dates/settings, checklist and references compared. | +| Maps / floors | Populated geometry, parent maps/features, feature connections, label/lock/placement metadata, reference image placement, room/floor/occupancy relationships compared, not just row counts. | +| Uploaded content | Actual HTTP project/point downloads each retained12 embedded files plus gallery metadata; source/restored capture compares file bytes and paths. Map images are included separately. | +| Malformed backup / unsafe graph | PASS:53 invalid JSON/map/data/version preview cases before project allocation. Cross-project graph/identity and malicious supplied restore-path metadata are checked by existing fixtures. | +| Failure atomicity | Full harness injected SQL failure and compared project counts: before415, after415 in the synthetic DB. Stored-value/source/file-preservation checks accompany same-project refusal/safety tests. No claim of power-loss/crash-consistency testing. | +| Active-work safeguards | PASS:active import/analysis/synthesis/enrichment/review/illustration cases refused; completed history/account consent/job state retained; no paid work restarted on copy. | +| Legacy import | PASS:30 malformed shapes rejected, number bounds, no-write dry run, long Unicode, independent order/number semantics, empty structures, aliases, hierarchy/custody, shared-state scope, dependencies, published sample, BOM decoding, ownership and SQL rollback. | +| HTTP reference exports | PASS:eight reference packet types ×five format/alias variants; ordering, long/empty/Unicode content, HTML encoding, owner/other/anonymous/missing boundaries. These reports are not backups. | +| HTTP import transport | PASS:all three POST actions carry5MiB text and Unicode unchanged; multipart upload/authentication/antiforgery checked. SQL semantics tested separately. This does not qualify maximum-size backups. | +| Omission / historical shape | Actual restore service refuses103 populated persistent collection omissions; required headers/camel-case/explicit empty/raw-absence handling and copy warnings exercised. PASS:1,353 independently SQL-derived stored-field omissions refused before mutation/allocation; missing book era left unchanged with no safety allocation; explicit-null complete restore accepted. | +| Actual upload JavaScript race | **REPRODUCED defect:** actual inline FileReader script, two controlled file reads; complete second read first, then first read. Textarea and carried hidden JSON end with first-file content while file input selects the second file. No import submitted, no DB writes. | + +Logs retained locally during this audit: `/tmp/backup-audit-roundtrip.log`, `-http.log`, `-legacy.log`, `-transport.log`, `-omissions.log`, `-fields.log`, `-upload-race.log`; SQL metadata/census under `/tmp/backup-audit-*`. Existing stable coverage CSVs remain under `Docs/Sprints/2026-11-03-phase2-*`; no source/test changes were made to generate this evidence. + +### What was not proved + +- No real historical author backup file was supplied. Synthetic older-format and missing-field cases do not prove arbitrary historical compatibility. +- No destructive restore against a real author's project, no deployed Development browser login/session acceptance, and no Production test. +- The synthetic schema is the guarded pre-native transfer fixture; it does not contain migrations231–235. Current live Development metadata/source demonstrate their omissions, but their populated copy/restore lifecycle was **not** exercised by that harness. Current Development counts for all four new tables were0. +- No maximum-size/190,000-word-plus-images restore, load/concurrent-writer stress, process-kill/power-loss test, or cross-instance shared-catalogue disaster recovery. +- File selection race uses the actual script in a controlled browser fixture; malformed uploads did not reach application mutation paths. + +## 6. Safety, reliability and compatibility findings + +### Existing safeguards to retain + +1. **SQL snapshot consistency:** `ProjectBackupRepository.GetProjectBackupAsync` uses a serializable transaction across `ProjectBackup_Export`, `StoryMap_Backup`, `ProjectBackup_PersistentState_List` and book-metadata selection. It does not combine independently timed SQL reads. File capture then reads referenced bytes and retries once with fresh SQL data if a referenced file disappears. SQL/files still are not an operating-system volume snapshot. +2. **Restore preflight:** format/version/project match, complete stored-field checks, graph/maps/file integrity and older-collection checks run before SQL replacement. A complete safety snapshot is required. Missing known collections with existing values abort; explicit empty arrays can deliberately remove data. Copying an incomplete older backup instead warns that absent information becomes empty/default. +3. **Database/file atomicity:** backup copy wraps project-shell allocation, identity allocation, graph remapping and SQL apply in an async serializable TransactionScope with a five-minute bound. The SQL apply procedure uses `XACT_ABORT ON`, a transaction, fixed restore table lists, graph/identity preflight and constraint rechecking. Same-project apply preserves project identities. New files are written to unique paths before SQL publishes their references; stage disposal removes those new files on failure, then a successful database commit retains them. Existing files are not overwritten. Old unused files/crash orphans need normal storage lifecycle management; a DB transaction cannot promise hardware-level file snapshot atomicity. +4. **Ownership:** HTTP filters enforce project/entity scope; direct backup download is owner-only. Import allocates a new importer-owned project; exported collaborator records are diagnostic and never recreate source access authority. SQL apply is a trusted internal procedure without a caller UserID: public route/service guards are essential. +5. **Cross-reference protection:** backup graph/map validators, typed embedded-evidence remappers, lookup resolution and SQL collision checks prevent ordinary cross-project IDs from being accepted as local. Original IDs are diagnostic, not portable identifiers. Rebinding copied Word manuscripts is explicit; original Word prose/documents are not changed. +6. **File validation:** v1.3 requires referenced upload bytes, SHA256 agreement, unique referenced file paths and owning-entity upload directories. Restoration discards attacker-supplied `RestoredPath`/owner metadata, derives safe owner folders and fresh filenames. Map image validation includes raster constraints. SHA256 checks integrity, not a signature proving a file came from a trusted author; general attachments are not a universal malware-sanitisation service. +7. **Older formats:**1.0/1.1/1.2/1.3 are recognised. Pre1.3 files lack upload-byte portability: copy warns/detaches unavailable upload paths; same-project restore requires the original referenced files still available. Missing required stored fields can make an old point safely unrestorable. Unsupported future versions fail rather than being treated as legacy outlines. + +### Prioritised risks and omissions + +| Finding | Classification / priority | Evidence and consequence | +|---|---|---| +| New author decisions outside snapshot | **Confirmed omission; P0 before full-recovery claims** | `WritingIntentAssessments.ResultsJson/DecisionsJson` and `NativeChapterReviews.DecisionsJson` have no backup representation. New-copy recovery loses them. In-place restore does not rewind them. Omission guards only inspect known DTO categories, so they cannot detect this absence. No populated live loss observed. | +| Native receipts survive rollback of canonical story data | **Source-confirmed lifecycle mismatch; P1**, runtime reproduction outstanding | SQL229 does not touch the native receipt/ledger tables. `NativeImportService.Commit` returns an existing operation receipt after verifying book access, without establishing that every imported chapter/scene still exists in the restored snapshot; preview also matches ledger content/version. Restoring a point from before an import can leave receipts claiming success for removed story rows. Position resolution does join canonical rows, so absent scenes should refuse navigation rather than create them. Requires an integrated restore/native-retry test before stronger claims. | +| Older file read wins over newer selection | **Browser-reproduced defect; P1** | Imports view FileReader callbacks have no generation/cancellation guard. Server intentionally prefers non-sample `JsonText` over uploaded bytes, making the stale textarea consequential. Fix before hiding technical data behind a simpler upload workflow. | +| Owner vs collaborator restore policy | **Confirmed policy inconsistency; P1 decision** | `Exports.ProjectBackup` is owner-only; `ProjectRestorePoints` download/create/delete/restore use ordinary project/entity access and are not in the owner-only action map. An authorised project collaborator can reach more snapshot authority than the direct owner-only backup route suggests. Unrelated-author denial passed; this is not a proven unauthorised cross-account bypass. Decide which collaborator roles may export/delete/replace a whole project and enforce consistently. | +| No standalone book recovery | **Confirmed capability limit; P1 UX** | Current APIs operate on projectId. Filtering out other books could break shared characters/maps/relationships/threads and provenance. Do not relabel the existing export “book backup”. | +| Upload/resource-size contract unclear | **Source-confirmed gap; P1 hardening** | Form value limit32MiB, Development Nginx100m, no Imports request-body override or business-level file-byte/object-count cap; service reads full text and multiple JSON/file representations into memory. Suspicious book/chapter/scene thresholds are warnings, not hard caps. Effective full proxy/server envelope and largest round-trip sizes need qualification. Current transport evidence is5MiB, not100MiB. | +| Duplicate restore-as-copy is not operation-idempotent | **Confirmed semantics; P1/P2** | Duplicate title requires explicit consent and adjusted name. A new-project import has no durable operation receipt. Retrying an already-approved duplicate import can create another project; it does not reconcile or overwrite the first. Preview/confirmation is safe but does not prove retry idempotence. | +| Historical compatibility | **Evidence gap; P1** | Current synthetic contracts are strong; real historic backup fixtures and cross-version acceptance are absent. Keep fail-closed replace behaviour. Version1.3 alone cannot signal the four newer omitted categories. | +| Entire restore-point history/shared catalogue excluded | **Deliberate boundary, needs clear disclosure** | Point snapshots do not recursively include restore points; project export does not replace administrator DB/files/Data Protection/illustration-catalogue recovery. Shared illustration references in copies become inactive history, not newly approved artwork. | +| Privacy of local backup | **Confirmed format property; P2 messaging** | Plain JSON/base64, not encrypted despite `.plotdirector` extension. Includes prose/research/raw AI audit and diagnostic collaborator names/emails/actor metadata. Store privately; backup is not credential/billing migration. | +| Synchronous UX and long SQL locks | **Confirmed implementation; P2 measurement** | Import/restore is request-bound without a dedicated per-restore progress/cancel job contract. SQL table constraint operations/serializable reads can block other users; timeouts are not meaningful progress. Do not add fake percentages or assume browser cancellation rolls back a completed transaction. | +| Recovery audit and limits | **Source-confirmed improvement opportunity; P2** | SQL restore history records `SUSER_SNAME()` rather than an explicit application actor; manual10-point limit does not cap automatic safety snapshots. Define traceability/retention/quota and recovery-above-current-plan policy. New-copy resource checks already exist; same-project restore does not use that subscription allocation path. | +| Legacy client encoding | **Source-confirmed integration caveat; P2** | Server StreamReader recognises BOM encodings (tested), but browser FileReader explicitly decodes UTF-8 and its textarea may take precedence. Do not infer full browser UTF-16 support from server-only BOM tests. | + +The new tables deliberately have no foreign keys, confirmed in live metadata. They therefore do not immediately block old SQL restore with FK errors; instead they remain outside its transactional scope, which is precisely why their stale/orphaned semantics need explicit handling. Do not fix this by blindly adding cascading FKs or replaying live session IDs. + +## 7. Smallest sensible author experience + +### Projects and menus + +- Replace the prominent **Import JSON** destination with a clear author choice: **Import a manuscript**, **Restore a project backup**, **Advanced Data Tools**. Reuse Onboarding/Book begin-mode paths for manuscript work, not the JSON importer. +- On project More/Actions, keep **Download project backup** and put **Restore a downloaded backup…** immediately beside it. Its preview must say **Creates a new project; current project unchanged**. Use the existing import service and result flow in a backup-focused presentation mode. +- Separately expose **Restore this project from a saved point…**, reusing `ProjectRestorePoints.Index` and its existing replacement/safety modal. Do not make file restore silently mean overwrite or make a project click determine the uploaded file's destination. +- Current book cards have no book backup engine. Keep backup at project level, or label a contextual link **Back up entire project (all books)**. A real book-only package is a later shared-subgraph/product decision, not a quick filter. +- Rename archive recovery **Unarchive** where necessary to avoid confusing it with replacement recovery. + +### Backup file and restore preview + +Keep `.plotdirector` and `application/json`; the custom extension already exists. It helps distinguish a backup from an arbitrary legacy outline, but is neither an encrypted format nor a new archive technology. Accept existing `.json` backups by content. No benefit justifies another extension migration now. + +Reuse current preview, warnings, duplicate checks, resource checks, dry-run, confirmation and result page. For a backup-focused page, initially show file upload and a compact source summary: project/title, all included books, source version/date, counts for prose/planning/maps/files, unavailable categories and compatibility warnings. Destination is **new project** with proposed name and copy/rebind implications. Hide raw JSON/schema/sample editing under Advanced rather than creating another parser. + +Give failure stage and safe next action without raw SQL in the normal screen. Preserve validation-report download and expandable technical details for support. Use a real busy state, suppress duplicate submits and bind confirmation to the validated content; if measured restores need background progress later, reuse the application's operation/progress conventions after defining retry/cancellation semantics. + +For same-project saved points, retain the existing Bootstrap modal that names the selected point and explains replacement plus safety backup. Add a contents/difference preview only through the same validation services; never weaken missing-category checks to make older points appear compatible. + +### Existing reusable components + +- Imports multipart upload, preview/counts/tree, warning/error sections, duplicate-title consent, dry run, validation-report export, result page and carried-JSON mechanism (after fixing the race). +- Restore-point create/download/list/delete and point-specific replacement/deletion modals. +- `site.js` / shared `plotlineConfirmModal`, `data-confirm-message`, button styling and PWA header conventions. +- Existing Onboarding and book creation start-mode controls; existing shared project Actions dropdowns. +- Existing Story Intelligence progress components are tied to their own jobs. Reuse their UX conventions, not their event contracts for a fictitious backup job. + +Help currently explains outline import and restore points but does not adequately connect downloaded v1.3 backup → new-project import, whole-project scope, file inclusion/older-file limits and recent omissions. Improve the current two articles plus existing getting-started/navigation links; no parallel Help system is needed. + +## 8. Prioritised implementation proposal (recommendations only) + +Scope estimates are approximate focused engineering days, including tests, not delivery commitments. `S`≈0.5–2 days, `M`≈2–5 days, `L` requires a separately agreed product/data contract. No work below was implemented by this audit. + +| ID / class | Priority / scope | Proposal / dependency | Risk and proposed acceptance tests | +|---|---|---|---| +| A1 Existing and working | Retain / S documentation | Keep project export, saved points, graph/remapping/file stage, safety backup, omission guards and shared lookup/account boundaries. Preserve the existing representative fixtures. | Low implementation risk; all current 103-collection, file, auth, rollback and omission tests continue passing. | +| A2 Existing and working | Retain / S | Keep legacy prepared-outline import, sample, dry run and diagnostics; keep report exports separate. | Renavigation must not break existing JSON1.0 users or turn reports into advertised backups. | +| C1 Data coverage | **P0 / M** | Define/export/restore author-owned native review and Intent decisions. Extend DTO/selectors/file-manifest capabilities, typed graph/actor/ID remapping and complete-shape checks in a **new forward-only migration**. Decide portable encrypted-capture handling before copying server-bound ciphertext. | Medium/high data risk. Seed all four recent tables; compare author decisions after new-owner copy and same-project restore, including snapshot-before/after decision changes. Never export auth grants, live commands or consent authority. Cover absence and older backups explicitly. | +| D1 Reliability | **P1 / M**, with C1 | Define native receipt/provenance invalidation or remapping on restore. Verify canonical rows before reporting an old import as complete. Expire live presence/navigation references as appropriate; copies must rebind Word. | High semantic risk if receipts blindly replayed. Restore a point predating native import, retry the same operation, then try preview/navigation: no false “already imported”, no duplicate prose, no arbitrary live-session routing. Preserve valid post-import receipts when restoration actually includes their canonical rows. | +| D2 Reliability / UI | **P1 / S** | Supersede/cancel obsolete FileReader reads; bind selected filename, decoded contents, preview and confirmation to the same generation. Keep explicit manual JSON edits authoritative only in advanced mode. | Low code risk, important correctness. Controlled A/B out-of-order callbacks, cancel, empty file, failed read, manual edit during read and reselect tests. Confirm UTF-8/BOM policy through actual browser + server path. | +| B1 UI / terminology | **P1 / S** | Clear Projects author entry points; adjacent project Download / Restore-file / Saved-points entries; move legacy JSON/sample/schema into Advanced presentation. Reuse current service/preview/result components. | Low/medium routing risk. Test with/without Word, empty/nonempty Projects, owner/collaborator, PWA/mobile; destination says new project or same-project replacement before any mutation. Existing importer routes remain compatible. | +| D3 Security | **P1 / S after product decision** | Align snapshot download/create/delete/replace permissions with explicit project roles and direct backup ownership. Consider passing application actor through restore service/procedure for defence-in-depth and audit. | Medium access-compatibility risk. Owner, intended editor, read-only/nonmember, archived project, cross-project point ID, anonymous and antiforgery tests at real HTTP/SQL boundaries; no silent privilege expansion. | +| D4 Reliability / size | **P1 / M** | Establish one explicit upload/export/decoded-file/object-count contract consistent across reverse proxy, request/body/form settings, UI and business validation. Measure peak memory and time. Preserve old valid files within supported limits. | Medium availability risk. Test0/5MiB, near/over each configured limit, base64-heavy backups, deep/huge arrays and malformed files; refuse before allocation with useful messages; exported supported backups must be restorable. Bound work before considering compression/streaming changes. | +| D5 Compatibility | **P1 / M**, with C1 | Add real historical backup fixtures with approved provenance, compatibility matrix and declared data categories/capabilities (possibly next version1.4). Keep fail-closed replacement; explicitly acknowledge partial-copy loss. Gate new schema tables with an ownership/disposition census. | Medium/high old-data risk. v1.0–1.3 real files, missing fields/categories, explicit empty/null, unsupported future versions, case variants, saved shared references and cross-version file bytes. Unknown categories must not silently disappear under a “complete” claim. | +| D6 Reliability | P1/P2 / M | Specify confirmation/retry idempotence for restore-as-copy and concurrent-edit handling for same-project replacement. Current safety export and apply are separate transactions; intervening collaborator changes are not guaranteed captured by the safety point. | Medium concurrency risk; not a failed test in this audit. Lost-response/double-submit tests, approved duplicate retry, two imports, edit between safety capture and apply, timeout/cancel. Preserve safety/SQL atomicity and reject stale confirmation rather than guessing. | +| B2 UI / Help | P2 / S | Display inclusion/exclusion/version/date/file information, privacy guidance, historical-file limits and recovery destination. Update existing Imports/RestorePoints Help. Make raw SQL details secondary. | Low risk. Ordinary author can recover a file without reading schema; cannot confuse an unarchive, report or Word chapter import with recovery. | +| D7 Operations | P2 / S–M | Clarify retained safety-point limits, storage accounting, old file/orphan cleanup and restore audit actor. Define recovery above current subscription limits; preserve existing new-copy entitlement checks. | Medium retention risk. Safety snapshot still succeeds safely; no automatic deletion of the only recovery point; completed restore remains recoverable after quota/status changes. | +| E1 Legacy | P2 / S | Retain legacy JSON import as Advanced Data Tools, schema/sample/report and compatibility docs; deprecate only after usage evidence and notice. No replacement engine required. | Low migration risk if routes/contracts retained. Published sample, aliases, legacy importer and technical diagnostics regressions pass. | +| C2 Book-only portability | Product decision / L | Only if genuinely required: specify project-shared dependency closure and destination semantics for a book package/import into an existing project. Do not implement by truncating the project backup's books list. | High graph risk; multi-book shared characters/maps/threads/locations/custody/scenario/evidence tests, conflict preview and no dangling references. Existing whole-project recovery remains default. | + +### Classification of data when closing gaps + +- **Canonical author data:** project/book/story structure, saved manuscript prose, authored plans/objectives/checklist completion, character/location/relationship/plot/map/floor data and deliberate author review decisions. These deserve explicit recovery semantics. +- **Derived/regenerable:** counts, AI observations and some continuity/analysis output. Existing backups intentionally retain much of this history. Regenerating AI observations cannot reconstruct an author's dismiss/defer/approve choices or paid historical evidence exactly. +- **Temporary/operational:** current presence, IPC/session IDs, pending requests, credentials/grants, job execution state and consent authority. Do not resume or recreate these by copying JSON. Keep useful provenance as inactive history only where its contract is defined. +- **Shared/account/administrator data:** accounts/billing, vocabulary authorities, shared catalogue/artwork and global solver configuration require separate administrative recovery. Diagnostic references in an author file do not convey permission to recreate those records. + +## 9. Specific components likely to change in a subsequent implementation + +**UI only:** `Views/Projects/Index.cshtml`, `Details.cshtml`; existing book action partials only if labels/navigation need adjustment; `Views/Imports/Index.cshtml`, `Result.cshtml`, `ImportViewModels.cs`; `Views/ProjectRestorePoints/Index.cshtml`; existing shared confirmation conventions; Help Imports/RestorePoints and existing onboarding links. A backup-focused mode may be introduced through the existing Imports controller/view model, with the service unchanged initially. Fix the existing FileReader/carried-content lifecycle rather than adding another uploader. + +**Coverage and contracts:** `Models/ProjectBackupModels.cs`, `Data/ProjectBackupRepository.cs`, `ProjectBackupCollectionPresence`, `ProjectBackupStoredFieldContract`, graph/map/typed provenance validators and `ImportService.RemapProjectBackupForImport` / identity-table catalogue; add only the next appropriate forward migration for export/list/apply procedures and recent-table handling. Do not edit numbered SQL213–235 in place. + +**Lifecycle/security:** `ProjectRestoreService`, `ProjectRestorePointService` / repositories, `ProjectAccessFilter` / access procedures, native import receipt/catalogue checks and Intent assessment persistence. Introduce explicit application actor/permission/context where needed. Do not move auth/network/backup work into Word or duplicate the manuscript import engine. + +**Acceptance harness:** extend current `ProjectTransferDatabaseTests`, independent row/schema census, value/field omission tests, real HTTP export/import transport tests and browser fixtures. The existing all-table census must learn the new tables; merely increasing a count in the DTO test would hide the problem. + +## 10. Product decisions and outstanding evidence + +1. Is author-facing “Restore from backup” initially **new-project only** (recommended safe default), or must uploaded files also replace an existing project? The latter does not currently exist and requires a separate explicit contract. +2. Is whole-project backup sufficient, or is a true book-only portable subgraph required? Where should shared cross-book entities live after such an import? +3. Which collaborator roles may download snapshots, create/delete points or replace the entire project? Current routes do not consistently share the direct-export owner policy. +4. Should temporary native review captures be included by default, opt-in, or clearly excluded with a warning? How are author decisions and portable prose retained without exporting server-bound encryption keys or auth authority? +5. On same-project restore, should native receipts/positions and Intent assessments be rewound, invalidated, or retained as labelled out-of-snapshot history? Author decisions need a deliberate policy, not incidental leftover rows. +6. Which old real backups must remain recoverable, and may partial **new copies** use defaults after explicit warning while in-place restore remains strict? No historical author file was available to settle that acceptance question. +7. What supported backup-size, maximum time and storage-retention envelope should an author be able to rely on? Include embedded assets and schema growth, not just prose size. +8. Should approved duplicate file imports be one-shot/retry-idempotent, or intentionally create a distinct new project each time? UI feedback must match that choice. +9. What administrator-managed full DB/files/keys/shared-illustration recovery process accompanies project downloads? It is outside this author-file mechanism and was not tested here. + +**Recommendation:** proceed with targeted reliability/coverage corrections and navigation changes, preserving the tested engines. The existing system supports meaningful, tested whole-project portability; it should not yet be described as complete recovery for the newly added native review/receipt and Intent decision state. No implementation or deployment was performed in this task. + +### Audit evidence appendix: current live metadata + +Read-only Development procedure-definition SHA256 values captured during the audit (not assertions about a later deployment): + +| Procedure | SHA256 of live SQL definition | +|---|---| +| `ProjectBackup_Export` | `70B72DC6FEFCAB128D1DF7F04AD2AF35E87C8943218B302C49CD6CA04EC3F7E1` | +| `ProjectBackup_PersistentState_List` | `AFDA6CF8D6A68E6B4108383597E7D3C9DB7A559F1A0C407AB1AB897F060E11B9` | +| `ProjectRestore_ApplyFromJson` | `8ED55C829D44D1E933ECB571F3A2628CB993127563AA75DBAD64196F5FAE18F1` | +| `StoryMap_Backup` | `91BD73AB177E8058CACF2A879E57F133486E1FBFA0029902CF31248BB5258549` | + +Current persistent selector and restore definitions include illustration-history additions from229 and contain no native receipt/Intent assessment table handling. All four recent tables exist with no foreign keys; aggregate counts were0 each. Table names/counters/procedure definitions were inspected, not author prose or credentials. The synthetic SQL backup passed VERIFYONLY; a physical SQL database restore was not part of this project-JSON round-trip test. + +Internal JSON API transport, Maps bootstrap JSON and AI result bodies are not treated as additional downloadable project backup formats. The file portability endpoints and separate Development diagnostic export are catalogued above.