test: verify connected map routes and floor plan transfer

This commit is contained in:
Nick Beckley 2026-11-04 05:42:52 +00:00
parent a880e1c973
commit 6f61d7d382
5 changed files with 25 additions and 7 deletions

View File

@ -54,7 +54,7 @@ PlotEventTargetPlotLines,1,1,1,Stored field comparison passed; only populated va
MapReferenceImages,1,1,1,Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
MapJourneyNotes,1,1,1,Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
StoryMaps,2,2,2,Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
MapFeatures,2,2,2,Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
MapFeatures,4,4,4,Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
MapRelationships,1,1,1,Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
Books,1,1,1,Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
Chapters,1,1,1,Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present

1 Collection SourceRows CopyRows InPlaceRows Verification
54 MapReferenceImages 1 1 1 Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
55 MapJourneyNotes 1 1 1 Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
56 StoryMaps 2 2 2 Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
57 MapFeatures 2 4 2 4 2 4 Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
58 MapRelationships 1 1 1 Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
59 Books 1 1 1 Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present
60 Chapters 1 1 1 Stored field comparison passed; only populated values exercised; Exact uploaded bytes and independent paths compared where present

View File

@ -54,7 +54,7 @@ PlotEventTargetPlotLines,PlotEventTargetPlotLines,1,1,0,0
MapReferenceImages,MapReferenceImages,1,1,0,0
MapJourneyNotes,MapJourneyNotes,1,1,0,0
StoryMaps,StoryMaps,2,2,0,0
MapFeatures,MapFeatures,2,2,0,0
MapFeatures,MapFeatures,4,4,0,0
MapRelationships,MapRelationships,1,1,0,0
Books,Books,1,1,0,0
Chapters,Chapters,1,1,0,0

1 Table Collection OwnedDatabaseRows ExportedRows ExtraSharedRows MissingOwnedRows
54 MapReferenceImages MapReferenceImages 1 1 0 0
55 MapJourneyNotes MapJourneyNotes 1 1 0 0
56 StoryMaps StoryMaps 2 2 0 0
57 MapFeatures MapFeatures 2 4 2 4 0 0
58 MapRelationships MapRelationships 1 1 0 0
59 Books Books 1 1 0 0
60 Chapters Chapters 1 1 0 0

View File

@ -330,3 +330,9 @@ The shared catalogue is selected without project ownership by the runtime and ha
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.

View File

@ -46,6 +46,7 @@ INSERT dbo.LocationRelationships(FromLocationID,ToLocationID,LocationRelationshi
SELECT @location,@otherLocation,MIN(LocationRelationshipTypeID),1,1,N'Connected rooms 雨' FROM dbo.LocationRelationshipTypes;
INSERT dbo.FloorPlans(ProjectID,Name,Description,LocationID) VALUES(@project,N'Layout Ω',N'Floor plan café',@location);
SET @floorPlan=SCOPE_IDENTITY();
UPDATE dbo.MapFeatures SET FloorPlanID=@floorPlan WHERE MapID=@map AND FeatureID=@firstFeatureID;
INSERT dbo.FloorPlanFloors(FloorPlanID,Name,SortOrder,GridWidth,GridHeight,LocationID,BackgroundOpacity,BackgroundScale,BackgroundOffsetX,BackgroundOffsetY,Description)
VALUES(@floorPlan,N'Ground 雪',1,30,20,@location,.6,1.5,3,4,N'Floor notes Ω');
SET @floor=SCOPE_IDENTITY();
@ -80,8 +81,8 @@ INSERT dbo.ScenarioValidationRuns(ScenarioID,CompletedDate,WarningCount) VALUES(
SET @scenarioValidation=SCOPE_IDENTITY();
INSERT dbo.ScenarioWarnings(ScenarioValidationRunID,ScenarioID,SceneID,EntityType,EntityID,WarningTypeName,SeverityName,Message,Details)
VALUES(@scenarioValidation,@scenario,@scene,N'Character',@character,N'SyntheticWarning',N'Warning',N'Scenario warning 雨',N'Alternative detail café');
INSERT dbo.MapJourneyNotes(MapID,CharacterID,FromSceneID,ToSceneID,TravelMethod,TypicalMinutes)
VALUES(@map,@character,@scene,@secondScene,N'Walking café',18);
INSERT dbo.MapJourneyNotes(MapID,CharacterID,FromSceneID,ToSceneID,RouteFeatureID,TravelMethod,TypicalMinutes)
VALUES(@map,@character,@scene,@secondScene,@routeFeatureID,N'Walking café',18);
UPDATE dbo.StoryMaps SET AppearanceJson=JSON_MODIFY(AppearanceJson,'$.extension',JSON_QUERY(N'{"texture":"雨"}')),
ReferenceJson=JSON_MODIFY(ReferenceJson,'$.extension',JSON_QUERY(N'{"source":"café"}')) WHERE MapID=@map;
UPDATE dbo.Locations SET DetectionPriority=7,ExcludeFromCompanionDetection=1 WHERE LocationID=@otherLocation;

View File

@ -121,14 +121,16 @@ internal static class ProjectTransferDatabaseTests
document.Map.ReferenceJson=JsonSerializer.Serialize(new MapReferencePlacement { ImageID=image.ImageID, X=15, Y=25, Width=640, Height=480, Rotation=12, Opacity=.45 });
var first=new MapFeature { MapID=map, Name="Port Ω", Type="Town", LocationID=location, X=12, Y=34, LabelX=5, LabelY=6, Notes="Unicode 雨", GeometryJson="{}" };
var second=new MapFeature { MapID=map, Name="Island 雪", GeometryClass="Area", Type="Island", X=56, Y=78, Width=160, Height=80, GeometryJson="{\"points\":[[0,0],[1,1],[0,1]]}" };
document.Features=[first,second];
var destination=new MapFeature {MapID=map,Name="Hidden-label destination 雨",Type="Town",X=300,Y=180,IsPlaced=false,IsLocked=true,ShowLabel=false,LabelX=-17,LabelY=23,Notes="Unplaced locked planning marker Ω"};
var route=new MapFeature {MapID=map,Name="Connected trail Ω",Type="Trail",GeometryClass="Path",Layer="Routes",X=12,Y=34,Width=288,Height=146,StartFeatureID=first.FeatureID,EndFeatureID=destination.FeatureID,LabelX=21,LabelY=-13,GeometryJson="{\"points\":[[0,0],[0.25,0.7],[1,1]],\"extension\":{\"surface\":\"雪\"}}",Notes="Connected route with opaque geometry metadata 雨"};
document.Features=[first,second,destination,route];
document.Relationships=[new() { MapID=map, SourceID=first.FeatureID, TargetID=second.FeatureID, Direction="NE", MeasuredDistance=12.5m, Unit="km", Notes="Synthetic relationship café" }];
await maps.SaveAsync(document,user);
await maps.CreateAsync(new() { ProjectID=project, Name="Child map 雨", Kind="Region", ParentMapID=map, ParentFeatureID=first.FeatureID },user);
var plan=await db.ExecuteScalarAsync<int>("INSERT dbo.WritingPlans(UserID,ProjectID,BookID,PlanName,GoalType,StartDate,DeadlineDate,AvailableDaysJson,SessionLengthMinutes) VALUES(@user,@project,@book,N'Synthetic drafting plan',N'Draft','2026-11-01','2026-12-01',N'[1,3,5]',45);SELECT CONVERT(int,SCOPE_IDENTITY());",new{user,project,book});
await db.ExecuteAsync("INSERT dbo.WritingScheduleItems(WritingPlanID,SceneID,ScheduledDate,TaskType,ScheduleStatus,Notes) VALUES(@plan,@scene,'2026-11-03',N'Draft',N'Pending',N'Synthetic task café');",new{plan,scene});
await db.ExecuteAsync("UPDATE dbo.Books SET CreatedByUserID=@user,ModifiedByUserID=@user,CreatedDateUTC='2026-09-01',ModifiedDateUTC='2026-10-01' WHERE BookID=@book;UPDATE dbo.Scenes SET CreatedByUserID=@user,ModifiedByUserID=@user,CreatedDateUTC='2026-09-01',ModifiedDateUTC='2026-10-01' WHERE SceneID=@scene;",new{user,book,scene});
var planningParameters=new DynamicParameters(new{project,book,chapter,scene,revision,timeMode,confidence,location,asset,kind,character,line,thread,threadEvent,map,user,observer,relationship,relationshipType,relationshipState,eventType,plotEventType}){RemoveUnused=false};
var planningParameters=new DynamicParameters(new{project,book,chapter,scene,revision,timeMode,confidence,location,asset,kind,character,line,thread,threadEvent,map,user,observer,relationship,relationshipType,relationshipState,eventType,plotEventType,firstFeatureID=first.FeatureID,routeFeatureID=route.FeatureID}){RemoveUnused=false};
await db.ExecuteAsync(await File.ReadAllTextAsync("PlotLine.Tests/Fixtures/ProjectTransferPlanning.sql"),planningParameters);
async Task<string> SaveFile(string folder,string name,byte[] bytes)
{
@ -234,6 +236,9 @@ internal static class ProjectTransferDatabaseTests
root=>root["Data"]!["StoryIntelligenceReviewCandidates"]![0]!["Module"]="Assets",
root=>root["Data"]!["StoryIntelligenceReviewCandidates"]![0]!["CandidatePayloadJson"]=null,
root=>root["Data"]!["StoryIntelligenceReviewCandidates"]![0]!["CandidatePayloadJson"]="[]",
root=>root["Data"]!["MapJourneyNotes"]![0]!["RouteFeatureID"]=root["Data"]!["MapFeatures"]!.AsArray().First(x=>x!["GeometryClass"]!.GetValue<string>()=="Area")!["FeatureID"]!.DeepClone(),
root=>root["Data"]!["MapFeatures"]!.AsArray().First(x=>x!["GeometryClass"]!.GetValue<string>()=="Path")!["StartFeatureID"]=Guid.NewGuid().ToString(),
root=>root["Data"]!["MapFeatures"]![0]!["FloorPlanID"]=-12345,
root=>root["Data"]!["StoryMemoryIllustrationAssignments"]![0]!["EntityID"]=-12345,
root=>root["Data"]!["StoryMemoryIllustrationAssignments"]![0]!["EntityType"]="Unsupported",
root=>root["Data"]!["StoryMemoryIllustrationDemands"]![0]!["ImportSessionID"]=-12345,
@ -317,11 +322,17 @@ internal static class ProjectTransferDatabaseTests
foreach(var entry in copiedFilterIds)Check(copiedFilter.GetProperty(entry.Key).GetInt32()==entry.Value,"Copied timeline filter "+entry.Key);
var restoredMap=after.Data.StoryMaps.Single(x=>x.Name=="Synthetic map 雨");
Check(restoredMap.MapID!=map && after.Data.StoryMaps.Single(x=>x.Name=="Child map 雨").ParentMapID==restoredMap.MapID,"Map hierarchy is remapped.");
Check(after.Data.MapFeatures.Count==2 && after.Data.MapFeatures.Single(x=>x.Name=="Island 雪").GeometryJson==second.GeometryJson,"Map shapes and Unicode retained.");
Check(after.Data.MapFeatures.Count==4 && after.Data.MapFeatures.Single(x=>x.Name=="Island 雪").GeometryJson==second.GeometryJson,"Map shapes and Unicode retained.");
Check(after.Data.MapRelationships.Single().MeasuredDistance==12.5m && after.Data.MapRelationships.Single().MapID==restoredMap.MapID,"Map relationship content and map reference retained.");
var restoredImage=after.Data.MapReferenceImages.Single();
Check(restoredImage.ImageID!=image.ImageID && restoredImage.ImageData!.SequenceEqual(sourceImageBytes),"Embedded image ID remapped and exact bytes retained.");
Check(JsonDocument.Parse(restoredMap.ReferenceJson).RootElement.GetProperty("extension").GetProperty("source").GetString()=="café","Unknown reference-image placement properties survive copied image remapping.");
var copiedTrail=after.Data.MapFeatures.Single(x=>x.Name=="Connected trail Ω");
var copiedDestination=after.Data.MapFeatures.Single(x=>x.Name=="Hidden-label destination 雨");
var copiedPort=after.Data.MapFeatures.Single(x=>x.Name=="Port Ω");
Check(copiedTrail.StartFeatureID==copiedPort.FeatureID && copiedTrail.EndFeatureID==copiedDestination.FeatureID && copiedTrail.GeometryJson==route.GeometryJson,"Connected path endpoints and opaque geometry survive copy.");
Check(after.Data.MapJourneyNotes.Single().RouteFeatureID==copiedTrail.FeatureID && copiedPort.FloorPlanID==after.Data.FloorPlans.Single().FloorPlanID,"Journey route and map-to-floor-plan links follow copied graph.");
Check(!copiedDestination.IsPlaced && copiedDestination.IsLocked && !copiedDestination.ShowLabel && copiedDestination.LabelX==-17 && copiedDestination.LabelY==23,"Hidden labels and unplaced locked planning markers survive copy.");
Check(MapAppearanceJson.Read<MapReferencePlacement>(restoredMap.ReferenceJson).ImageID==restoredImage.ImageID,"Map image placement references the new embedded asset.");
Check((await maps.GetAsync(project,map,user))!.Map.Name=="Synthetic map 雨","Original project remains unchanged.");
Check(after.Data.Books.Single().StoryEra=="Future era" && after.Data.Books.Single().PrimaryLocaleCode=="en-GB" && after.Data.Books.Single().UsesExplicitScenes,"Book era and locale preserved.");