PlotDirector/Docs/WordCompanion/2026-11-07-core-import-completion-fix.md

6.1 KiB

Core import completion and paragraph synchronisation — 7 November 2026

Cause and correction

Windows qualification commit 1048e193fd6555e21c1ce28f19ddb0fb4e30d39c reproduced the defect with Companion 1.0.0.18 and disposable Development book 10151, project 8173. Character finalisation recorded CoreImportComplete in the in-memory review/build result, but never completed the persistent UserOnboardingState. The “Not now” link only navigated to the project. The paragraph write/status guards correctly saw the null completion timestamp as unfinished core import and refused saves and structure changes.

OnboardingService.FinaliseCharacterReviewAsync now completes the persistent lifecycle after all required character alias/mapping/POV work succeeds, before publishing the success result. The existing onboarding repository calls new stored procedure UserOnboarding_CompleteCoreImport; it validates the exact user, wizard, book, preview, owner authority, built scene mappings and completed location review. Completion is idempotent and cannot finish another book selected meanwhile. The completion page also reads the persistent timestamp when cached review results have disappeared.

Forward migration 242_CoreImportCompletion.sql adds that procedure and corrects UserOnboarding_SetCurrentStep: navigation preserves completion. Explicit new setup/import actions still reset completion through the existing SaveWritingJourney/SaveBook operations. “Not now” needs no additional persistence action because core import has already finished. The stale “update Word” chapter-review toast now says “detect and import scenes”; no Word prose rewrite is implied.

Optional Story Intelligence remains separately book/job scoped. It can be started later through the existing book action. Pending/preparing/reading/analysing/finalising jobs retain the existing write protection; completed, failed and cancelled jobs do not. An interrupted job that is still genuinely active/recovering is not bypassed or force-cancelled. Neither optional analysis failure nor ordinary navigation reopens the completed core lifecycle. No existing job/import is modified by the migration.

Verification

  • Solution build: zero warnings/errors.
  • Managed core completion regressions: required review/mapping failures cannot announce completion; real finalisation invokes scoped persistent completion without optional AI; retries preserve the timestamp; completion display recovers from cache loss.
  • Full application regression harness: 455 passing checks.
  • Existing guarded synthetic SQL fixture: real completion and paragraph procedures verify Not now/optional navigation, later AI start, all active job stages, completed/failed/cancelled states, subsequent paragraph saves, explicit new-import protection and stale cross-book refusal. Entire fixture rolls back.
  • Development 10151: its already completed core import is repaired using the same scoped procedure, after backup. Only the onboarding completion timestamp/current step is repaired; paragraph/prose/chapter/scene data are retained.
  • A separate exact-book rollback-only probe checks owner write status, persists its current snapshot and materialises a scene split, then rolls everything back and verifies the exact original paragraph payload and scene count. This is server persistence qualification, not live Word cursor following or proof of a new laptop save transfer.

No Companion source, installer, Production data, Reckoning import or Story Intelligence job is changed. No Word cursor-following success is claimed. Windows Codex should now save the disposable fixture, synchronise, test scene following and exercise structure controls.

Deployment identifiers and final running-site evidence are recorded below after publishing.

Development deployment evidence

  • Deployed application commit: 05e779f1af.
  • Release: /srv/apps/plotdirector-dev/releases/05e779f-20261107T231434Z; prior application preserved in the corresponding current-before-05e779f-20261107T231434Z directory.
  • Published/deployed DLL SHA-256 both: f1cac1ce5edc0ba9292615b7a0f0867e8b35c917bd4f34e0ea588c3b1f3ab1b6.
  • Migration 242 applied to PlotDirector_Development, after COPY_ONLY/CHECKSUM backup PlotDirector_Development_before_core_completion_20261107-231229.bak and successful RESTORE VERIFYONLY. Migration contains no global completion backfill. The separate repair used the exact qualified preview 50e741d8-d42a-47bc-be48-2ad23f91b83d, owner, wizard, project 8173 and book 10151 through the new procedure.
  • Immediately before restart, the deployment activity guard found no queued/processing core import, Story Intelligence, synthesis/enrichment or active SQL import work. No Reckoning state/job was altered and no running import/analysis was interrupted.
  • plotdirector-dev active; public HTTPS and local GET both HTTP 200; post-start warning/error journal check empty. Existing configuration, uploads, data protection and native installation authorisation were preserved.
  • After deployment, CoreImportCompletion_Development10151.sql passed again: book 10151 CanWrite=1, Paused=0; snapshot save and canonical scene split both accepted; transaction rollback retained the exact original paragraph payload and scene count. Thus the server-side active-import blocker is removed for manual and automatic save synchronisation and structure editing.
  • Additional paragraph workflow/portability checks: 39 passed; existing malformed-confidence/97-versus-99/checkpoint recovery checks: 19 passed. New core-completion managed checks: 5 passed; guarded SQL lifecycle checks: 5 passed, covering every real optional job stage.

No real Word transfer after this deployment or cursor following has been asserted. Windows Codex can continue with the installed 1.0.0.18 fixture; no new installer is required. For book 10151, reopen Book details → Manuscript structure and evidence, save Word and synchronise, then verify Context/Intent following. A genuinely active optional analysis still pauses writes until it finishes, fails or is cancelled, by design.