PlotDirector/Docs/Investigations/Writer2Audit/01-Existing-System-Inventory.md

18 KiB
Raw Blame History

Existing System Inventory

Evidence labels and audit scope are defined in README. Paths below are repository-relative. “Implemented” describes inspected code, not a new end-to-end runtime certification.

Writer and planning

Component / status Actual implementation and reusable behaviour Limit relevant to Writer 2.0
Writer dashboard — implemented; SQL objects present in Development PlotLine/Controllers/WriterController.cs: Index, Chapter; PlotLine/Services/CoreServices.cs: WriterWorkspaceService.GetDashboardAsync, GetChapterWorkflowAsync; PlotLine/Views/Writer/Index.cshtml, Chapter.cshtml, _WriterSceneQueue.cshtml; PlotLine/Data/Repositories.cs: WriterWorkspaceRepository Dashboard selects projects, not a book-specific workspace. Index(int? projectId) does not consume bookId although shell links carry it. Queries are repeated for accessible projects and four queues. Avoid expanding this fan-out for historical charts.
Workflow queues — implemented dbo.WriterDashboard_Scenes, dbo.WriterDashboard_Reminders; PlotLine/Sql/015_Phase1P_WriterWorkspace.sql, 052_RevisionStatusWriterWorkflow.sql. Outlined → Write Next; Drafted → Continue Writing; Needs Work → Revision; Revised → Polishing. Scene links, priorities, blockers, warnings, outstanding notes and checklist counts already exist. Single scene revision status cannot describe multiple independent chapter passes. Old DraftStatus/readiness fields remain in model/storage for compatibility; SaveSceneWorkflowAsync preserves them rather than using them as queue authority.
Chapter/scene planning — implemented ChapterGoal_Get/Save, ChapterGoals, SceneWorkflow, notes, checklists and attachments; IWriterWorkspaceRepository; WriterWorkspaceService.SaveChapterGoalAsync, SaveSceneWorkflowAsync, note/checklist/attachment methods. Goals are author-entered narrative objectives, not time-series milestone completions or observed edit events. Preserve these distinctions.
Book targets/progress — implemented Book in Models/CoreModels.cs: TargetWordCount, CurrentWordCount, WritingStartDate, TargetCompletionDate, calculated ProgressPercentage; book/project dashboard services Existing explicit targets are useful wizard prefill/milestone inputs. Word-count ratio is current length versus target, capped at 100%; it is not percentage of revision/editorial work complete or historical output.
Writing plans — implemented and populated in Development WriterController.WritingPlans, EditWritingPlan, activate/deactivate/delete/regenerate actions; WritingScheduleService; WritingPlan / WritingScheduleItem in PlotLine/Models/CoreModels.cs; PlotLine/Views/Writer/{WritingPlans,EditWritingPlan,ScheduleSetup,SchedulePreview}.cshtml. Personal plan owner, project, optional book, start/deadline, JSON days/capacity, session minutes, blocked inclusion, rebalance mode. No separate time-of-day slots, exceptions, protected time, flexible unscheduled mode or versioned schedule history.
Schedule persistence — implemented PlotLine/Sql/056_Phase9B_WritingScheduleFoundation.sql and procedure refactor 088_InlineSqlStoredProcedureRefactor.sql; WritingPlans, WritingScheduleItems; CreateWritingPlan, UpdateWritingPlan, GetWritingPlansByUser, WritingPlan_ListForManagement, WritingScheduleScene_ListForPlanning, WritingSchedulePreview_ListByPlan, WritingScheduleDashboard_ListActive, WritingScheduleItem_UpdatePlannedStatusForUser, WritingPlanSummary_ListRequiringRebalance, date-update/delete procedures. Dapper calls specify stored-procedure command type. Dates and capacity are plans, not measured sessions. Status Done is a user action, not observed manuscript completion. Deletion/regeneration can remove records.
Schedule engine — implemented WritingScheduleService.GenerateSchedule, BuildGeneratedScheduleItems, CreateTaskEstimate, PreviewRebalanceAsync, ApplyRebalanceAsync. Draft estimates use estimated words / 750 words per hour, or 90 minutes; revision 45, polish 30. Large tasks split across dates and word allocations reconcile across parts. Generation consumes a new available date per task/part; unused daily capacity is not shared between successive scenes. GoalType is stored but does not select a different task-estimation pipeline in GenerateSchedule. Insufficient capacity throws. No dependency graph or overlapping pass planning. Daily boundaries use server DateTime.Today.
Rebalance modes — partly implemented Ask/Automatic/Never values are persisted and editable; rebalance preview and explicit apply exist. The inspected service has no automatic rebalance execution path driven by the Automatic setting. Treat the value as configuration, not proof of a running scheduler. Specification requires approval of suggestions; retire incompatible automatic behaviour rather than adding it.
Measured sessions / sprints / rhythm / provenance — new work Exports.WritingSession and ExportWriterSessionBriefAsync render a scene writing guide. Account onboarding has WritingJourney / writing software answers (OnboardingController, UserOnboardingState). Neither is a measured focus session or the Writer 2.0 journey timeline. Targeted source and Development schema inspection found no implemented Writer 2.0 ledger/session/pass/insight/report subsystem.

Shell, workspaces and displays

Component / status Evidence and reusable behaviour Limitation
Application shell/ribbon — implemented PlotLine/Services/ApplicationNavigation.cs, ApplicationRibbon.cs, ToolbarCommands.cs, RibbonPresentation.cs; Views/Shared/_ApplicationShell.cshtml, _ApplicationNavigation.cshtml, _ApplicationSectionMenus.cshtml; ribbon contribution tag helpers Writer is already a direct navigation destination. ActiveCategory returns writer, but the static category list does not define the six-destination Writer ribbon. Do not diagnose this as absence of all ribbon integration.
Theme/PWA/maximise — implemented wwwroot/css/plotline-theme.css, application-navigation assets, wwwroot/js/application-pwa.js, workspace maximise browser tests; four application themes Reuse existing tokens and controls. wwwroot/service-worker.js explicitly has no fetch handler, offline cache or background sync; installing the PWA does not provide offline manuscript history.
Context/Intent writing desks — implemented WritingController routes /Writing/Context, /Writing/Intent, partials, maps/plots/metrics; Views/Writing/; wwwroot/js/writing-workspace.js; WritingWorkspacePresenceService, WordCompanionFollowHub, Models/WritingWorkspacePresenceModels.cs These are contextual working windows, not duplicate Writer dashboards to remove. Native-target checks include saved state, session, revision and accepted positions. Preserve those checks and deep links.
Companion state/presence — implemented, ephemeral WordCompanionPresenceService uses concurrent dictionaries with 55-second heartbeat timeout; Services/NativeCompanion/NativePresenceStore.cs has 45-second live leases; WordCompanionPresenceMonitor hosted service; native presence hub, _WritingConnectionDetails.cshtml and shell status button Heartbeat time is connection evidence, not focus duration. “Not installed” cannot be established from a missing heartbeat alone.
Display discovery — partially meets specification writing-workspace.js: getScreenLayout, sortScreens, chooseLayout, popupFeatures, openRoleWindow, focusRole. Permission-aware getScreenDetails, manual fallbacks, browser-window registration/focus, localStorage preference persistence. >=3 monitors use a three-screen layout: outer Context/Intent and middle Word. Discovery can enumerate more screens, but semantic roles/profiles/research/spare/topology lifecycle are missing. Word display is a calculated preference, not an implemented OS Word-window placement command.
Charts/drill-down — reuse outside Writer Views/Analytics/Index.cshtml has navigable scene metric charts and raw-row fallback; Views/Timeline/Index.cshtml uses story-position navigation and scene selection Story chronology/narrative order is not writing-calendar history. Reuse interaction/theme patterns without substituting story events for author activity.

Manuscript and native integration

Component / status Evidence / responsibilities Retention and compatibility limits
Office task-pane shell — existing separate integration PlotDirector.WordCompanion/README.md, manifest/template, /word-companion host and wwwroot/js/word-companion-host.js; WordCompanionController, WordCompanionService This is not the native VSTO source. Keep legacy routes/contracts compatible and explicitly identify which source captured evidence.
VSTO Word add-in — source implemented; Windows qualification separate PlotDirector.NativeCompanion/Vsto/WordAdapter.cs, WordChapterRead.cs, WordChapterPositions.cs, ThisAddIn.cs, native ribbon. Word UI-thread COM work, bounded reads, document properties/association, selection/save/close observations and session/revision guards. Revision counter is a local lifecycle/change signal, not Word Track Changes or a complete edit count. Linux cannot certify COM, installer, responsiveness or OS window focus.
Background Windows agent — source implemented PlotDirector.NativeCompanion/Agent/{Program,PipeHost,SessionManager,TrayCoordinator,TrayCoordinator.Chapters,TrayCoordinator.Reuse,CloudGateway,CloudGateway.Authorization,ParagraphSnapshotCache,CompanionStateStore}.cs Pipe sequences, authentication contexts, per-document sessions, bounded caches, captured transfer and retry coordination. Persistent protected state stores installation credentials/preferences/bindings; not an activity log.
Offline queue foundation — unused by production sender Agent/DeferredWorkQueue.cs; only constructor/use references outside its class are in PlotDirector.NativeCompanion/Tests/Program.cs Contains bounded durable scheduling metadata, coalesced per manuscript/scene; no prose. Source comment explicitly says not attached to a server sender. Does not preserve all offline edits or event order.
Native pairing/access — implemented NativeCompanionAuthController, Services/NativeCompanion/{DesktopPairing,NativeInstallationService}.cs; CloudGateway.Authorization; Windows user DPAPI in CompanionStateStore Existing server/account scope, grant renewal/revocation, capability negotiation and security stamp should be extended rather than bypassed.
Import capture — implemented and retained NativeManuscriptCaptureController; Services/NativeCompanion/NativeManuscriptCapture.cs; OnboardingManuscriptCaptures, OnboardingManuscriptCapture procedure; SQL 237 and 239 Original accepted preview payload/hash/time can survive beyond import. Analysis checkpoints are mutable and are not manuscript versions. Only one capture retained in current Development.
Canonical accepted manuscript — implemented and populated Models/ParagraphManuscriptModels.cs; Services/Manuscript/ParagraphManuscriptService.cs, ParagraphManuscriptEngine.cs; Data/ParagraphManuscriptRepository.cs; BookParagraphManuscripts, dbo.ParagraphManuscript; SQL 240 and later replacements 249–250 One accepted JSON payload per book. Full snapshot and selective chapter changes use expected revision/request identity. Scene projections and statistics remain existing authoritative consumer stores; do not introduce a second live manuscript.
Paragraph identities/reconciliation — implemented Protocol/Manuscript/ParagraphIdentity.cs, ParagraphDelta.cs; GUID occurrences, Word native paraId hints, text fingerprints, neighbour/context matching, moves, ambiguity, removals and retained evidence anchors Native paraId is a hint, not permanent identity. PreviousText is a latest-comparison aid; removed paragraphs are not a durable tombstone stream. Layout Undo stores assignments, not old prose.
Chapter detection and acceptance — implemented ChapterCheckpointEngine.{Build,Validate,MergeChapter}, ChapterSyncService.{Manifest,Accept,Reuse,Finish,Repair}; BookChapterSync, BookChapterReuse; SQL 243, 245–251; BookChapterValidations Durable checkpoint ≠ live position validation ≠ writing-pass completion. Explicit review for cross-boundary structural uncertainty. Validations expire after 12 hours and are updated/pruned, not immutable audit events.
Scene source/statistics — implemented SceneManuscriptSources, source projections in ParagraphManuscript, ManuscriptTextStatisticsService and deterministic recalculation Latest text/counts support current metrics and Story Intelligence; no gross historical addition/deletion ledger. Formatting absent from plain-text capture cannot be reconstructed.
Reader — implemented; documented Development delivery ManuscriptReaderController, ManuscriptReaderService.{Read,Check,Project}, Views/ManuscriptReader/; Docs/ManuscriptReader/{Phase1,LiveUpdates}.md GET-only, accepted source only, chapter navigation, focus reading, encoded selectable prose, refresh without reimport. Whole-book JSON still read server-side. Sync and capture timestamps are explicitly different. No native editor yet.

History, relationships, access and background work

  • Projects → Books → Chapters → Scenes remains the relational hierarchy. Canonical paragraph state also stores document/manuscript identity, paragraph GUIDs, chapter heading GUIDs, scene GUIDs and scene canonical IDs. Captured paragraph ordinals and physical Word offsets are not durable entity identity. Document renames must preserve manuscript identity; copied documents with identical IDs need conflict treatment.
  • ProjectActivity / ProjectAudit_Record / ProjectActivity_Create record selected entity operations with user, project, type, entity and receipt timestamp. ProjectActivityService.RecordAsync and explicit callers in CoreServices.cs establish coverage. This is not a universal SQL change log; native sync does not automatically become a recorded writing event. Source migration 046 has later extensions (e.g. merge/export activity); inspect current constraints rather than treating its original type list as exhaustive.
  • ProjectRestorePointService stores complete project backup JSON through IProjectExportService. Manual creation is limited to 10 existing points; pre-restore safety backups also exist. Deletion/download are available. Services/Manuscript/ParagraphRecovery.cs validates and carries paragraph manuscripts through recovery. These are discrete recovery states, not periodic writing history. Book/project restore and transfer must be updated deliberately for a future ledger.
  • ProjectCollaboratorsController, ProjectCollaborationService in CoreServices.cs, ProjectAccessServices.cs, ProjectAccessFilter.cs, SQL 045: owner-managed invitations and project-wide Owner/Collaborator access. All 14 Development access rows were Owner; no live collaboration journey was verified. Existing collaborators are not automatically restricted to assigned chapters or private-note exclusions.
  • SubscriptionService.GetEffectiveEntitlementAsync, SubscriptionEnforcementFilter, SubscriptionFeature, SubscriptionRepository, SQL 201_SubscriptionEntitlementEnforcement.sql and docs/subscription-entitlements.md are the central entitlement path. Inactive accounts retain reading/export but unsafe requests are blocked. Future ingestion must define denied-write/offline recovery semantics and avoid silently losing queued activity. Do not hard-code tier names.
  • UserOnboardingState, application toolbar/bar preferences, browser-local display settings and native protected CompanionPreferences are different preference scopes. None is a versioned Writing Rhythm profile. Use the existing account/theme preferences; add writing-specific settings with explicit account/book/device scope.
  • Hosted presence monitoring and the native agent's periodic polling are operational coordination. Existing import/analysis workers are not focus-session processors. Story Health should consume persisted warnings/metrics/review summaries under docs/story-intelligence/single-system-runtime.md and Docs/StoryIntelligence_ExceptionReview.md; no raw-analysis reconstruction or AI re-run on dashboard GETs.

Tests and operational evidence

Existing relevant tests: PlotLine.Tests/Paragraph{Manuscript,Workflow,Chapter,Backup,View}Tests.cs, ChapterSynchronisationTests.cs, ChapterStructuralContentTests.cs, ManuscriptReaderTests.cs, WritingIntegrationTests.cs, Native{Companion,Workflow,TrayIntegration,Installation,ManuscriptCapture,CaptureLifetime}Tests.cs, SubscriptionEntitlementTests.cs, native portable tests, SQL tests and browser suites listed in the implementation plan. Existing tests include source-contract assertions; these are not substitutes for runtime/native acceptance.

Docs/WordCompanion/WindowsHandover/ distinguishes source candidates, Atlas qualification and Windows results. Docs/ManuscriptReader/Phase1.md explicitly leaves real Word-to-Reader and Windows installed-PWA acceptance unverified. Those limitations remain here; historical reports are not a new test run.

Gate/deployment procedure was inspected in Docs/Codex/Deployment.md solely for the requested delivery-flow assessment. Future Development rollout requires idle import/analysis guard, verified migration prerequisites, build identity, service/HTTPS/authenticated smoke checks and an application rollback compatible with forward-only schema additions. No deployment took place in this audit.