diff --git a/Docs/Sprints/2026-11-03-phase2-deployment-gate.sql b/Docs/Sprints/2026-11-03-phase2-deployment-gate.sql index e627b539..27593338 100644 --- a/Docs/Sprints/2026-11-03-phase2-deployment-gate.sql +++ b/Docs/Sprints/2026-11-03-phase2-deployment-gate.sql @@ -2,12 +2,12 @@ IF DB_NAME() <> N'PlotDirector_Development' THROW 51000, 'Refusing restart inspection outside PlotDirector_Development.', 1; DECLARE @Active int = (SELECT COUNT(*) FROM dbo.StoryIntelligenceRuns WHERE Status IN ('Pending','Queued','Running','Processing')) + -(SELECT COUNT(*) FROM dbo.StoryIntelligenceJobs WHERE Status IN ('Pending','Queued','Running','Processing')) + +(SELECT COUNT(*) FROM dbo.StoryIntelligenceJobs WHERE Status IN ('Pending','Queued','Running','Processing','Preparing','ReadingScenes','AnalysingCharacters','AnalysingRelationships','AnalysingLocations','AnalysingAssets','AnalysingTimeline','Finalising')) + (SELECT COUNT(*) FROM dbo.WholeBookPlotSynthesisRuns WHERE Status IN ('Pending','Queued','Running','Processing')) + (SELECT COUNT(*) FROM dbo.CharacterEnrichmentRuns WHERE Status IN ('Pending','Queued','Running','Processing')) + (SELECT COUNT(*) FROM dbo.StoryIntelligenceImportCommits WHERE Status IN ('Pending','Queued','Running','Processing')) + (SELECT COUNT(*) FROM dbo.StoryIntelligenceReviewCandidateGenerations WHERE Status IN ('Pending','Queued','Running','Processing','Preparing')) + -(SELECT COUNT(*) FROM dbo.StoryIntelligenceBookPipelines WHERE Status IN ('Pending','Queued','Running','Processing')); +(SELECT COUNT(*) FROM dbo.StoryIntelligenceBookPipelines WHERE Status IN ('Pending','Queued','Running','Processing','InProgress')); IF @Active > 0 THROW 51000, 'Deployment deferred: background work is active.', 1; IF EXISTS (SELECT 1 FROM sys.dm_exec_requests r CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) t WHERE r.database_id=DB_ID() AND r.session_id<>@@SPID AND (t.text LIKE '%Import%' OR t.text LIKE '%Synthesis%')) diff --git a/Docs/Sprints/2026-11-03-phase2.md b/Docs/Sprints/2026-11-03-phase2.md index 27d522c8..39406026 100644 --- a/Docs/Sprints/2026-11-03-phase2.md +++ b/Docs/Sprints/2026-11-03-phase2.md @@ -242,3 +242,7 @@ Confirmed another three omitted persistent sets: Core Import location reviews, a 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.