From 9db13a7fd6c911b5b4369b51525882b12ff4deb4 Mon Sep 17 00:00:00 2001 From: Nick Beckley Date: Sun, 26 Jul 2026 14:30:36 +0000 Subject: [PATCH] Cap only active image demand jobs --- PlotLine.Tests/Program.cs | 2 ++ PlotLine/Services/StoryMemoryServices.cs | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PlotLine.Tests/Program.cs b/PlotLine.Tests/Program.cs index ede9316..718cb88 100644 --- a/PlotLine.Tests/Program.cs +++ b/PlotLine.Tests/Program.cs @@ -1137,6 +1137,8 @@ static void Phase21UEnforcesAliasAgeSemanticAndUiResetRules() Assert(storyMemory.Contains("QueueAsync(planned.IllustrationLibraryItemID", StringComparison.Ordinal), "Durable Story Memory demand must queue generated library items for the worker."); Assert(storyMemory.Contains("demand.IllustrationLibraryItemId", StringComparison.Ordinal), "Demand fallback assignments must retain queued item IDs so generated images can attach later."); Assert(storyMemory.Contains("categoryCap", StringComparison.Ordinal), "Automatic demand generation must distribute the queue cap across characters, locations and assets."); + Assert(storyMemory.Contains("or IllustrationLibraryStatuses.Generating);", StringComparison.Ordinal), "Demand generation cap must count only in-flight jobs, not already generated preserved images."); + Assert(!storyMemory.Contains("or IllustrationLibraryStatuses.Generated\r\n or IllustrationLibraryStatuses.Approved", StringComparison.Ordinal), "Generated or approved preserved images must not permanently fill the demand queue cap."); Assert(storyMemory.Contains("evidence.HairColour", StringComparison.Ordinal), "Character demand keys/specs must include durable hair colour evidence."); Assert(storyMemory.Contains("Maximum one primary POV", StringComparison.Ordinal) || storyMemory.Contains("ResolveScenePov", StringComparison.Ordinal), "Story Memory must use a single POV resolver."); Assert(!script.Contains("renderOverflowSummary", StringComparison.Ordinal), "Side panels must not use hidden '+N more' overflow controls."); diff --git a/PlotLine/Services/StoryMemoryServices.cs b/PlotLine/Services/StoryMemoryServices.cs index 6fdabac..3fc37fa 100644 --- a/PlotLine/Services/StoryMemoryServices.cs +++ b/PlotLine/Services/StoryMemoryServices.cs @@ -920,12 +920,10 @@ public sealed class StoryMemoryService( && item.StableCode.StartsWith("demand-", StringComparison.OrdinalIgnoreCase) && item.Status is IllustrationLibraryStatuses.Planned or IllustrationLibraryStatuses.Queued - or IllustrationLibraryStatuses.Generating - or IllustrationLibraryStatuses.Generated - or IllustrationLibraryStatuses.Approved); + or IllustrationLibraryStatuses.Generating); if (queuedDemandItems >= categoryCap) { - return new(null, null, "DemandRecorded", $"No compatible illustration exists; demand recorded but {specification.Category.ToLowerInvariant()} queue cap {categoryCap:N0} has been reached."); + return new(null, null, "DemandRecorded", $"No compatible illustration exists; demand recorded but {specification.Category.ToLowerInvariant()} in-flight generation cap {categoryCap:N0} has been reached."); } }