Establish main Relationships isolation contract and scalable baseline fixtures

This commit is contained in:
Nick Beckley 2026-11-26 22:23:09 +00:00
parent 90ec7bcbe1
commit 20fcbe7872
3 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,13 @@
# Main Relationships enhancement — investigation and isolation contract
Scope: main `RelationshipMap/Index` only; Development deployment only. Context and Character Details are protected.
The main view uses its own `_GraphScripts` Cytoscape renderer and `relationship-workspace.js`. No other view includes that graph partial. Context and Character Details use their existing SVG components (`context-relationship-layout.js` and their own renderers). Those scripts, views, styles, controllers and default settings will remain unchanged. Before/after comparisons use the same synthetic data, focus, theme, scene and dimensions, plus existing protected interaction regressions.
Reuse: canonical RelationshipMap service/state resolver and editor; author-reference family definitions from `ContextRelationshipLenses.Family`; unchanged family layout algorithm via an explicit main-page include; canonical CharacterAttributes Directory/Assign/Undo endpoints and shared definitions; application context menus, toast actions, Scene Explorer and workspace dividers. New behaviour and storage stay under `#rwApp` / main-workspace scripts. No new graph library, AI calls, database store or shared rendering default.
Existing main state: local v1 project/book layout, manual extra/removed nodes, focus/zoom/pan, 250ms debounce; Cytoscape circle/COSE; three importance palettes, right Details, legend, Scene Explorer, Map/List, PWA ribbon and maximise. Current gaps include Ctrl-wheel centre zoom, single-network layouts, hidden-but-not-removed membership, no pin/layout undo/presets, and no importance assignment between groups. Existing two-sided workspace dividers are already available and will be reused with author/project scoping and no scene-resolution calls on resize.
Plan/checkpoints: A baseline/isolation; B scoped interaction/menus; C membership/pins/layout undo; D shared importance assignment; E clustered/radial/family/importance layouts; F routing; G presets/history stability; H persistence/dividers; I build/full regression, rendered browser/PWA, all themes, protected comparisons, performance, documentation and Development smoke/deployment. Do not deploy an incomplete checkpoint. Preserve unrelated investigation files and existing author data.
Acceptance evidence and measured results will be appended after implementation. The user attachment remains the authoritative checklist, including every section 21 criterion and requested screenshots. Any unverified or incomplete requirement must be labelled explicitly in the final matrix.

View File

@ -35,6 +35,15 @@ internal static class RelationshipWorkspaceTests
"GetAsync" => Task.FromResult<Project?>(new() { ProjectID = 7, ProjectName = "Cast fixture" }),
_ => throw new Exception(m)
}), Repository(data));
public static async Task<RelationshipMapViewModel> LargeFixture(int count,string network)
{
var original=Data(); var cast=Enumerable.Range(1,count).Select(i=>new Character{CharacterID=i,ProjectID=7,CharacterName=$"Person {i:000}",CharacterImportance=i%4==0?10:i%4==1?6:i%4==2?2:null}).ToList();
var pairs=new List<(int A,int B,string Type,string Category)>();
if(network=="family") { for(var i=2;i<=count;i++)pairs.Add((Math.Max(1,i/2),i,i%7==0?"Adoptive Parent":"Parent","Family")); }
else if(network!="isolated") { for(var i=1;i<=count;i++)for(var step=1;step<=(network=="dense"?6:network=="clusters"?3:1);step++){var target=i+step;if(target<=count&&(network!="clusters"||i/12==target/12||i%12==0&&step==1)&&(network!="sparse"||i%4==0))pairs.Add((i,target,"Friend","Friendship"));} }
var relationships=pairs.Select((p,i)=>new CharacterRelationship{CharacterRelationshipID=i+1,ProjectID=7,CharacterAID=p.A,CharacterBID=p.B,CharacterAName=$"Person {p.A:000}",CharacterBName=$"Person {p.B:000}",RelationshipTypeID=1,RelationshipTypeName=p.Type,RelationshipCategoryName=p.Category,IsInitialRelationship=true,InitialRelationshipStateID=1,InitialRelationshipStateName="Established",IsReciprocal=p.Category!="Family"}).ToList();var data=new RelationshipMapData{Books=original.Books,Chapters=original.Chapters,Scenes=original.Scenes,Characters=cast,Relationships=relationships,RelationshipCategories=original.RelationshipCategories,RelationshipEvents=[]};
return (await Service(data).GetAsync(7,null,null,null,null,true))!;
}
public static async Task<RelationshipMapViewModel> Fixture() => (await Service(Data()).GetAsync(7, null, null, null, null, true))!;
public static void StateAndEditing() => Run().GetAwaiter().GetResult();
private static async Task Run()

View File

@ -735,7 +735,7 @@ internal static class ToolbarBrowserHost
}
if (context.Request.Query["page"] == "relationships")
{
var relationships = await RelationshipWorkspaceTests.Fixture();
var relationships = int.TryParse(context.Request.Query["cast"],out var castSize) ? await RelationshipWorkspaceTests.LargeFixture(Math.Clamp(castSize,1,200),context.Request.Query["network"].ToString()) : await RelationshipWorkspaceTests.Fixture();
surface = await Render("RelationshipMap/Index", relationships);
surface += await Render("RelationshipMap/_GraphScripts", relationships);
}