91 KiB
Phase 2 improvement programme — 3 November 2026
Baseline
- Repository: /srv/repos/PlotDirector.
- Starting branch: codex/overnight-improvements-20261103.
- Starting commit: 06f2bf78219e6fd01ec6098019af4e24630ef6ee; worktree clean.
- Isolated branch: codex/phase2-development-20261103.
- Development service active; deployed DLL matches archived
1930007release with SHA-256 5a86109eb96338fc3ec77f416410e1efe33600d4a22cf761a10b30dd513f8689. - Reviewed Phase 1 report and build/browser/deployment guides. Prior improvements are the baseline. Phase 2 explicitly supersedes the Locations segmented-button presentation.
- No authenticated live browser session established. Real Razor fixtures and production scripts will be identified as fixture verification.
Durable queue
- COMPLETE: Writer recovery, distinct window identities, book-scoped focus/presence, repeated browser/PWA navigation and unsaved chapter-goal protection (
81833c6,408ea95,735a7d8,597915f). - COMPLETE: Writer/shared surface spacing, requested icon changes, Locations conventional commands/grips, mobile Chapter table repair and rendered coverage inventory (
9d78a63,016b58f,869e305). - DEFERRED ACCEPTANCE: authenticated live Writer/PWA testing; no session is available. Real full-layout browser/Hub fixture results are recorded separately.
- DEPLOYED: user explicitly accepted Development restart despite the two illustration records marked Generating. All other background-work gates passed; release 0928c20-20261104115934 started successfully on 4 November at 12:01:41 UTC.
- COMPLETE CHECKPOINT: serialized backup/restore coverage now has 107 collections (103 persistent plus 4 diagnostic/shared vocabulary), 108 SQL entities / 1,388 columns with no missing non-computed model properties. All 103 persistent collections have populated stored-value copy/in-place comparisons; 12 uploaded files and embedded map image bytes are verified. Commits
f12ad43,dbb2e2d,6ae3715,571f670,28397ff. - COMPLETE CHECKPOINT: project illustration history, independent row census, real image/HTTP failure handling, consistent SQL reads and actual service collection/field-presence protection passed. Narrative synthesis and enrichment evidence now pass. Operational account reference preservation now passes. HTTP JSON transport repair, 40 packet/format cases, legacy JSON, Word structure API and Core Import SQL/source/provenance workflows passed. Retained SI analysis audit now passes isolated stored-value copy/in-place tests.
- CLASSIFIED: all 167 schema tables now have an explicit disposition. Shared administrator-managed illustration catalogue/approval/archive/usage state and library files are excluded dependencies, with diagnostics and copy warnings; project source provenance in that shared catalogue is not portable project-owned artwork. No standalone shared-catalogue recovery claim. No real historical backup fixture found; synthetic legacy-shaped cases do not establish historical compatibility.
- COMPLETE LOCAL CHECKPOINT: all identified independently safe repairs are committed and verified. Current source exports full stored projections; 103 collection omissions and 1,353 stored-field omissions are refused without inferred destructive defaults. Historical file completeness cannot be established without actual fixtures.
- DEPLOYED: verified Development SQL backup, migrations 213–229, exact final seven procedure definitions, fresh Release publish and installed/published DLL SHA match. Local/public/login GETs passed. Authenticated live Writer/PWA acceptance remains unavailable; fixture verification is not live acceptance.
Execution record
- Baseline established. Next: add Writer real-Razor fixture and reproduce symptoms with production shell scripts; no cosmetic Writer changes yet.
Coverage and evidence
Coverage inventories will record tested pages, entities and formats explicitly. Representative cases will not be labelled exhaustive.
Deployment
Phase 2 deployed to Development on 4 November 2026 at 12:01:41 UTC, release 0928c20-20261104115934. Migrations 213–229 applied after a verified unique Development backup. Production excluded. Earlier non-deployment checkpoints below are historical; see the final deployment record for current state.
Writer investigation checkpoint
- Added a full-layout Writer fixture, including the real Razor layout, shell, help drawer, production scripts and real SignalR SDK. The fixture now hosts the production WordCompanionFollowHub and its production in-memory Word/Writer presence services; no database connection or app workers are used.
- Basic section selection remained responsive in browser/PWA with both the original compact fixture and full layout. No invisible blocking overlay or immediate generic shell mutation loop was reproduced in these cases. The reported whole-page lock still needs live acceptance evidence; do not claim that exact symptom independently reproduced.
- Confirmed failure reproduced: fail only the first real SignalR negotiation with HTTP 503, restore the endpoint, then click Start/Reapply. Before repair, no second negotiation occurs because connectionPromise permanently retains the initial rejection. Initial registration also silently leaves status placeholders Checking.
- Applied local repair: clear failed/terminal connection promises so user commands can reconnect; re-register the launcher when retrying Start; report initial registration failure; accurately handle blocked popup/focus results and release command disabled states in finally blocks.
- Initial real-Hub recovery regression passed in browser/PWA. Expanded tests now cover actual Context/Intent Razor windows, terminal reconnect, popup denial feedback and repeated Writer→Locations→Writer navigation. Expanding the fixture surfaced and corrected test-only endpoint ambiguity; production routing was untouched.
- Added exact-version SignalR 8.0.7 browser-test dependency to match the production SDK, avoiding a temporary-file test dependency.
- Current build/test evidence: baseline and intermediate solution builds passed with zero warnings/errors; expanded Writer test verification is ongoing. No Phase 2 code committed or deployed yet.
Writer recovery and presence repair — verified
Confirmed and repaired two independent defects using the full Razor layout, real SignalR 8.0.7 SDK, production Hub and production in-memory presence services:
- Initial negotiation failure permanently cached a rejected promise; later commands never retried. Terminal disconnects also retained a disconnected connection. Failed/closed connections now release the cached promise and Start re-registers the launcher before reapplying the workspace. Unavailable presence is labelled explicitly instead of remaining Checking.
- Browser-created pop-ups cloned the launcher's sessionStorage ID. The failing test observed one unique ID across Launcher/Context/Intent instead of three, and the windows overwrote one another's role/focus presence. IDs now belong to the named window (with opener-clone detection), remain stable across reloads, and remain stable within a document if storage is unavailable.
Also corrected false success feedback when a popup is blocked and protected role-command disabled states with finally/error handling. A valid server-side focus request still succeeds when an existing role window is available.
Verification: solution build passed (0 warnings/errors); full executable harness passed (405 checks); full-layout Writer browser/PWA regression passed. It exercises one failed real negotiation followed by recovery, terminal stop/reconnect, actual Context and Intent Razor windows, three distinct IDs, reload stability, focus reuse, popup denial feedback, three leave/return cycles per mode, project Focus submission, Writing Plans/Schedule Setup/Schedule Preview real controller/view routes, and unsupported display-detection fallback. No whole-page blocking overlay was observed in these fixtures. Live authenticated PWA acceptance remains unperformed.
Next functional item: chapter-goal editing has no beforeunload/navigation guard. Probe confirmed that leaving Writer is not intercepted after typing. Browser back-cache may retain the draft temporarily; it is not a save or a reliable protection against closing/reloading the page. Add save/discard/cancel protection using the established application dialog and explicit save acknowledgement before visual work.
Writer chapter-goal unsaved protection — browser verified, broader gate running
Probe established that editing chapter goals did not register a navigation/unload guard. Leaving the page proceeded without save/discard/cancel; browser back-cache could temporarily retain the form but did not persist it. Added an explicit opt-in form guard to this editable Writer workflow using the established PlotDirector application dialog. Native browser unload protection remains; if dialog assets are unavailable the browser unload guard supplies the fallback instead of trapping navigation.
Save and leave requires explicit successful JSON acknowledgement from the existing authorised/antiforgery-protected Writer action. Ordinary non-AJAX saves retain their redirect. Failed/redirected/malformed responses retain the draft; newer edits are not cleared by an older acknowledgement. Discard restores the last acknowledged field values; Keep editing preserves them. The guard resets its navigation permission on pageshow so browser back-cache cannot silently disable future protection.
Verification: build passed (0 warnings/errors). Real-layout browser/PWA tests passed for cancelled navigation, explicit discard, normal Save, Save and leave, failed Save/retry, Unicode payload comparison across actual controller/antiforgery and isolated in-memory service boundary, and unload-guard state. The Writer recovery/identity/re-entry test passed again. These are fixture/in-process Hub checks, not live authenticated Development or SQL round trips. Broader harness running.
The exact reported whole-page PWA navigation lock has not been reproduced separately in the available full-layout fixture. Live authenticated acceptance is deferred because no user session is available; no claim that a blocking overlay was found or removed. Connection recovery and opener-ID collision were independently reproduced and repaired. Proceed with independently verifiable programme work after this checkpoint.
Chapter-goal guard verification complete
- Build: passed, zero warnings/errors. Full harness: 405 PASS, exit 0.
- Writer recovery/full-window/repeated-navigation suite: passed again.
- Chapter-goal browser/PWA suite: passed, including a held older save request followed by newer edits. An older acknowledgement leaves the newer draft guarded until its own successful save.
- Existing authorised save action retains its normal redirect for non-AJAX callers; the new JSON acknowledgement follows the awaited service save. Verified the repository saves goals by ChapterID, so repeated AJAX saves do not depend on a refreshed generated goal ID.
- Read-only Development restart gate verified database identity and found no active background work. Preparing an early verified Writer deployment before the longer visual/data-transfer audits; the gate will be checked again immediately before restart.
Guard interaction check — in-page Help
Before deployment, an added real PWA test reproduced an unnecessary save dialog when the ribbon Help link opened its in-page drawer. The opt-in guard now excludes declared Help/Bootstrap in-page actions; links leaving the page and browser unload remain protected. Extended chapter-goal suite passed in browser/PWA, including Help opening without a save prompt and unchanged draft text. This small static-script correction follows the passing 405-check broader gate; it is not deployed yet.
Writer book-scope repair — reproduced and verified
The expanded real-Hub test reproduced two additional failures before repair:
- After selecting a second book, Open Context reused the first book's window: three total pages remained instead of opening the fourth, correctly scoped Context page. Client window references were keyed only by role. References now use the existing stable role/book window name.
- A real heartbeat from the first book changed the launcher's selected book from 13 back to 12. User-wide presence broadcasts were unconditionally adopted as local scope. Other-book/project updates now leave the selected scope and role state intact, while still updating user-level Word connectivity. Canonical story-position changes continue to select the intended scope explicitly.
Verification: build passed (0 warnings/errors); full-layout Writer browser/PWA test passed with real heartbeat injection, second-book window creation, first-book preservation, restoration to the first scope, reconnect, identity/reload/focus tests and repeated navigation/header commands. Chapter-goal suite, including Help and concurrent edits, passed again. Fixture book data now honours the requested scope; no production routing or database schema changes.
Urgent Writer release is still pending this final broader gate; an earlier publish was superseded before installation. Next: publish committed verified fixes, run the idle-work gate immediately before Development restart, smoke-check, then continue the rendered visual inventory.
Restart safety checkpoint and visual work
Final Writer checkpoint: full harness passed again (405 checks, exit 0); both Writer browser/PWA suites passed. Phase 2 remains undeployed. Expanded read-only restart inspection found two illustration records marked Generating. The tracked restart gate now includes illustration and unfinished core-import work, verifies Development database identity, and refuses restart while these exist. Its controlled exit 2 was verified; no service restart or database mutation occurred. Live authenticated Writer acceptance remains deferred. Proceeding to Writer spacing and systematic rendered visual coverage independently.
Rendered visual and Locations checkpoint
- Added opt-in full-layout fixture rendering for the existing synthetic page catalog; actual Razor
_ViewStart, layout and page scripts render once. Added a repeatable screenshot capture script and explicit page inventory. - Writer before/after captures cover browser/PWA, 1440/390 widths and four requested themes (16 cases each). Inspected all after captures in contact sheets plus full-size desktop/mobile examples. Repaired missing shared story-section padding (14px, matching queue cards), compact Writer heading hierarchy, 16px major-section gaps and stretched mobile count badges.
- Initial wider inventory captured 240 cases with no script errors/document overflow. Visual inspection found touching Book metadata/chapter panels and Floor Plans create/empty panels, and initially appeared to show low-contrast dark-theme secondary buttons. Settled-theme verification disproved the latter: capture occurred mid-transition. Removed the unnecessary colour override and added a 350ms post-theme settle plus disabled screenshot animations. Shared direct-sibling surface gaps repair the confirmed touching surfaces. Continuous maps/graphs/calendar/table surfaces retain their intentional flush structure.
- Initial inventory's
page=timelinewas discovered visually to render the calendar in full-layout mode; it is excluded as Timeline evidence. Final inventory uses the actualpage=timeline-renderview and adds Chapter Details and Floor Plan Editor. Final captures/inspection remain in progress; no claim that capture alone constitutes visual acceptance. - Maps now has a folded-map shared navigation command, distinct from the Floor Plans blueprint, and is available in quick-access customisation without changing defaults. Locations uses separate icon+label choices with a recessed active state and original mutually exclusive/persisted handlers. Tree rows have a right-edge grip using the established
⠿convention; dragging starts at the handle while Edit remains the accessible parent-change alternative. - Verification so far: solution builds passed with zero warnings/errors; full harness passed again (405 checks); Writer recovery/navigation and chapter-goal browser/PWA suites passed after spacing changes; real-layout Locations controls/native handle/confirmation/relationship tests passed in four themes and both modes; assignment/AJAX/validation/scroll tests passed with handle initiation; nine-record workspace suite passed. Final visual acceptance and quick-access icon check remain pending.
- Read-only current database metadata inventory obtained: 167 tables, 54 with ProjectID, 113 reachable by foreign keys from Projects. This is the start of the data-transfer audit, not coverage proof. No Development data was changed. Preparing a schema-only isolated test environment; E/F inventories and semantic round trips remain pending.
Wider visual follow-up: readable Chapter Details tables
Final settled-theme capture covers 18 named pages / 288 cases with no script errors or document overflow. Inspection of the newly added Chapter Details page exposed a real mobile PWA failure: inherited overflow-wrap:anywhere from record forms split scene-table headers and content into individual letters. Responsive record-table containers now restore normal word wrapping and horizontal scrolling. Verified the actual PWA screenshot: a compact row, 804px internal table scroll width contained within a 316px container and a 390px document. New browser regression passed at 390/800/1440 in both modes and four themes. Updated Chapter screenshots are being captured; the original affected cases remain evidence of the defect. Maps/Floor Plans quick-access customisation/routes/distinct SVG checks passed in the broader toolbar browser suite.
Schema-only test environment now created successfully using the Development SQL container's administrative connection, after the application's limited login correctly refused database creation. The helper refuses existing targets, permits only a uniquely named synthetic database, copies no table data, excludes database users/permissions, and grants the existing Development application login access only within the synthetic database. Verified 167 tables / zero projects / zero users at creation. All further test writes target PlotDirector_Phase2_20261103_2305, never the running Development database. The synthetic round-trip harness remains under development; no data-transfer completeness claims yet.
Visual acceptance checkpoint and first SQL round-trip findings
Maximised Maps, Floor Plan Editor and Relationships: 48 cases captured and inspected, with no script errors/document overflow. Settled normal inventory: 18 pages / 288 cases; coverage and limitations are recorded in 2026-11-03-phase2-visual-coverage.md. Updated Chapter table captures and Locations selected-button foreground captures supplement superseded cases. The actual selected Locations page button retained white primary text against its new pale recessed surface; explicitly using the theme foreground repairs that confirmed contrast issue. Full-layout controls/native drag/selection suite passed again in both modes and four themes.
Isolated SQL round trip reproduced silent map loss: import returned success, but no map appeared in the new project. Added map identity/project/hierarchy remapping, map feature/relationship/journey reference remapping and new GUIDs for copied embedded images/placement references. Verified parent/child maps, geometry JSON, Unicode labels, relationship distance/map references, exact image bytes, changed asset IDs, placement reference and original-project preservation. Eleven invalid JSON/data/map/version preview cases fail before project allocation. Book era and primary locale were also lost; new forward-only migration 213 and metadata projection repair them, verified only in the synthetic database so far. Persistent writing-plan fixture confirms a separate omission (one source plan / zero imported); repair pending.
Further reproduced failure atomicity defect: an invalid scene→chapter reference failed SQL restore, but project count increased from 13 to 14, leaving the earlier-created empty shell despite the message saying no data was saved. A transaction around shell creation/remapping/apply is now under isolated verification. No current Development schema/data changes or Phase 2 deployment have occurred.
Import atomicity and graph validation checkpoint
Reproduced the failed-import shell leak before repair (project count 13→14). An ambient asynchronous transaction now covers shell creation, identity/remapping reads, SQL apply and diagnostics. Isolated verification passed with a real SQL uniqueness failure after allocation: project count remains unchanged, and a subsequent valid import succeeds. Added explicit graph validation for 55 serialized collections / 135 declared persisted and application references, rejecting missing/foreign targets before allocation; these declarations are not a claim that all 55 entity sets have completed semantic round trips. Null collections/records and scalar/array JSON are rejected cleanly. Initial map/asset/hierarchy/book-context comparison and 12 malformed preview cases passed. Broad harness is running. Writing-plan omission remains an explicit separate failing coverage gate; manuscript source text and SI review/audit omissions are now recorded in the schema inventory for subsequent work.
4 November: retained source/state extension — initial SQL verification passed
New format 1.2 adds eleven previously omitted persistent sets: document provenance, scene manuscript text/paragraph coordinates, structural chapter text/parsing context, writing plans and scheduled tasks, character/asset/location aliases, author plot seeds, warning acknowledgements and additional plot-event target links. Migration 214 extends the established export/restore procedures; existing numbered migrations remain untouched. New Chapter/Scene projections also include their stored Word-link fields, which the richer fixture demonstrated were previously omitted.
Import-as-new compares exact Unicode source text, paragraph positions, structural JSON and narrator context; schedule settings/date/notes and remapped project/book/scene references; alias values; matched author seed; warning acknowledgement and its scene/character/asset references; additional event targets; map hierarchy/geometry/relationships and exact embedded image bytes. A copied Word binding receives a fresh document GUID and inactive/unlinked state, with an import preview warning requiring explicit acknowledgement; it cannot drive the original document. In-place restore preserves the original document GUID/active binding. References to unexported original analysis runs are detached on copies; SI persistence coverage is still pending.
The actual ProjectExportService → restore-point repository/service → ProjectRestoreService path passed in the isolated database (activity logging is stubbed; identity/entitlement service boundaries are fixtures, while SQL subscription triggers and all export/restore SQL are real). A changed source text, plan name and alias restore to their original values with a safety backup. A deliberately duplicated image content causes a real SQL failure, retains the safety backup, and leaves every serialized Data field unchanged. A restore point cannot cross projects. Empty-project rollback and malformed preview checks still pass.
Evidence: build zero warnings/errors; /tmp/plotdirector-phase2-source-restore-workflow.log passed. Broader harness running. 66 sets are now serialized and 162 graph relationships declared, but not all 66 sets have been populated/compared yet. Full field coverage, remaining SI/review state, associated file assets, historical fixtures, and import/export format verification remain work in progress. No running Development data/schema changes or deployment.
Stored field census and author isolation checkpoint
Compared all 67 serialized entities (66 collections plus project) with the isolated schema: 818 SQL columns. The initial census found 76 non-computed fields absent from serialized models, largely stored audit actors/timestamps, plus relationship review source keys, scenario archive details and map modification time. Models and export projections now retain them. Import-as-new rebinds audit actors to the importing author while retaining stored timestamps; in-place restore keeps saved actors. The field CSV now records zero missing non-computed model properties. This is a model/projection inventory, not proof that every field or entity has completed a populated round trip.
Expanded real-SQL verification passed for retained relationship review keys, archived scenario date/reason and audit actor/timestamp behavior. A second synthetic author cannot access the source project, scene or backup; imported ownership belongs exclusively to that author, and the original owner cannot access the copy. Original Word bindings remain active and copied bindings require reconnection. The actual restore workflow, safety backups and real SQL constraint-failure rollback passed again. A synthetic RelationshipTypes default pointed to an absent lookup category in the schema-only database; corrected the fixture vocabulary rather than claiming a product repair.
Verification: solution build 0 warnings/errors; 405 regression checks passed (exit 0); isolated specialist /tmp/plotdirector-phase2-transfer-stored-metadata.log passed. Only the synthetic database received migration 214. Remaining all-entity semantic comparison, SI/review persistence, file assets and other import/export workflows remain pending. Development is still unchanged and undeployed.
Populated serialized-data matrix and further defects
The synthetic project now populates all 62 serialized persistent collections restored by the current implementation, including floor plans/rooms/transitions, asset states/dependencies/custody, character knowledge/attributes/appearances, custom metrics and separate timeline display settings, warnings, scene workflow/checklists/notes/link attachments, chapter goals, scenario order/validation/warnings and map journeys. The other four collections are shared genre vocabulary or diagnostic access/file accounting; their exclusion from portable restoration comparisons is explicit. 2026-11-03-phase2-roundtrip-coverage.csv records row counts and scope per collection.
Real SQL → backup projection comparison checks 970 stored values across 65 populated entities (including project and diagnostic rows). Copy comparison checks 931 stored values across all 62 persistent collections, normalizing new identities, references, importing actors, intentionally detached Word/analysis bindings and concurrency revision. In-place restore checks 934 stored values across the same 62 collections. Timeline JSON and map image placements receive separate reference/unknown-property comparisons. Nullable fields are compared as stored, not claimed to have every possible non-null value exercised. These results cover serialized data only: 48 additional FK/project-related tables and external uploaded file bytes still need separate classification/repair.
Confirmed further export omissions: appearance detection provenance, character knowledge review key, character avatar/sex metadata, location detection settings, plot-event provenance and map modification timestamp. Custom metric SortOrder was replaced by project display order in export. Forward-only migration 215 repairs these projections. In-place restore validation also rewrote map appearance/reference JSON, changing saved settings and removing unknown properties; shared validation now leaves the validated original JSON intact.
Confirmed copied Timeline presets retained original focus/filter entity IDs. Copy now remaps their explicit and embedded references while preserving unrecognised filter properties; invalid/missing references fail preview before allocation. Expanded malformed preview matrix: 15 cases. Persisted event source keys, once correctly exported, exposed their global uniqueness constraint: importing a copy collided with the original event. Copies now receive project/event-specific source identities and detach original analysis references, with an explicit preview warning. In-place restore retains original provenance keys. No claim is made that unexported SI review history has been restored.
Verification: latest isolated run /tmp/plotdirector-phase2-transfer-planning.log passed, including actual safety backups, constraint-failure rollback and cross-author boundaries. Build zero warnings/errors. Broader harness running before commit. Migration 215, like 213/214, has only been applied to the synthetic database; Development remains unchanged.
Explicit Word scene associations
Populating WordCompanionSceneAssets and WordCompanionSceneLocations reproduced a failed in-place restore before repair, while copied projects silently omitted these explicit selections. These tables are distinct from asset placement/location tables. Forward-only migration 216 and additive version-1.2 collections now export them, validate their graph references, remap copied identities/targets and restore them before constraint revalidation.
The isolated SQL matrix now passes 64 populated persistent collections: 980 source SQL values across 67 entities including diagnostic/root rows; 941 copy values; 944 in-place restore values. Safety backups, real constraint rollback and author boundaries passed again. Build zero warnings/errors. Evidence: /tmp/plotdirector-phase2-transfer-companion-before.log (failure), /tmp/plotdirector-phase2-transfer-companion.log (pass). The preceding 405-check harness passed at commit 6ae3715. Next: associated uploaded-file bytes and gallery records; remaining SI/review persistence and other import/export workflows. No Development writes or deployment.
Current work: portable uploaded assets (uncommitted)
Implementing explicit format 1.3 uploaded-file bytes/checksums plus CharacterImages gallery metadata. New migration 217 extends the existing stored-procedure path, restores gallery rows and rebuilds uploaded-file accounting. Export refuses missing active files. Copy/restore stage fresh filenames in the destination entity folders before SQL publishes references, retain original files, and clean staged files on SQL failure; copied historical path-only backups explicitly detach uploads with a warning. Older in-place restore points cannot erase an existing gallery they never contained.
Synthetic upload storage is exclusively /srv/repos/plotdirector-phase2-artifacts/synthetic-uploads/<random-run>/; no author files are read. Fixture includes 12 files across character/gallery/avatar, asset images, book covers, floor background, long Unicode and empty attachments. Build is currently clean. First SQL run reached a successful import; its generic expected-ID comparison needed the explicit non-FK avatar→gallery mapping. Expanded run /tmp/plotdirector-phase2-transfer-files.log is underway, including checksum/path validation, exact byte comparison, storage ledger owner/byte counts, quota refusal before allocation, cleanup after import/restore SQL failures, independent deletion and missing-file export rejection. These uncommitted changes are not yet a verified checkpoint. Running Development remains unchanged.
Uploaded-file and gallery round-trip checkpoint
The expanded isolated run passed: 1,013 stored source SQL values across 68 populated entities; 974 copied and 977 in-place values across all 65 serialized persistent collections. Twelve active uploaded files retain exact bytes across primary/gallery/avatar images, asset images, two book cover sizes, floor-plan background, long Unicode attachment and empty attachment. Fresh paths are used for both copies and in-place restores. Deleted gallery rows retain caption, timestamps, deletion state and original path metadata without requiring absent deleted files. Avatar→gallery identity remapping is verified explicitly; that link has no database FK.
Twenty malformed previews fail before allocation, including missing file records, invalid checksums and foreign paths. File accounting restores twelve entries with exact aggregate byte count, exclusively owned by the importing author. Supplied destination paths/entity metadata are ignored and regenerated. Storage quota refusal happens before project allocation or file staging. Real SQL import/restore failures leave the physical file set unchanged and retain the original database state. Deleting a copied avatar preserves the original author's file. Missing active file bytes make export fail, and inability to create a complete safety backup aborts restore cleanly without an unhandled exception or project changes.
Evidence: /tmp/plotdirector-phase2-transfer-files.log passed; solution build zero warnings/errors. Broader harness is running before commit. Full authenticated browser transfer of large embedded backups is not yet tested; Import/Export workflow/format verification remains next. Remaining unrepresented SI/review/provenance data and project-derived illustration-library files are explicitly outside this checkpoint. No running Development schema/data writes or deployment.
The asset checkpoint's full regression harness passed: 405 checks, exit 0 (/tmp/plotdirector-phase2-tests-files.log). Latest expanded SQL run also verifies complete safety-backup refusal when active file bytes are missing. Source-field inventory regenerated for gallery metadata. A separate HTTP transport fixture is now under development; its results are not included in this checkpoint.
HTTP import carry-forward limit
A real isolated MVC host reproduced HTTP 400 for 5 MiB JSON carried as a form value on Preview, Import and ValidationReport. Small values and a 5 MiB multipart file succeeded; the default per-value form parser limit was the blocker after upload/preview. ImportsController now allows 32 MiB per form value, leaving existing request-body/upstream limits unchanged. This is not a claim that arbitrary-size backups can pass the deployed reverse proxy.
After repair, all three production POST actions bind the complete 5 MiB payload and Unicode suffix with matching SHA-256; multipart bytes also match. Missing antiforgery tokens return 400 and anonymous requests return 401. The fixture exercises production controller metadata/model binding with an action filter that reports bound data; service/SQL behavior is covered separately, and no live authenticated acceptance is implied. Evidence: /tmp/plotdirector-phase2-import-transport-before.log (three failures), /tmp/plotdirector-phase2-import-transport-after.log (pass). Build zero warnings/errors; preceding asset checkpoint's 405-check harness passed. No Development changes.
Reference/brief export HTTP and SQL matrix
All eight document workflows passed HTML, Markdown, text and the md/txt aliases (40 combinations): Story Bible, Narrative Timeline, Character Reference, Scene Brief, Chapter Brief, Writing Session Brief, Research Pack and Search Results. The fixture uses real repositories/stored procedures, rendering service, controllers, CurrentUserService and ProjectAccessFilter against the isolated database. Only activity logging and the loopback synthetic identity boundary are fixtures; no application workers run. Another author and anonymous caller are rejected, missing positive IDs return 404, and foreign-project search content is excluded.
Verified supported content, Unicode/punctuation, book subtitles, scene ordering/empty scene presence, 5,000 retained research lines, HTML encoding of literal script markup, content types/download names and exact alias equivalence. Full project and saved restore-point HTTP downloads retain all twelve uploaded files and gallery metadata. These are reference/brief exports; they are not manuscript prose or full-project round-trip formats. 2026-11-03-phase2-export-coverage.csv records the workflow/format matrix.
Confirmed defect: all eight actions returned a successful empty document when an ID was missing/zero. Controllers now reject invalid context with a clear 400 response; normal ownership checks remain intact. The initial Search test also expected a notebook whose name did not match the query; corrected that test expectation, not product search behavior.
Evidence: /tmp/plotdirector-phase2-exports-before.log (invalid-context failures), /tmp/plotdirector-phase2-exports-after.log (pass); build zero warnings/errors. Next: legacy JSON import structural validation/content/rollback and Word manuscript/core-import workflows. No Development writes/deployment.
Current legacy JSON repair group (uncommitted)
Real SQL verification found the legacy lookup procedure loading custom asset states from every project into a name-keyed dictionary. Repeated project-local state names made valid imports fail; forward-only migration 218 restricts this result to shared states, consistent with the already-correct portable-backup lookup procedure. The fixture now includes a real shared state and another project's state name; only the shared state can become a reference.
Thirty malformed root/nested collections/records now fail preview cleanly instead of throwing. Chapter/scene numbers are checked against SQL's decimal(9,2) range/precision before allocation. Legacy books previously flattened subtitle into title and left explicit scene imports marked as having no explicit scenes; title/subtitle and scene mode are now stored separately. Long separately valid title/subtitle fields are retained without truncation. Initial asset owner resolution previously discarded the resolved character ID and passed alias text into a free-text custody parameter; using the existing character-ID parameter preserves the canonical custody link, including names with commas.
Expanded SQL fixture passed book/chapter/scene order and fractional numbers; empty book/chapter/scene records; long Unicode/plain formatting; aliases/hierarchy; plot/thread/event references; assets/state/event/custody; hard dependencies; dry-run isolation; author boundaries; and a forced SQL parameter failure that rolls back shell/children. The actual downloadable sample imports and its book/chapter/scene content/metadata are compared. Server UTF-8/UTF-16 BOM decoding and edited-text precedence after upload are checked separately from browser transport. The first expanded setup attempt supplied an implicit ID to a non-identity lookup table; fixed that synthetic setup, not product behavior.
Further compatibility tests reproduced rejection of the documented optional packageVersion and casing rejected by detection despite case-insensitive deserialization. Detection is now being aligned with those contracts; final rechecks pending. Evidence: /tmp/plotdirector-phase2-legacy-before.log, ...-legacy-lookup-repair.log, ...-legacy-optional-version-before.log; earlier repaired expanded SQL run passed in ...-legacy-after.log. The 405-check harness passed before the final detector changes; rebuild/rechecks are underway. No actual historical full-project backup fixture was found by targeted filename discovery in tests/documentation, and none is fabricated.
Workflow inventory: 2026-11-03-phase2-transfer-workflows.csv records 28 exports/imports/synchronization/materialization/upload/diagnostic flows and their distinct verification/limits. Word structure/core-import SQL checks remain next. These fixtures never start paid model/image generation or application workers. Development is unchanged and undeployed.
Legacy repair verification checkpoint
Final legacy SQL run passed (/tmp/plotdirector-phase2-legacy-after.log), including optional version and case-insensitive detection, BOM decoding, edited-text precedence, all top-level planning entity groups and the real downloadable sample. The portable-backup matrix was rerun with shared reference states and uppercase root keys: 1,021 source values, 982 copied values and 985 in-place values across 65 persistent collections; twelve files, storage limits/ownership, safety backups and SQL failure cleanup still pass (/tmp/plotdirector-phase2-transfer-files-final-legacy.log). Broad harness passed again: 405 checks, exit 0 (/tmp/plotdirector-phase2-tests-legacy-final.log). Build zero warnings/errors. Migration 218 only exists in the synthetic database; no Development changes/deployment. Remaining Word/core-import and unrepresented persisted SI scope remain explicit, not treated as completed.
Current Word structure API repair group (uncommitted)
Real HTTP/SQL reproduction found the older Word structure import unusable under the current scene model: its first-scene branch assumed chapter insertion created a placeholder, then attempted SceneWorkflow with a null SceneID. Forward-only migration 219 now creates a scene when none exists, resets the scene variable per iteration, and marks a successful explicit-scene import accordingly. No historical migration was edited.
Replacement confirmation returned HTTP 500 because the procedure deliberately returns only its result header, while the repository unconditionally read a second result set. It now reads the document only when another result remains. After the SQL repair, 201-character titles were demonstrably accepted/truncated and changed book structure; service validation now rejects them before SQL. Null chapter/scene records also returned 500; import and sync now guard malformed nested collections/records. Document-binding conflicts already rolled back replacement changes but surfaced as 500; the expected SQL business error now returns a clear 400 message.
Expanded HTTP/SQL verification passed valid Unicode/order/word counts including an empty scene, canonical document links, read-back, unconfirmed replacement protection, preservation of archived planning records on confirmed replacement, repeated import/sync without duplicate identities, and real binding-conflict rollback. The fixture runs actual controllers/access/subscription filters/services/repositories/SQL, with synthetic identity and entitlement decisions and unused external-service boundaries; no application workers, paid providers, or desktop Word run. Final denied-entitlement case and broad harness are being completed before commit. Evidence: /tmp/plotdirector-phase2-word-transfer-before.log, ...-word-transfer-sql-repair.log, ...-word-transfer-conflict-before.log, ...-word-transfer-after.log. Development remains unchanged.
Word structure checkpoint verified: final HTTP/SQL run passed, including a denied fixture entitlement returning 403 without changing the book, other-author/anonymous rejection, repeated sync retaining scene IDs and updated word counts, and confirmed replacement preserving the original archived planning text. The complete 405-check harness passed (exit 0) at /tmp/plotdirector-phase2-tests-word-transfer.log; solution build zero warnings/errors. Migration 219 only applied in the synthetic database. Desktop Word and full prose/Core Import remain distinct next work, and no Development deployment has occurred.
Core Import source and build provenance — 4 November
Real isolated SQL Core Import builds now cover two chapters/three scenes, canonical identity maps, an existing and a new character, preview retry idempotence, author isolation, exact long Unicode/CRLF and empty manuscript text, structural paragraph coordinates and completed marker history. Desktop Word, model calls and full service orchestration are separate boundaries; no paid provider was invoked.
Reproduced same-project restore failure against retained Core Import build-map foreign keys. Migration 220 and backup models now carry all four build/map sets, retain completed history in place, remap canonical IDs/ownership on copy and assign new preview identities. Copies never activate Word bindings; unfinished operations become cancelled history with a preview warning. Older snapshots missing existing build history and restores during unfinished marker operations are refused before mutation.
Combined matrix passed: 73 serialized data collections, all 69 persistent collections populated; SQL projection 1,051 values across 72 populated entities; copy 1,011 values; in-place 1,015 values. Schema census: 74 entities / 865 columns / zero missing non-computed model properties. Evidence: /tmp/plotdirector-phase2-core-transfer-before.log, core-transfer-after.log, transfer-core-matrix.log, core-guards.log (all prefixed /tmp/plotdirector-phase2-). Solution build zero warnings/errors; full 405-check harness passed before the added refusal guards. Development unchanged; migration 220 applied only to the isolated synthetic database.
Scene suggestion history and statistics — 4 November
Populated all three scene suggestion tables and reproduced both omissions from backup and an in-place restore failure against retained scene foreign keys. These are retained author review records, including Pending, Accepted, Rejected and Dismissed, not expendable detection caches. Migration 221 adds their full projections, restored identities, canonical references, review timestamps/reasons and imported actor remapping. Stored scene dialogue/prose word and paragraph statistics are also preserved exactly. An older snapshot missing any existing suggestion table is refused before mutation (all three independently tested).
Real isolated SQL matrix passed: 77 serialized collections, all 73 persistent collections populated, source 1,192 stored values across 76 populated entities; copy 1,152 and in-place 1,156 values. Schema census 78 entities / 907 columns / zero missing non-computed model properties. Full solution build zero warnings/errors. Evidence /tmp/plotdirector-phase2-scene-review-before.log (restore failure), scene-review-projection-before.log (explicit missing collection), scene-review-after.log, scene-review-guards.log, census-scene-review.log (each with the same /tmp/plotdirector-phase2- prefix). Still no Development writes/deployment. SI candidate JSON/audit graph and illustration catalogue/files remain outside the verified portable graph; no full 167-table coverage claim.
Scene review checkpoint: full 405-check regression harness passed, exit 0 (/tmp/plotdirector-phase2-tests-scene-review.log). Migration 221 and all three old-snapshot refusal cases passed in the synthetic database only.
Core Import location-review history — 4 November
Confirmed another three omitted persistent sets: Core Import location reviews, author candidate decisions and scene-backed evidence. Migration 222 and DTOs now preserve every stored field, result/existing/same-location/parent references, known-name JSON and completed history. Copies remap ownership and canonical/build references and reuse one fresh preview GUID for the matching build and review. The first combined comparison caught a new implementation ordering error (review BuildID assigned before build remapping); moving review remapping after build remapping resolved it. This failed fixture is retained as evidence rather than counted as a product regression.
The final isolated SQL matrix passed all 76 populated persistent collections (80 serialized collections total): source 1,233 stored values in 79 populated entities; copy 1,192; in-place 1,197. Tests independently removed each of the three review collections from an old-shaped snapshot and confirmed refusal without removing evidence. Build zero warnings/errors. Evidence /tmp/plotdirector-phase2-basic-review-before.log (missing set), basic-review-after.log (new ordering error), basic-review-order.log (pass), build-basic-review-order.log, census-basic-review.log (all with /tmp/plotdirector-phase2- prefix).
Inventory classification now explicitly separates shared vocabularies/name datasets and account/auth/billing/support/notification data from project content. Invitations/security tokens are deliberately not recreated; restore-point snapshots/history are separately managed to avoid recursive backup embedding. Unrepresented project-owned SI/audit/illustration data remains marked as a gap. No Development migration or deployment.
Restart-gate checkpoint and active-state repair — 4 November
At commit a37f1c8 the read-only Development gate still refused restart because illustration generation is queued/active. No Development writes, cancellation or restart. Subsequent SI source review found that the gate's generic Pending/Running list omitted actual job stage statuses and the pipeline InProgress status. The read-only gate now includes all nine StoryIntelligenceJob.IsActive states and InProgress; checked mechanically against the model definition. No repeat live inspection is needed while the existing illustration blocker remains.
Retained SI analysis source/results and import audit — 4 November
Confirmed four omitted persistent sets: analysis runs, chapter results, scene results and import commits. Migration 223 now exports their complete stored projections (including long source/raw/parsed JSON, usage/cost metadata, timings and provenance), scopes older runs through Book/Chapter when ProjectID is null, and restores their graph transactionally. Copy remaps operational canonical/run/result/actor links and retains raw audit JSON exactly, including original embedded source IDs as historical audit. Scene.ImportRunID now follows the copied retained run rather than being detached when the run is available. Older backups without retained runs keep the existing detached-copy behaviour. No review GET reconstruction was introduced.
Unfinished copied analysis becomes cancelled audit history with an explicit warning; no paid provider runs. Restore refuses active current runs, unfinished snapshot runs/materialization and old-shaped snapshots missing any existing audit collection. Tests removed each of the four collections independently, verified source/raw JSON remains exact on refusal, rejected an unfinished snapshot, verified a cancelled copied history and refused replacement of a current Running run (synthetic status reset in finally). Three new invalid run/scene reference previews also fail before allocation.
Final real SQL matrix: 84 serialized collections; all 80 persistent collections populated; source 1,331 stored values across 83 populated entities, copy 1,290, in-place 1,295. Field census 85 entities / 1,046 columns / zero missing non-computed model properties. Build zero warnings/errors. Evidence /tmp/plotdirector-phase2-si-audit-before.log, si-audit-after.log, build-si-audit-guards.log, census-si-audit.log (all /tmp/plotdirector-phase2- prefix). Pipeline/memory/review/consent/illustration graphs remain unrepresented; this is not a complete SI or 167-table claim. No Development writes/deployment.
SI audit checkpoint: all 405 broad regression checks passed, exit 0 (/tmp/plotdirector-phase2-tests-si-audit.log). Additional focused coverage passed after the final test-only build: legacy run scope through ChapterID with null ProjectID/BookID; independent unfinished materialization snapshot refusal; both run and commit cancelled on copy (/tmp/plotdirector-phase2-si-audit-scope.log).
Durable SI pipeline, memory and profile evidence — 4 November
Confirmed 11 omitted sets: pipeline completion and stage state, memory character identities/aliases/attributes, assets, locations, memory-to-memory relationships, processed scene markers, author import preferences, accumulated character profiles and profile evidence events. Migration 224 and DTOs now serialize every stored field. Canonical project/book references and scene-result provenance are remapped independently from memory entity IDs. Known profile EvidenceTimeline/Contradictions SceneResultID fields remap on copy; unknown JSON extensions remain semantically identical. Same-project profile JSON remains exact.
Main copy comparison initially passed while the unfinished-pipeline case failed against CK_StoryIntelligenceBookPipelines_Status: the new copy code had attempted Cancelled, which this three-state pipeline does not support. Repaired using the existing NeedsReview state, retaining stages/evidence and excluding it from InProgress background work, without expanding the runtime state model. Paid run/import history still uses its own supported Cancelled status. Tests now cover copied paused pipelines, current active and unfinished-snapshot refusal, all 11 independent missing-collection refusals, all three memory entity types, invalid/missing profile JSON, ambiguous JSON property casing and missing/foreign memory/evidence references.
One field-specific limit is explicit: StoryMemoryLocations.ParentLocationID has no FK and the current repository never writes it; its canonical-vs-memory target is undefined. Same-project restore preserves it. Non-null portable copies are refused before allocation rather than guessing. The normal fixture exercises its existing null state; this is not a non-null hierarchy fidelity claim.
Final real SQL matrix passed all 91 persistent collections (95 serialized collections total): source 1,483 stored values across 94 populated entities; copy 1,441; in-place 1,447. Field census 96 entities / 1,184 columns / zero missing non-computed model properties. Build zero warnings/errors. Evidence /tmp/plotdirector-phase2-memory-before.log, memory-after.log, memory-copy-diagnostic.log (constraint discovery), memory-paused.log (final pass), build-memory-paused.log, census-memory.log (all same /tmp/plotdirector-phase2- prefix). Remaining review/consent/illustration graphs are still a coverage gap. Development unchanged.
Memory checkpoint: full 405-check regression harness passed, exit 0 (/tmp/plotdirector-phase2-tests-memory.log). Migration 224 and all new SQL guards were verified only in the isolated synthetic database.
Persisted entity review generations, author decisions and evidence — 4 November
Confirmed three omitted sets that the authoritative runtime identifies as persisted sources of truth. Migration 225 preserves every stored field for prepared generations, candidates and compact evidence. Synthetic fixtures cover all five modules (Characters, Locations, Assets, Relationships, Knowledge), pending, reviewed and automatically tracked states, alias targets, assessment/priority, timestamps and canonical decisions. Actual production repository list/page procedures read the imported settled and pending records without raw-analysis reconstruction.
Copy remapping covers module-specific canonical decisions and declared payload references, including character options, observations, proposed/existing location parents and nested Location significance scene/chapter/book evidence. Unknown JSON properties remain semantically identical. Known lookup IDs use existing name-based lookup resolution. Relationship scene/direction/reciprocity keys, legacy pair-key grammar and Knowledge character-prefixed keys are rewritten consistently across candidate keys, alias targets, payload keys and canonical RelationshipEvents/CharacterKnowledge.SourceReviewKey. Two repeated production save/acceptance calls after copy returned existing canonical IDs without duplicate knowledge or relationship events. The legacy-key case is a synthetic grammar fixture, not evidence of a historical backup file.
Unfinished copied preparation becomes failed/inactive history with an explicit warning and retained candidate records. Tests confirm it is not exposed as a current generation. Current/snapshot Preparing state is refused before restore mutation; each missing old-shaped review collection is separately refused without removing any of the 16 retained decisions. Added invalid canonical/generation/module/payload/observation/key cases; combined invalid preview count is now 38, all before allocation.
Final real SQL matrix passed all 94 populated persistent collections (98 serialized collections): source 2,001 stored values across 97 populated entities; copy 1,879 generic stored-value comparisons plus explicit module-specific payload/key/decision assertions; in-place 1,965 comparisons. Schema census 99 entities / 1,226 columns / zero missing non-computed model properties. Build zero warnings/errors. Evidence /tmp/plotdirector-phase2-review-before.log, review-guards.log, review-idempotence.log, review-location-evidence.log (final pass), build-review-location-evidence.log, census-review.log (all /tmp/plotdirector-phase2- prefix). Narrative synthesis, enrichment and illustration graphs remain separate gaps; operational account/consent/job references require preservation without recreating consent or replaying work. No Development writes/deployment.
Entity review checkpoint: full 405-check regression harness passed, exit 0 (/tmp/plotdirector-phase2-tests-review.log). Final combined SQL run includes nested Location significance evidence and repeated canonical idempotence checks. Migration 225 is applied only in the synthetic database.
Retain account/job/consent references safely during restore — 4 November
Populated real constrained onboarding, consent, completed job and activity audit rows in the synthetic fixture. Reproduced a valid same-project restore failure because these retained operational records reference the books being replaced. They are account-wide preferences, permission/operation ledgers and a project activity audit, not disposable caches or portable author planning content. Copy must not manufacture another author's consent, recreate jobs or replay historical activity.
Migration 226 keeps these existing account rows rather than replacing them from project JSON, defers their FK checks within the existing restore transaction, and validates them again after canonical restoration. Current active jobs (including Preparing and other non-terminal stages) block restore. A snapshot removing a book still required by consent/job history is refused before mutation. Only a nullable onboarding BookID pointer to an otherwise unprotected book deliberately absent from the snapshot is cleared; other account fields remain current. Backup diagnostics now state these scope boundaries.
Verification passed the full 94-collection stored-value matrix plus exact retained account/activity snapshots: source account unchanged by copy, no copied consent/job/onboarding authority or original activity event, newer operational values retained through actual restore, active-job refusal, protected-book removal refusal and real removal of an unprotected navigation-only book with safe pointer clearing. The first activity fixture used an invalid enum token; corrected to the existing Updated token from the authoritative check constraint (fixture issue, not product defect). Build zero warnings/errors. Evidence /tmp/plotdirector-phase2-account-links-before.log (restore failure), account-links-after.log, account-activity.log (fixture enum), account-activity-final.log (pass), build-account-activity.log, account-core.log (all /tmp/plotdirector-phase2- prefix). No Development writes/restart.
Operational-reference checkpoint: focused Core Import SQL/source/provenance restore passed with the new account references present (/tmp/plotdirector-phase2-account-core.log). Full 405-check regression harness passed, exit 0 (/tmp/plotdirector-phase2-tests-account-links.log). Schema remains unchanged; 99 serialized entities / 1,226 fields. Migration 226 remains synthetic-only.
Character enrichment evidence and actionable restore refusals — 4 November
Confirmed two omitted persistent sets: character enrichment run audit and its scene/book-wide evidence. Migration 227 and complete DTOs now carry completed and failed histories, usage/duration/error metadata, current flags, canonical character/book/pipeline references and evidence values/text/confidence. Copy remaps owner and references. Unfinished enrichment is copied as failed/inactive history with a clear warning; it cannot be claimed as queued/running work. Current or snapshot unfinished enrichment is refused before restore mutation, and both missing old-shaped collections are independently protected.
The restore service previously hid even safe, fixed preflight refusal reasons behind a generic error. It now returns the application-defined 51006–51020 refusal message with confirmation that the safety backup was retained; unexpected SQL failures keep the generic response. A real service call against a synthetic Running enrichment run verified the actionable message, retained safety backup and complete staged-file cleanup; the fixture status resets in finally.
Real SQL matrix passed all 96 populated persistent collections (100 serialized collections): source 2,073 stored values across 99 populated entities; copy 1,951 generic comparisons plus module-specific review assertions; in-place 2,037. Invalid preview count now 40, with no allocation. Field census 101 entities / 1,262 columns / zero missing non-computed model properties. Build zero warnings/errors. Evidence /tmp/plotdirector-phase2-enrichment-before.log, enrichment-after.log, build-enrichment-guards.log, census-enrichment.log (all /tmp/plotdirector-phase2- prefix). No paid provider, worker or Development writes/deployment.
Enrichment checkpoint: full 405-check regression harness passed, exit 0 (/tmp/plotdirector-phase2-tests-enrichment.log). Migration 227 remains applied only in the isolated synthetic database.
Narrative synthesis and persisted Plot/Thread review history — 4 November
Confirmed four omitted sets: synthesis runs, narrative candidates, evidence and candidate events. Migration 228 carries complete non-computed stored fields; SourceStoryIntelligenceRunKey remains a database-computed value. Fixtures include completed/failed provider history, long exact ResultJson, accepted/pending/rejected/merged decisions, parent and merge targets, author seed links, ignored events and two accepted canonical event source forms. The initial comparison needed explicit semantic mappings for candidate synthesis-run and author-seed IDs because those schema columns lack FKs; the copy implementation already remapped them.
Provider ResultJson is retained exactly as historical output, including original embedded source IDs. Persisted operational references are remapped separately. Canonical ThreadEvents can reference either an explicit candidate event or candidate evidence; both source identities and composite source keys now follow the copied graph, and AcceptedThreadEventID follows back to the canonical event. Opaque provider event tokens are preserved, including colons/Unicode. Matching uses indexed source records rather than repeated full scans. Ambiguous/unresolved links are refused for portable copy when the source graph is present; same-project history is retained. Older graph-less backups keep the existing detached-copy behaviour with an explicit warning.
Production narrative readers returned all six candidate states/records, six evidence rows and both active/ignored candidate events. Two repeated calls per source form through the production ThreadEvent_Save procedure returned existing canonical IDs, without duplicates. A synthetic nullable-run grammar case also passed both remapping and replay; it is not a historical backup fixture. Parent/merge cycles, foreign refs and mismatched parent keys fail preview before allocation. Current or snapshot unfinished synthesis is refused, while copies become failed/inactive history with decisions/evidence retained. Actual restore service returns the safe actionable refusal and retains the safety backup. All four old-shaped missing collections are independently protected.
Final indexed real SQL matrix passed all 100 populated persistent collections (104 serialized collections): source 2,427 stored values across 103 populated entities; copy 2,301 generic comparisons plus explicit review/provenance assertions; in-place 2,391. Invalid preview count 47. Field census 105 entities / 1,342 columns / zero missing non-computed model properties (one computed synthesis key intentionally omitted from the DTO). Build zero warnings/errors. Evidence /tmp/plotdirector-phase2-narrative-before.log, narrative-after.log (comparison-harness semantic mapping gap), narrative-guards.log, narrative-index.log (final pass), build-narrative-index.log, census-narrative.log (all /tmp/plotdirector-phase2- prefix). Remaining feature scope: illustration catalogue/provenance/files; final independent owned-row census still pending. No Development writes/deployment.
Narrative checkpoint: full 405-check regression harness passed, exit 0 (/tmp/plotdirector-phase2-tests-narrative.log). Migration 228 remains synthetic-only; no Production or Development schema/data writes.
Independent owned-row census — 4 November
Added a census independent of the backup selectors and DTO graph descriptor. Actual database foreign keys, composite primary keys, non-null ProjectID anchors and the documented legacy BookID soft reference determine the owned rows. The check rejects omitted owned rows, duplicate primary keys and foreign rows; explicitly shared vocabulary is checked separately. Per-table counts are in 2026-11-03-phase2-row-coverage.csv.
Final real SQL run passed all 173 owned rows across 103 scoped entities, plus the existing 100 populated persistent collection copy/in-place matrix. Negative probes omitted a deleted gallery record and an ignored narrative event; both were detected despite every remaining exported value being valid. Build zero warnings/errors. Evidence /tmp/plotdirector-phase2-row-census-final.log and /tmp/plotdirector-phase2-build-row-census-final.log. Full 405 checks last passed at narrative checkpoint; this group changes only the specialist test harness. The census covers advertised entities, not the still-unclassified illustration tables.
Project illustration association and request history — 4 November
Migration 229 adds complete persisted projections for StoryMemoryIllustrationAssignments, StoryMemoryIllustrationDemands and ProjectID-specific StoryIntelligenceIllustrationDemands. The last table has a unique ProjectID/DemandKey aggregate; NULL-project requests are shared and excluded. Memory assignment EntityID is typed and pipeline-scoped, with explicit preview validation and copy remapping. Fixtures include all three entity types, waiting and active assignments, invalidated/rejected history and recorded/queued/generated demand history.
Same-project restore preserves every stored field and catalogue reference, without rewinding shared catalogue state. Three old-shaped missing-collection guards prevent destructive omission. Current or referenced snapshot catalogue Queued/Generating work refuses restore before mutation. Imported copies retain stable codes, status/counters/evidence and original invalidation history; active assignments become explicitly inactive, and all queued/generated/shared catalogue links are detached. No worker/provider runs, catalogue rows, approvals or source provenance are manufactured. Warning acknowledgement is required under the existing import workflow.
The shared catalogue is selected without project ownership by the runtime and has administrator approval/archive/usage state plus soft SourceProject/Book/Scene provenance. Author-controlled backup JSON must not recreate/reapprove those shared rows or overwrite other projects' usage. It is therefore an explicit external dependency: catalogue records and library files need separate administrator-level recovery. Backup diagnostics and preview warnings state this boundary. Project-origin artwork in the shared catalogue is not bundled by the project-owned upload manifest; portable catalogue/file recovery remains unsupported. This is a declared limit, not verified image recovery.
Real SQL source projection passed 2,551 values across 106 populated entities. Independent census found all 181 owned rows across 106 scoped entities. All 103 populated persistent collections passed copy (2,419 generic comparisons plus semantic assertions) and in-place (2,515 comparisons). Shared catalogue every-field/global-request snapshots remained exactly equal through successful copy and restore; old omission and active-generation refusals also preserved state. Fifty malformed preview cases failed before allocation. All 167 schema tables are now classified, with explicit exclusions/limits. Evidence /tmp/plotdirector-phase2-illustrations-sql.log; build and final field/regression checkpoints follow. Migration 229 remains isolated-synthetic-only. No Development/Production schema or data writes, provider calls or deployment.
Illustration checkpoint: build zero warnings/errors; full 405-check regression harness passed, exit 0 (/tmp/plotdirector-phase2-tests-illustrations.log). Field census passed 108 entities / 1,388 columns / zero missing non-computed model properties (/tmp/plotdirector-phase2-census-illustrations.log). Actual shared catalogue/global-demand equality assertion passed through successful copy and in-place restore. No standalone library asset recovery or historical fixture claim.
Connected map routes and floor links — 4 November
Expanded the real production MapRepository fixture from two marker/area features to four features, including a connected Path, endpoint markers, an unplaced locked marker with hidden label/offsets and opaque geometry properties. The source map links to an actual FloorPlan, and its journey references the connected route. Copy checks verify route endpoints, journey identity, remapped floor-plan identity, exact geometry and label/placement/lock state; the independent stored-field matrix also covers in-place restore. Added three malformed preview cases: area used as a journey route, foreign route endpoint and foreign floor-plan reference. Total malformed previews now 53, all before allocation.
Build zero warnings/errors; complete 103-collection copy/in-place SQL run passed (/tmp/plotdirector-phase2-map-routes.log). This is a specialist fixture expansion, with no application change. Last full 405 regression gate remains the illustration commit. No standalone label geometry is claimed: the application's declared geometries are Marker, Area and Path; label settings are attached to those features.
Ordinary image workflows and WebP stream lifecycle — 4 November
Added an explicit synthetic-only --image-transfer-only specialist mode, using production gallery/main-image/asset/cover/background/map upload and avatar crop services, repositories and actual files. Four extensions (PNG, JPG, JPEG, WebP) cover 28 upload/crop cases. Gallery/main/asset/book outputs are normalized WebP; floor backgrounds instead preserve the exact original encoded bytes and Unicode filename. Map references remain embedded normalized WebP with existing limits and author-scoped access.
Confirmed a real WebP upload exception in production gallery code: codec creation can close the managed input stream, then the uploader rewinds that closed stream to decode a second time. PNG/JPG/JPEG passed; WebP failed at MemoryStream.set_Position / VisualIdentityImageService line 316. The same pattern existed in asset and book cover uploads. All three paths now decode through the already format-validated codec. No new raster formats, limits or decoding policy introduced. Reproduction /tmp/plotdirector-phase2-image-webp-repro.log; repaired format matrix /tmp/plotdirector-phase2-image-webp-fixed.log.
The expanded HTTP fixture passed 40 actual MVC requests across gallery/background/map uploads, avatar save/remove and gallery delete, including persisted rows/encoded bytes, Unicode filename binding, source identity, crop clamping, tombstones and avatar cleanup. Other-author, anonymous and missing anti-forgery requests are refused without SQL/file mutation. Five invalid inputs across five upload paths (25 cases), including renamed GIF, are refused with exact source SQL/ledger/file-byte equality. Five quota-refusal cases exercise service handling of the quota decision without mutation; this is not a new end-to-end subscription calculation claim. Active ledger rows use the actual project owner and stored file lengths, with no repeated active fixed paths. Floor's existing original-file workflow is separate and no quota/ledger change is claimed.
Final prior-to-capture HTTP run passed /tmp/plotdirector-phase2-image-avatar-http.log; final actual-upload backup capture and generated HTTP inventory are being checked next. Physical UI crop gestures, live browser acceptance and book/asset edit-form HTTP are explicitly outside these new service/HTTP claims. No provider calls or Development/Production writes.
Image checkpoint: final production service/SQL and 40-case HTTP fixture passed, including backup capture of 27 owned files and four embedded map images (/tmp/plotdirector-phase2-image-capture.log). The initial capture assertion incorrectly disallowed the fixture's legitimate empty text attachment; corrected to exact physical-byte and SHA-256 comparison, including zero length. No application defect was inferred from that fixture mistake. Build zero warnings/errors (/tmp/plotdirector-phase2-build-image-capture.log); full 405 regression checks passed, exit 0 (/tmp/plotdirector-phase2-tests-image-workflows.log). Per-case inventories: 2026-11-03-phase2-image-coverage.csv and 2026-11-03-phase2-image-http-coverage.csv.
Next independent check: concurrent author edits between the separate core/map/source/metadata backup reads. Current repository has no encompassing read transaction; test for a mixed-version snapshot before choosing a repair. Do not infer an atomic filesystem snapshot from a consistent SQL read.
Consistent SQL graph reads during concurrent edits — 4 November
Reproduced a mixed backup from one atomic synthetic author edit: core Books contained the before marker, while the separately selected retained scene source contained the after marker. The deterministic fixture pauses the actual repository at the persistent-source selector using database-local application locks; a separate real transaction changes book title and source together. Initial observer attempts were fixture problems (asynchronous connection state observation and denied server-performance DMV access); no permissions were changed. The database-local APPLOCK_TEST signal successfully reproduced the product defect (/tmp/plotdirector-phase2-backup-consistency-local-before.log). The temporary synthetic procedure hook and fixture values restore in finally.
The four actual repository selectors now share one explicit serializable read transaction on the same open connection. Commit occurs after the entire SQL graph is assembled and before service-level file capture. No inline application SQL, new migration or database option change. This prevents mixed SQL versions and phantoms; it is not a claim of an atomic filesystem snapshot. Concurrent editing may wait for the bounded SQL read window. Fixed repair verification is in progress; keep this checkpoint open until the controlled writer and full transfer/regression checks pass.
Consistent-read checkpoint: controlled writer passed (/tmp/plotdirector-phase2-backup-consistent-read.log); writer stayed blocked during the split read, both values remained at the before version, and the writer then committed the after version. Complete 103-collection copy/in-place/rollback/account/guard matrix passed (/tmp/plotdirector-phase2-transfer-consistent-read.log). Build zero warnings/errors; full regression harness is running. Next isolated test checks fixed-path image replacement between SQL snapshot and file capture; do not claim filesystem consistency until that separate test passes.
Consistent SQL read regression checkpoint: full 405-check harness passed, exit 0 (/tmp/plotdirector-phase2-tests-consistent-read.log). No Development/Production writes or deployment; no database option/permission changes. Separate file replacement interleaving check remains next.
Image version identity across SQL/file capture — 4 November (in progress)
Reproduced a second independent backup defect: after SQL metadata was captured, an avatar replacement overwrote the same avatar.webp path. Later file capture silently inserted the newer bytes into the older snapshot (/tmp/plotdirector-phase2-backup-image-consistency-before.log). Asset and cover writers use the same fixed-path pattern. New replacement filenames now include their existing generated version GUIDs; all legacy stored paths remain readable. A stale reference to a removed version now refuses capture instead of silently substituting new bytes. Missing-during-capture errors have a dedicated exception, and project export retries the entire SQL/file read once; persistent missing files still fail without success audit or a partial archive.
Initial versioning checks passed stale/fresh avatar, asset and cover capture, then exposed stale-model cleanup: two requests loading the same old model could leave an unreferenced version active in the storage ledger (/tmp/plotdirector-phase2-image-versioning-stale-before.log). Avatar create/remove and asset create/remove now share their entity lock and reload current paths inside it; cover upload reloads inside the existing book lock. Current tests also verify exact active ledger paths and bounded fresh-read retry. Keep this repair open pending full image/HTTP, persistence-failure cleanup, transfer and regression checks; no Development/Production writes or deployment.
Image-version checkpoint: all three stale/fresh snapshot interleavings, all three stale-model ledger checks and both bounded export retry cases passed. Eight actual SQL trigger refusals cover reference and ledger writes for asset, cover, gallery and avatar; all original rows/file bytes remained identical with no new orphan files. Temporary own synthetic triggers were removed in finally. An actual outer transaction rollback across cover/gallery writes also passed: old cover retained until commit; rollback removed new files and SQL/accounting changes. New image persistence helper groups existing stored-procedure writes in an ambient-aware transaction and defers physical cleanup to its final outcome; uncertain transaction outcomes retain both versions. No migration, inline application SQL or permission changes. Evidence /tmp/plotdirector-phase2-image-persistence-final.log; 17 scenario inventory 2026-11-03-phase2-image-integrity-coverage.csv supplements the 28 format/crop and 40 HTTP inventories.
Final data/regression checkpoint for image versions: build zero warnings/errors (/tmp/plotdirector-phase2-build-image-versions-final.log); complete 103-collection copy/in-place/safety/rollback/account/guard matrix passed (/tmp/plotdirector-phase2-transfer-image-versions.log); full 405 checks passed (/tmp/plotdirector-phase2-tests-image-versions.log). Final real HTTP/SQL export run passed all eight packet types × five formats/aliases, owner/missing/anonymous boundaries and complete backup/restore-point downloads (/tmp/plotdirector-phase2-exports-final.log).
Browser refresh uses the database-free loopback command dotnet run --no-build --project PlotLine.Tests/PlotLine.Tests.csproj -- --toolbar-browser-host, port 5238. The old fixture host had exited. This flag must not be confused with --maps-story-dev-fixture, which writes Development data and was not run. Playwright/SignalR dependencies resolve from PlotLine.Tests/Browser/node_modules. Fresh current-assembly Writer/goal browser smoke and final restart gate remain next.
Fresh browser checkpoint: current-assembly database-free full-layout Writer/real-Hub browser/PWA recovery/windows/navigation passed (/tmp/plotdirector-phase2-writer-final.log); chapter goal guard/controller/anti-forgery/Unicode/save-failure-retry/concurrent-edit cases passed (/tmp/plotdirector-phase2-writer-goals-final.log). The owned fixture host was stopped afterward; no Development host was restarted. This remains fixture verification, not authenticated live acceptance.
Next confirmed code-path concern to reproduce: RestoreAsync deserializes old snapshots into default-empty DTO collections and serializes them again for SQL. Existing SQL omission guards distinguish absent collections from empty arrays; normalization may therefore defeat the intended protection. Exercise actual restore service, not only direct stored-procedure guard calls, before closing transfer work.
Actual restore-service collection presence — 4 November
Confirmed a real service-path defect beyond the direct SQL guard tests: a synthetic snapshot omitting SceneAssetSuggestions restored successfully and erased all four existing rows. DTO deserialization created an empty list, and reserialization then hid the omission from SQL (/tmp/plotdirector-phase2-service-omission-before.log). The real safety backup was retained, but that did not make the data-erasing restore acceptable.
Restore now verifies the complete stored safety snapshot, compares original collection presence against its owned persistent data and refuses ambiguous omission before staging. Diagnostic/shared permission/quota/reference scope is handled explicitly. Original absent keys also stay absent in mapped SQL JSON, so database omission guards retain their meaning. Format/version/data headers must be explicit rather than inferred from DTO defaults. Partial-copy preview warns that absent categories cannot be reconstructed; accepted comment/trailing-comma syntax and case-insensitive names remain supported.
Actual service matrix passed all 103 independently metadata/SQL-owned collection omissions with exact original data/file-byte equality. Any safety point created was read back and compared for complete data. Camel-case and three required-header cases passed; explicit empty remains a valid historical state. An observed-and-forwarded real repository/SQL call confirmed that a safely absent unused category remains absent after staging. Copy warning, required-header and lenient-JSON preview checks passed. These are synthetic compatibility shapes, not historical backup fixtures. Inventory 2026-11-03-phase2-restore-omission-coverage.csv; evidence /tmp/plotdirector-phase2-service-omission-matrix.log.
Checkpoint: build zero warnings/errors; complete 103-collection transfer/safety/rollback/account matrix passed (/tmp/plotdirector-phase2-transfer-service-presence.log); all 405 regression checks passed (/tmp/plotdirector-phase2-tests-service-presence.log). No migration or Development/Production writes. Next check: field-level default inference in older-shaped rows, distinct from absent collections. No historical full-backup compatibility claim.
Stored-field presence before restore defaults — 4 November
Confirmed the same inference defect inside a row: a real service restore from a synthetic snapshot lacking Books.StoryEra succeeded and replaced its stored Future era value with NULL (/tmp/plotdirector-phase2-service-field-before.log). Collection presence alone could not prevent this. The repaired real service refusal retains the entire original data state before allocation (/tmp/plotdirector-phase2-service-field-fixed.log).
Added a compiled stored-field contract generated from the independently audited schema CSV (104 restored entities / 1,351 non-computed columns before explicit JSON/audit semantics). It avoids treating UI-only model properties as persisted requirements. Computed/derived and diagnostic permission/quota categories are excluded; explicitly global lookup rows are retained rather than overwritten. Root UpdatedDate is server-maintained, while the existing version-1.2 root audit replay is handled conditionally. Nullable values remain valid when explicitly present. Omitted stored fields refuse same-project restore instead of acquiring DTO defaults. New-copy preview can recover supplied data with a clear existing warning acknowledgement that absent field values cannot be reconstructed.
The generator is PlotLine.Tests/Tools/generate-backup-field-contract.py: first produce the verified synthetic --schema-coverage-only inventory, regenerate, review its diff, build and run the field gate. Regeneration was byte-for-byte deterministic. No production schema reflection, inline application SQL, database option/permission changes or new migration.
The specialist matrix derived its field universe from actual synthetic sys.columns and public model serialization attributes, independently of the generated requirement list. All 1,353 cases passed before safety/write allocation, including the four conditional legacy audit fields, camel-case and a later record. Fast per-field probes use repository/safety observers to prove allocation was not attempted; the original era regression and the complete explicit-null positive restore use the real repositories/SQL/files. The first later-record test mistakenly selected a non-stored word-count property; corrected to actual Scenes.Summary and asserted removal before testing. That fixture mistake was not treated as a production defect. Inventory 2026-11-03-phase2-stored-field-omission-coverage.csv; final evidence /tmp/plotdirector-phase2-stored-fields-later-row.log and build log of the same prefix.
These are current-schema and synthetic older-shaped validations. They cannot recover values an old writer never saved, and are not proof that historical backup files are complete. Actual historical fixtures remain unavailable. Collection/full-transfer/regression gates are being rerun before commit.
Stored-field final checkpoint: all 103 actual collection-service omission cases passed again (/tmp/plotdirector-phase2-collections-stored-fields.log), followed by the full 103-collection copy/in-place/safety/rollback/account matrix (/tmp/plotdirector-phase2-transfer-stored-fields.log) and all 405 executable regressions (/tmp/plotdirector-phase2-tests-stored-fields.log), exit 0. Final field matrix: 1,353 cases including later stored summary and camel-case; actual complete explicit-null restore succeeded. Build zero warnings/errors. Completed verification/reproduction logs are also retained under /srv/repos/plotdirector-phase2-artifacts/verification/.
Final local handover and live Development preflight — 4 November
Code checkpoint e7e71de on codex/phase2-development-20261103; source worktree clean after committed implementation. Current complete gates: build zero warnings/errors, 405 executable regressions, 103 persistent collection copy/in-place/safety/rollback/account checks, independent 183-owned-row census, 108-entity/1,388-column model census, 103 actual service collection omissions, 1,353 SQL-schema-derived field omissions, 40 packet-format HTTP cases, 28 image format/crop cases, 40 image HTTP cases and eight actual SQL image reference/ledger refusals plus outer rollback. Full-layout Writer/real-Hub and chapter-goal browser/PWA fixture smoke passed. Fixture host stopped. All detailed limitations and evidence are in the sections/inventories above.
Latest read-only Development preflight verified PlotDirector_Development and refused deployment: illustration generation is queued or active. No job cancelled/requeued, no service restart, no Development migration/data write and no Production operation. Service remains active. Strict-TLS GET of root and login both returned HTTP 200. Running DLL SHA-256 remains 5a86109eb96338fc3ec77f416410e1efe33600d4a22cf761a10b30dd513f8689, matching the pre-sprint 1930007 binary. Normal unprivileged release-file inspection lacked read permission; narrowly scoped sudo read succeeded. No credentials were printed.
Remaining external acceptance/recovery limits: real authenticated Writer/PWA and desktop Word acceptance; actual historical backup fixtures; separate administrator recovery of shared illustration catalogue/files. A non-null story-memory ParentLocationID still has no defined portable target and copy is explicitly refused; same-project data is retained. These are declared limits, not silent omissions or fabricated compatibility proofs.
Durable evidence and machine-readable summary: /srv/repos/plotdirector-phase2-artifacts/verification/manifest.json with completed gate logs and reproductions/. No stale publish is deployment-ready. Once Development is idle, follow the deployment guide, take/verify a unique Development database backup, apply the new migrations, publish fresh committed code and repeat live authenticated acceptance when a session is available.
Development deployment after explicit restart permission — 4 November, 12:01 UTC
The user confirmed that Development is a test environment and explicitly permitted restart despite the two illustration records marked Generating. The temporary deployment gate omitted only that check; all other import, Story Intelligence, synthesis, enrichment and onboarding checks passed. No queue records were manually changed. The two illustration statuses remained Generating after restart; their completion is not claimed.
Fresh solution build passed with zero warnings/errors and all 405 executable regression checks passed before deployment. Unique backup /var/opt/mssql/backup/PlotDirector_Development_phase2_20261104115744.bak (host /sql/mssql/backup/PlotDirector_Development_phase2_20261104115744.bak, 70,950,912 bytes) contains two checksummed COPY_ONLY backup sets. The first backup succeeded under the application database account, but VERIFYONLY required administrator permission; the administrator command appended a second backup set. Both sets were explicitly verified, including FILE=2. This is backup verification, not an additional restore test.
Migrations 213–229 applied in order to verified PlotDirector_Development. The first temporary runner attempt stopped at 213 because session SET statements preceded CREATE PROCEDURE in the same batch; no procedure change occurred in that failed attempt. Corrected runner sets session options separately. All 17 scripts completed. Read-back comparisons proved exact final definitions for all seven changed procedures after SQL Server header normalization, plus ANSI_NULLS and QUOTED_IDENTIFIER enabled. Initial SQL-string comparison probes were replaced by direct full-definition comparisons to avoid whitespace/SQL-literal comparison artifacts.
Fresh committed release 0928c20-20261104115934 installed using the documented physical-directory procedure, preserving configuration, uploads, data-protection keys and logs. Release archive /srv/apps/plotdirector-dev/releases/0928c20-20261104115934; prior application directory retained at /srv/apps/plotdirector-dev/current-before-0928c20-20261104115934. Published and deployed PlotLine.dll SHA-256 both 8470fedb12b7b4dff49407021d6f88315a6f4528ac54182854e79d9dd548fba0; informational version 1.0.0+0928c2033adebddb7c8563a4358a3d1c875ec8a4. Service active/running, new process started 12:01:41 UTC. Local root GET, strict-TLS public root GET and public login GET all returned 200.
Startup journal showed no error headers or unhandled exceptions. One warning: HTTPS redirection middleware could not determine a local HTTPS port; public TLS GET succeeded. Authenticated changed-route/Writer/PWA acceptance remains unavailable without a real signed-in session and is not claimed. No Production operation. Deployment evidence retained in /srv/repos/plotdirector-phase2-artifacts/verification/deployment/; machine-readable manifest updated to deployed state.
Final completion audit — 4 November
Re-read original requirements B4, E1–E5, F1–F5, G, H, I and J against the committed inventories, specialist output and current deployment. The prompt explicitly permits deferred blocked items, distinguishes unavailable authenticated live acceptance and prohibits fabricated historical fixtures. Those limitations remain declared. Post-deployment read-only smoke verified eight actual protected routes redirect to login and six CSS/JavaScript assets match published bytes. An initial /Exports probe returned 404 because that controller has no Index action; corrected to its actual StoryBible/ProjectBackup actions. This was a probe-route error, not a product defect. Full concise handover: 2026-11-03-phase2-improvement-report.md. All verified runtime changes are deployed; only final documentation commits follow release 0928c20.