Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Retire frontend legacy mesh scene contract
Yuechen Li1eef5a8eb8f5
diff --git a/aetheris.client/src/App.tsx b/aetheris.client/src/App.tsxindex 0dff67e2..0f7dd484 100644--- a/aetheris.client/src/App.tsx+++ b/aetheris.client/src/App.tsx@@ -16,7 +16,6 @@ import {type DiagnosticDto,type PickHitDto,type DisplayPreparationResponseDto,- type TessellationResponseDto,} from './api/aetherisApi';import { StepImportDropzone } from './components/StepImportDropzone';import { Button } from './components/ui/button';@@ -43,7 +42,6 @@ function App() {const [bodyIds, setBodyIds] = useState<string[]>([]);const [occurrences, setOccurrences] = useState<BodyOccurrenceSummaryDto[]>([]);const [activeBodyId, setActiveBodyId] = useState<string | null>(null);- const [tessellation, setTessellation] = useState<TessellationResponseDto | null>(null);const [displayPreparation, setDisplayPreparation] = useState<DisplayPreparationResponseDto | null>(null);const [status, setStatus] = useState<RequestStatus>('idle');const [statusMessage, setStatusMessage] = useState<string>('Ready. Create a document to begin.');@@ -80,7 +78,6 @@ function App() {setBodyIds([]);setActiveBodyId(null);setOccurrences([]);- setTessellation(null);setDisplayPreparation(null);setPickStatus('idle');setPickMessage('Click in the viewport to run nearest-hit pick.');@@ -167,13 +164,11 @@ function App() {try {const preparedDisplay = await prepareBodyDisplay(documentId, selected);setDisplayPreparation(preparedDisplay);- setTessellation(preparedDisplay.tessellationFallback);return null;} catch (error) {const apiError = error instanceof ApiError? error: new ApiError((error as Error).message || 'Unexpected display preparation error.', []);- setTessellation(null);setDisplayPreparation(null);if (!suppressDisplayErrors) {throw apiError;@@ -182,7 +177,6 @@ function App() {return apiError;}} else {- setTessellation(null);setDisplayPreparation(null);}@@ -234,7 +228,6 @@ function App() {const preparedDisplay = await prepareBodyDisplay(documentId, nextBodyId);setActiveBodyId(nextBodyId);setDisplayPreparation(preparedDisplay);- setTessellation(preparedDisplay.tessellationFallback);setPickStatus('idle');setPickMessage('Active body changed. Click in viewport to pick nearest hit.');setPickDiagnostics([]);@@ -276,7 +269,6 @@ function App() {await runAction('Refresh display data', async () => {const preparedDisplay = await prepareBodyDisplay(documentId, activeBodyId);setDisplayPreparation(preparedDisplay);- setTessellation(preparedDisplay.tessellationFallback);});setIsRefreshing(false);}, [activeBodyId, documentId, runAction]);@@ -500,7 +492,15 @@ function App() {}, [activeBodyId, documentId]);const displayScene = useMemo(() => buildDisplaySceneData(displayPreparation), [displayPreparation]);- const sceneData = displayScene.sceneData;+ const displayRenderableCounts = useMemo(() => {+ const renderables = displayScene.displayScene?.renderables ?? [];+ return {+ meshFaces: renderables.filter((renderable) => renderable.kind === 'MeshPatch').length,+ wireEdges: renderables+ .filter((renderable) => renderable.kind === 'WirePatch')+ .reduce((count, renderable) => count + renderable.wires.length, 0),+ };+ }, [displayScene.displayScene]);const nearestHit = pickHits[0] ?? null;const highlightedFaceId = nearestHit?.entityKind === 'Face' ? nearestHit.faceId : null;const highlightedEdgeId = nearestHit?.entityKind === 'Edge' ? nearestHit.edgeId : null;@@ -602,7 +602,6 @@ function App() {</div><AetherisViewportdisplayScene={displayScene.displayScene}- sceneData={sceneData}highlightedFaceId={highlightedFaceId}highlightedEdgeId={highlightedEdgeId}showGrid={isGridVisible}@@ -684,15 +683,15 @@ function App() {<p><strong>Definition ID:</strong> {activeOccurrence?.definitionId ?? 'None'}</p><p><strong>Occurrence ID:</strong> {activeBodyId ?? 'None'}</p><p><strong>Display lane:</strong> {displayPreparation?.lane ?? 'None'}</p>- <p><strong>Display status:</strong> {displayPreparation?.status ?? 'None'}</p>+ <p><strong>Display status:</strong> {displayScene.displayScene?.status ?? 'None'}</p>{displayPreparation?.status === 'Partial' ? <p role="status">Import succeeded. Display partial: display degraded: {displayPreparation.faces?.filter((face) => face.status === 'WireframeOnly').length ?? 0} wire-only face(s), {displayPreparation.faces?.filter((face) => face.status === 'DiagnosticOnly').length ?? 0} diagnostic-only face(s).</p> : null}<p><strong>Render path:</strong> {displayScene.renderPath}</p><p><strong>Analytic faces:</strong> {displayPreparation?.analyticPacket.analyticFaces.length ?? 0}</p><p><strong>Fallback faces:</strong> {displayPreparation?.analyticPacket.fallbackFaces.length ?? 0}</p><p><strong>Wire-only faces:</strong> {displayPreparation?.faces?.filter((face) => face.status === 'WireframeOnly').length ?? 0}</p><p><strong>Diagnostic-only faces:</strong> {displayPreparation?.faces?.filter((face) => face.status === 'DiagnosticOnly').length ?? 0}</p>- <p><strong>Face count:</strong> {tessellation?.facePatches.length ?? 0}</p>- <p><strong>Edge count:</strong> {tessellation?.edgePolylines.length ?? 0}</p>+ <p><strong>Face count:</strong> {displayRenderableCounts.meshFaces}</p>+ <p><strong>Edge count:</strong> {displayRenderableCounts.wireEdges || displayScene.displayScene?.legacyCompatibility?.edgePolylineCount || 0}</p><p><strong>Shell count:</strong> {activeBodyId ? 1 : 0}</p></section></>@@ -793,14 +792,14 @@ function App() {<p><strong>Active occurrence ID:</strong> {activeBodyId ?? 'None'}</p><p><strong>Occurrence count:</strong> {bodyIds.length}</p><p><strong>Display lane:</strong> {displayPreparation?.lane ?? 'None'}</p>- <p><strong>Display status:</strong> {displayPreparation?.status ?? 'None'}</p>+ <p><strong>Display status:</strong> {displayScene.displayScene?.status ?? 'None'}</p><p><strong>Render path:</strong> {displayScene.renderPath}</p><p><strong>Analytic faces:</strong> {displayPreparation?.analyticPacket.analyticFaces.length ?? 0}</p><p><strong>Fallback faces:</strong> {displayPreparation?.analyticPacket.fallbackFaces.length ?? 0}</p><p><strong>Wire-only faces:</strong> {displayPreparation?.faces?.filter((face) => face.status === 'WireframeOnly').length ?? 0}</p><p><strong>Diagnostic-only faces:</strong> {displayPreparation?.faces?.filter((face) => face.status === 'DiagnosticOnly').length ?? 0}</p>- <p><strong>Face patches:</strong> {tessellation?.facePatches.length ?? 0}</p>- <p><strong>Edge polylines:</strong> {tessellation?.edgePolylines.length ?? 0}</p>+ <p><strong>Face patches:</strong> {displayRenderableCounts.meshFaces}</p>+ <p><strong>Edge polylines:</strong> {displayRenderableCounts.wireEdges || displayScene.displayScene?.legacyCompatibility?.edgePolylineCount || 0}</p><h3 className="section-title section-title--sub">Pick Diagnostics (active body only)</h3><p><strong>Pick status:</strong> {pickStatus}</p><p><strong>Pick message:</strong> {pickMessage}</p>diff --git a/aetheris.client/src/__tests__/AetherisViewport.test.tsx b/aetheris.client/src/__tests__/AetherisViewport.test.tsxindex 2fe5c7cf..66ff84c6 100644--- a/aetheris.client/src/__tests__/AetherisViewport.test.tsx+++ b/aetheris.client/src/__tests__/AetherisViewport.test.tsx@@ -24,7 +24,7 @@ vi.mock('three', async () => {};});-const baseScene: DisplayScene = { renderables: [], sourceAuthority: 'BRep', displayAuthority: 'DisplayIR', displayLanes: [], displayStatus: 'Complete' };+const baseScene: DisplayScene = { renderables: [], sourceAuthority: 'BRep', displayAuthority: 'DisplayIR', lanes: [], diagnostics: [], status: 'Complete' };describe('AetherisViewport', () => {it('RendersMeshPatch', () => {@@ -32,7 +32,7 @@ describe('AetherisViewport', () => {...baseScene,renderables: [{ kind: 'MeshPatch', faceId: 1, surfaceKind: 'Plane', status: 'Mesh', patchKind: 'MeshPatch', materializationLane: 'BoundedMesh', diagnostics: [], mesh: { faceId: 1, positions: new Float32Array([0, 0, 0, 1, 0, 0, 0, 1, 0]), normals: new Float32Array([0, 0, 1, 0, 0, 1, 0, 0, 1]), indices: new Uint32Array([0, 1, 2]) } }],};- expect(() => render(<AetherisViewport displayScene={scene} sceneData={null} showGrid={false} showAxisGuide={false} />)).not.toThrow();+ expect(() => render(<AetherisViewport displayScene={scene} showGrid={false} showAxisGuide={false} />)).not.toThrow();});it('RendersWirePatchWithoutMeshArrays', () => {@@ -40,16 +40,16 @@ describe('AetherisViewport', () => {...baseScene,renderables: [{ kind: 'WirePatch', faceId: 2, surfaceKind: 'Plane', status: 'WireframeOnly', patchKind: 'WirePatch', materializationLane: 'WirePatch', diagnostics: [], wires: [{ edgeId: 20, points: new Float32Array([0, 0, 0, 1, 0, 0]) }] }],};- const { getAllByTestId } = render(<AetherisViewport displayScene={scene} sceneData={null} showGrid={false} showAxisGuide={false} />);+ const { getAllByTestId } = render(<AetherisViewport displayScene={scene} showGrid={false} showAxisGuide={false} />);expect(getAllByTestId('line').length).toBeGreaterThan(0);});it('AcceptsDiagnosticOnlyFace', () => {const scene: DisplayScene = {...baseScene,- displayStatus: 'Partial',+ status: 'Partial',renderables: [{ kind: 'DiagnosticPatch', faceId: 3, surfaceKind: 'Plane', status: 'DiagnosticOnly', patchKind: 'DiagnosticPatch', materializationLane: 'DiagnosticOnly', diagnostics: [{ code: 'Viewer.Tessellation.Timeout', message: 'timeout', faceId: 3, surfaceKind: 'Plane', phase: 'test', suggestedNextAction: null }] }],};- expect(() => render(<AetherisViewport displayScene={scene} sceneData={null} showGrid={false} showAxisGuide={false} />)).not.toThrow();+ expect(() => render(<AetherisViewport displayScene={scene} showGrid={false} showAxisGuide={false} />)).not.toThrow();});});diff --git a/aetheris.client/src/__tests__/displayRenderables.test.ts b/aetheris.client/src/__tests__/displayRenderables.test.tsindex 1bfd449f..2863b21a 100644--- a/aetheris.client/src/__tests__/displayRenderables.test.ts+++ b/aetheris.client/src/__tests__/displayRenderables.test.ts@@ -64,5 +64,6 @@ describe('DisplayIRMapper', () => {]);expect(scene?.sourceAuthority).toBe('BRep');expect(scene?.displayAuthority).toBe('DisplayIR');+ expect(scene?.status).toBe('Partial');});});diff --git a/aetheris.client/src/__tests__/displaySceneBounds.test.ts b/aetheris.client/src/__tests__/displaySceneBounds.test.tsnew file mode 100644index 00000000..aac9108b--- /dev/null+++ b/aetheris.client/src/__tests__/displaySceneBounds.test.ts@@ -0,0 +1,20 @@+import { describe, expect, it } from 'vitest';+import { computeDisplaySceneBounds } from '../viewer/displaySceneBounds';+import type { DisplayScene } from '../viewer/displayRenderables';++const baseScene: Omit<DisplayScene, 'renderables'> = { status: 'Partial', sourceAuthority: 'BRep', displayAuthority: 'DisplayIR', lanes: [], diagnostics: [] };++describe('computeDisplaySceneBounds', () => {+ it('DisplaySceneBounds_StillFitsImportedFtc06Shape', () => {+ const scene: DisplayScene = {+ ...baseScene,+ renderables: [+ { kind: 'MeshPatch', faceId: 1, surfaceKind: 'Plane', status: 'Mesh', patchKind: 'MeshPatch', materializationLane: 'BoundedMesh', diagnostics: [], mesh: { faceId: 1, positions: new Float32Array([10000, -50, 25000, 10120, 60, 25140, 9980, 40, 25080]), normals: new Float32Array(9), indices: new Uint32Array([0, 1, 2]) } },+ { kind: 'WirePatch', faceId: 2, surfaceKind: 'Plane', status: 'WireframeOnly', patchKind: 'WirePatch', materializationLane: 'WirePatch', diagnostics: [], wires: [{ edgeId: 2, points: new Float32Array([9975, -55, 24990, 10130, 65, 25150]) }] },+ { kind: 'DiagnosticPatch', faceId: 3, surfaceKind: 'Plane', status: 'DiagnosticOnly', patchKind: 'DiagnosticPatch', materializationLane: 'DiagnosticOnly', diagnostics: [] },+ ],+ };++ expect(computeDisplaySceneBounds(scene)).toEqual({ minX: 9975, minY: -55, minZ: 24990, maxX: 10130, maxY: 65, maxZ: 25150 });+ });+});diff --git a/aetheris.client/src/__tests__/displaySceneBuilder.test.ts b/aetheris.client/src/__tests__/displaySceneBuilder.test.tsindex fa0cbf40..d76dd56d 100644--- a/aetheris.client/src/__tests__/displaySceneBuilder.test.ts+++ b/aetheris.client/src/__tests__/displaySceneBuilder.test.ts@@ -1,555 +1,65 @@-import { describe, expect, it, vi } from 'vitest';+import { describe, expect, it } from 'vitest';import type { DisplayPreparationResponseDto } from '../api/aetherisApi';import { buildDisplaySceneData } from '../viewer/displaySceneBuilder';-import { mapAnalyticPacketToRenderData } from '../viewer/analyticMapper';-const analyticPreparation: DisplayPreparationResponseDto = {- lane: 'analytic-only',- analyticPacket: {- bodyId: 1,- analyticFaces: [- {- faceId: 10,- shellId: 1,- shellRole: 'Outer',- surfaceGeometryId: 100,- surfaceKind: 'Cylinder',- loopCount: 1,- domainHint: { minV: -1, maxV: 1 },- planeGeometry: null,- cylinderGeometry: {- origin: { x: 0, y: 0, z: 0 },- axis: { x: 0, y: 1, z: 0 },- xAxis: { x: 1, y: 0, z: 0 },- yAxis: { x: 0, y: 0, z: 1 },- radius: 0.5,- },- coneGeometry: null,- sphereGeometry: null,- torusGeometry: null,- },- ],- fallbackFaces: [],- },- tessellationFallback: {- facePatches: [- {- faceId: 999,- positions: [{ x: 0, y: 0, z: 0 }],- normals: [{ x: 0, y: 1, z: 0 }],- triangleIndices: [0, 0, 0],- },- ],- edgePolylines: [],- },+const legacyFallback = {+ facePatches: [{ faceId: 100, positions: [{ x: 0, y: 0, z: 0 }, { x: 1, y: 0, z: 0 }, { x: 0, y: 1, z: 0 }], normals: [{ x: 0, y: 0, z: 1 }, { x: 0, y: 0, z: 1 }, { x: 0, y: 0, z: 1 }], triangleIndices: [0, 1, 2] }],+ edgePolylines: [],};-const fallbackPreparation: DisplayPreparationResponseDto = {- lane: 'fallback-only',- analyticPacket: {- bodyId: 1,- analyticFaces: [],- fallbackFaces: [- {- faceId: 3,- shellId: 1,- shellRole: 'Outer',- reason: 'UnsupportedSurfaceKind',- surfaceKind: 'BSplineSurfaceWithKnots',- detail: null,- },- ],- },- tessellationFallback: {- facePatches: [- {- faceId: 100,- positions: [- { x: 0, y: 0, z: 0 },- { x: 1, y: 0, z: 0 },- { x: 0, y: 1, z: 0 },- ],- normals: [- { x: 0, y: 0, z: 1 },- { x: 0, y: 0, z: 1 },- { x: 0, y: 0, z: 1 },- ],- triangleIndices: [0, 1, 2],- },- ],- edgePolylines: [],- },-};+function prep(overrides: Partial<DisplayPreparationResponseDto>): DisplayPreparationResponseDto {+ return {+ lane: 'fallback-only',+ analyticPacket: { bodyId: 1, analyticFaces: [], fallbackFaces: [] },+ tessellationFallback: null,+ status: 'Complete',+ sourceAuthority: 'BRep',+ displayAuthority: 'DisplayIR',+ lanes: [],+ displayLanes: [],+ diagnostics: [],+ faces: [],+ ...overrides,+ };+}describe('buildDisplaySceneData', () => {- it('routes analytic-only lane to analytic mapping and does not touch fallback mapping', () => {- const mapAnalytic = vi.fn().mockReturnValue({ faces: [], edges: [] });- const mapFallback = vi.fn().mockReturnValue({ faces: [], edges: [] });-- const result = buildDisplaySceneData(analyticPreparation, { mapAnalytic, mapFallback });-- expect(result.renderPath).toBe('analytic-only');- expect(mapAnalytic).toHaveBeenCalledOnce();- expect(mapFallback).not.toHaveBeenCalled();- expect(result.missingFallbackFaceIds).toEqual([]);- });-- it('keeps analytic-only lane for sphere packets and does not call fallback mapping', () => {- const spherePreparation: DisplayPreparationResponseDto = {- ...analyticPreparation,- analyticPacket: {- ...analyticPreparation.analyticPacket,- analyticFaces: [- {- faceId: 21,- shellId: 1,- shellRole: 'Outer',- surfaceGeometryId: 210,- surfaceKind: 'Sphere',- loopCount: 0,- domainHint: null,- planeGeometry: null,- cylinderGeometry: null,- coneGeometry: null,- sphereGeometry: {- center: { x: 0, y: 0, z: 0 },- axis: { x: 0, y: 0, z: 1 },- xAxis: { x: 1, y: 0, z: 0 },- yAxis: { x: 0, y: 1, z: 0 },- radius: 2,- },- torusGeometry: null,- },- ],- },- };- const mapAnalytic = vi.fn().mockReturnValue({ faces: [], edges: [] });- const mapFallback = vi.fn().mockReturnValue({ faces: [], edges: [] });-- const result = buildDisplaySceneData(spherePreparation, { mapAnalytic, mapFallback });-- expect(result.renderPath).toBe('analytic-only');- expect(mapAnalytic).toHaveBeenCalledOnce();- expect(mapFallback).not.toHaveBeenCalled();- expect(result.missingFallbackFaceIds).toEqual([]);- });-- it('keeps analytic-only lane for torus packets and does not call fallback mapping', () => {- const torusPreparation: DisplayPreparationResponseDto = {- ...analyticPreparation,- analyticPacket: {- ...analyticPreparation.analyticPacket,- analyticFaces: [- {- faceId: 22,- shellId: 1,- shellRole: 'Outer',- surfaceGeometryId: 220,- surfaceKind: 'Torus',- loopCount: 0,- domainHint: null,- planeGeometry: null,- cylinderGeometry: null,- coneGeometry: null,- sphereGeometry: null,- torusGeometry: {- center: { x: 0, y: 0, z: 0 },- axis: { x: 0, y: 0, z: 1 },- xAxis: { x: 1, y: 0, z: 0 },- yAxis: { x: 0, y: 1, z: 0 },- majorRadius: 5,- minorRadius: 1.5,- },- },- ],- },- };- const mapAnalytic = vi.fn().mockReturnValue({ faces: [], edges: [] });- const mapFallback = vi.fn().mockReturnValue({ faces: [], edges: [] });-- const result = buildDisplaySceneData(torusPreparation, { mapAnalytic, mapFallback });+ it('DisplaySceneBuilder_PrefersTypedDisplayIRFaces', () => {+ const result = buildDisplaySceneData(prep({+ lane: 'mixed-fallback',+ analyticPacket: { bodyId: 1, analyticFaces: [], fallbackFaces: [{ faceId: 100, shellId: 1, shellRole: 'Outer', reason: 'UnsupportedSurfaceKind', surfaceKind: 'BSplineSurfaceWithKnots', detail: null }] },+ tessellationFallback: legacyFallback,+ faces: [{ faceId: 7, shellId: 1, surfaceKind: 'Plane', status: 'Mesh', patchKind: 'MeshPatch', materializationLane: 'BoundedMesh', diagnostics: [], analyticPatch: null, wirePatch: null, meshPatch: legacyFallback.facePatches[0] }],+ }));- expect(result.renderPath).toBe('analytic-only');- expect(mapAnalytic).toHaveBeenCalledOnce();- expect(mapFallback).not.toHaveBeenCalled();- expect(result.missingFallbackFaceIds).toEqual([]);+ expect(result.displayScene?.renderables.map((renderable) => renderable.faceId)).toEqual([7]);+ expect(result.displayScene?.legacyCompatibility).toBeUndefined();});- it('routes fallback-only lane to tessellation fallback mapping', () => {- const mapAnalytic = vi.fn().mockReturnValue({ faces: [], edges: [] });- const mapFallback = vi.fn().mockReturnValue({ faces: [], edges: [] });-- const result = buildDisplaySceneData(fallbackPreparation, { mapAnalytic, mapFallback });+ it('DisplaySceneBuilder_UsesLegacyTessellationOnlyWhenNoTypedFaces', () => {+ const result = buildDisplaySceneData(prep({ tessellationFallback: legacyFallback }));expect(result.renderPath).toBe('fallback');- expect(mapFallback).toHaveBeenCalledOnce();- expect(mapAnalytic).not.toHaveBeenCalled();- expect(result.missingFallbackFaceIds).toEqual([]);+ expect(result.displayScene?.displayAuthority).toBe('LegacyCompatibilityAdapter');+ expect(result.displayScene?.renderables).toHaveLength(1);});- it('composes mixed-fallback lane with analytic and fallback subsets without duplicates', () => {- const mixedPreparation: DisplayPreparationResponseDto = {- lane: 'mixed-fallback',- analyticPacket: {- bodyId: 9,- analyticFaces: [- {- faceId: 10,- shellId: 1,- shellRole: 'Outer',- surfaceGeometryId: 100,- surfaceKind: 'Plane',- loopCount: 1,- domainHint: null,- planeGeometry: {- origin: { x: 0, y: 0, z: 0 },- normal: { x: 0, y: 0, z: 1 },- uAxis: { x: 1, y: 0, z: 0 },- vAxis: { x: 0, y: 1, z: 0 },- outerBoundary: [- { x: -1, y: -1, z: 0 },- { x: 1, y: -1, z: 0 },- { x: 1, y: 1, z: 0 },- { x: -1, y: 1, z: 0 },- ],- },- cylinderGeometry: null,- coneGeometry: null,- sphereGeometry: null,- torusGeometry: null,- },- ],- fallbackFaces: [- {- faceId: 20,- shellId: 1,- shellRole: 'Outer',- reason: 'UnsupportedSurfaceKind',- surfaceKind: 'BSplineSurfaceWithKnots',- detail: null,- },- ],- },- tessellationFallback: {- facePatches: [],- edgePolylines: [],- },- };-- const mapAnalytic = vi.fn().mockReturnValue({- faces: [{ faceId: 10, positions: new Float32Array([0, 0, 0]), normals: new Float32Array([0, 0, 1]), indices: new Uint32Array([0, 0, 0]) }],- edges: [],- });- const mapFallback = vi.fn().mockReturnValue({- faces: [- { faceId: 10, positions: new Float32Array([0, 0, 0]), normals: new Float32Array([0, 0, 1]), indices: new Uint32Array([0, 0, 0]) },- { faceId: 20, positions: new Float32Array([1, 0, 0]), normals: new Float32Array([0, 0, 1]), indices: new Uint32Array([0, 0, 0]) },- ],- edges: [{ edgeId: 1, points: new Float32Array([0, 0, 0, 1, 0, 0]) }],- });-- const result = buildDisplaySceneData(mixedPreparation, { mapAnalytic, mapFallback });+ it('DisplaySceneBuilder_LegacyFallbackProducesMeshRenderables', () => {+ const result = buildDisplaySceneData(prep({ tessellationFallback: legacyFallback }));- expect(result.renderPath).toBe('mixed-fallback');- expect(mapAnalytic).toHaveBeenCalledOnce();- expect(mapFallback).toHaveBeenCalledOnce();- expect(result.sceneData?.faces.map((face) => face.faceId)).toEqual([10, 20]);- expect(result.sceneData?.edges).toHaveLength(1);- expect(result.missingFallbackFaceIds).toEqual([]);+ expect(result.displayScene?.renderables[0].kind).toBe('MeshPatch');+ expect(result.displayScene?.renderables[0].materializationLane).toBe('BoundedMesh');+ expect(result.displayScene?.legacyCompatibility).toEqual({ source: 'tessellationFallback', facePatchCount: 1, edgePolylineCount: 0 });});- it('surfaces deterministic diagnostics when mixed-fallback required faces are missing from fallback payload', () => {- const mixedPreparation: DisplayPreparationResponseDto = {+ it('reports missing mixed-fallback mesh faces from the primary DisplayScene', () => {+ const result = buildDisplaySceneData(prep({lane: 'mixed-fallback',- analyticPacket: {- bodyId: 11,- analyticFaces: [- {- faceId: 501,- shellId: 1,- shellRole: 'Outer',- surfaceGeometryId: 5101,- surfaceKind: 'Plane',- loopCount: 1,- domainHint: null,- planeGeometry: {- origin: { x: 0, y: 0, z: 0 },- normal: { x: 0, y: 0, z: 1 },- uAxis: { x: 1, y: 0, z: 0 },- vAxis: { x: 0, y: 1, z: 0 },- outerBoundary: [- { x: -1, y: -1, z: 0 },- { x: 1, y: -1, z: 0 },- { x: 1, y: 1, z: 0 },- { x: -1, y: 1, z: 0 },- ],- },- cylinderGeometry: null,- coneGeometry: null,- sphereGeometry: null,- torusGeometry: null,- },- ],- fallbackFaces: [- {- faceId: 601,- shellId: 1,- shellRole: 'Outer',- reason: 'UnsupportedTrim',- surfaceKind: 'Plane',- detail: 'trim requires fallback',- },- {- faceId: 602,- shellId: 1,- shellRole: 'Outer',- reason: 'UnsupportedSurfaceKind',- surfaceKind: 'BSplineSurfaceWithKnots',- detail: null,- },- ],- },- tessellationFallback: {- facePatches: [- {- faceId: 601,- positions: [- { x: 0, y: 0, z: 0 },- { x: 1, y: 0, z: 0 },- { x: 0, y: 1, z: 0 },- ],- normals: [- { x: 0, y: 0, z: 1 },- { x: 0, y: 0, z: 1 },- { x: 0, y: 0, z: 1 },- ],- triangleIndices: [0, 1, 2],- },- ],- edgePolylines: [],- },- };-- const first = buildDisplaySceneData(mixedPreparation);- const second = buildDisplaySceneData(mixedPreparation);+ analyticPacket: { bodyId: 1, analyticFaces: [], fallbackFaces: [{ faceId: 101, shellId: 1, shellRole: 'Outer', reason: 'UnsupportedSurfaceKind', surfaceKind: 'BSplineSurfaceWithKnots', detail: null }] },+ tessellationFallback: legacyFallback,+ }));- expect(first.renderPath).toBe('mixed-fallback');- expect(second.renderPath).toBe('mixed-fallback');- expect(first.sceneData?.faces.map((face) => face.faceId)).toEqual([501, 601]);- expect(second.sceneData?.faces.map((face) => face.faceId)).toEqual([501, 601]);- expect(first.missingFallbackFaceIds).toEqual([602]);- expect(second.missingFallbackFaceIds).toEqual([602]);- });-- it('is deterministic for repeated mixed-fallback builds', () => {- const mixedPreparation: DisplayPreparationResponseDto = {- lane: 'mixed-fallback',- analyticPacket: {- bodyId: 10,- analyticFaces: [- {- faceId: 101,- shellId: 1,- shellRole: 'Outer',- surfaceGeometryId: 1001,- surfaceKind: 'Cylinder',- loopCount: 1,- domainHint: { minV: -0.5, maxV: 0.5 },- planeGeometry: null,- cylinderGeometry: {- origin: { x: 0, y: 0, z: 0 },- axis: { x: 0, y: 1, z: 0 },- xAxis: { x: 1, y: 0, z: 0 },- yAxis: { x: 0, y: 0, z: 1 },- radius: 0.25,- },- coneGeometry: null,- sphereGeometry: null,- torusGeometry: null,- },- ],- fallbackFaces: [- {- faceId: 202,- shellId: 1,- shellRole: 'Outer',- reason: 'UnsupportedTrim',- surfaceKind: 'Cylinder',- detail: 'trim requires fallback',- },- ],- },- tessellationFallback: {- facePatches: [- {- faceId: 202,- positions: [- { x: 0, y: 0, z: 0 },- { x: 1, y: 0, z: 0 },- { x: 0, y: 1, z: 0 },- ],- normals: [- { x: 0, y: 0, z: 1 },- { x: 0, y: 0, z: 1 },- { x: 0, y: 0, z: 1 },- ],- triangleIndices: [0, 1, 2],- },- ],- edgePolylines: [],- },- };-- const first = buildDisplaySceneData(mixedPreparation);- const second = buildDisplaySceneData(mixedPreparation);-- expect(first.renderPath).toBe('mixed-fallback');- expect(second.renderPath).toBe('mixed-fallback');- expect(first.sceneData?.faces.map((face) => face.faceId)).toEqual(second.sceneData?.faces.map((face) => face.faceId));- expect(first.missingFallbackFaceIds).toEqual(second.missingFallbackFaceIds);- expect(first.missingFallbackFaceIds).toEqual([]);- expect(first.sceneData?.faces).toHaveLength(2);- expect(Array.from(first.sceneData?.faces[0].positions ?? [])).toEqual(Array.from(second.sceneData?.faces[0].positions ?? []));- expect(Array.from(first.sceneData?.faces[1].indices ?? [])).toEqual(Array.from(second.sceneData?.faces[1].indices ?? []));- });-});--describe('mapAnalyticPacketToRenderData', () => {- it('maps sphere packet faces deterministically', () => {- const spherePacket = {- bodyId: 2,- analyticFaces: [- {- faceId: 200,- shellId: 1,- shellRole: 'Outer' as const,- surfaceGeometryId: 2000,- surfaceKind: 'Sphere',- loopCount: 0,- domainHint: null,- planeGeometry: null,- cylinderGeometry: null,- coneGeometry: null,- sphereGeometry: {- center: { x: 1, y: 2, z: 3 },- axis: { x: 0, y: 0, z: 1 },- xAxis: { x: 1, y: 0, z: 0 },- yAxis: { x: 0, y: 1, z: 0 },- radius: 4,- },- torusGeometry: null,- },- ],- fallbackFaces: [],- };-- const first = mapAnalyticPacketToRenderData(spherePacket);- const second = mapAnalyticPacketToRenderData(spherePacket);-- expect(first.faces).toHaveLength(1);- expect(first.faces[0].positions.length).toBeGreaterThan(0);- expect(first.faces[0].normals.length).toBe(first.faces[0].positions.length);- expect(first.faces[0].indices.length).toBeGreaterThan(0);- expect(Array.from(first.faces[0].positions)).toEqual(Array.from(second.faces[0].positions));- expect(Array.from(first.faces[0].normals)).toEqual(Array.from(second.faces[0].normals));- expect(Array.from(first.faces[0].indices)).toEqual(Array.from(second.faces[0].indices));- });-- it('maps torus packet faces deterministically', () => {- const torusPacket = {- bodyId: 3,- analyticFaces: [- {- faceId: 300,- shellId: 1,- shellRole: 'Outer' as const,- surfaceGeometryId: 3000,- surfaceKind: 'Torus',- loopCount: 0,- domainHint: null,- planeGeometry: null,- cylinderGeometry: null,- coneGeometry: null,- sphereGeometry: null,- torusGeometry: {- center: { x: 0, y: 0, z: 0 },- axis: { x: 0, y: 0, z: 1 },- xAxis: { x: 1, y: 0, z: 0 },- yAxis: { x: 0, y: 1, z: 0 },- majorRadius: 6,- minorRadius: 1,- },- },- ],- fallbackFaces: [],- };-- const first = mapAnalyticPacketToRenderData(torusPacket);- const second = mapAnalyticPacketToRenderData(torusPacket);-- expect(first.faces).toHaveLength(1);- expect(first.faces[0].positions.length).toBeGreaterThan(0);- expect(first.faces[0].normals.length).toBe(first.faces[0].positions.length);- expect(first.faces[0].indices.length).toBeGreaterThan(0);- expect(Array.from(first.faces[0].positions)).toEqual(Array.from(second.faces[0].positions));- expect(Array.from(first.faces[0].normals)).toEqual(Array.from(second.faces[0].normals));- expect(Array.from(first.faces[0].indices)).toEqual(Array.from(second.faces[0].indices));- });-- it('maps planar faces from outerBoundary polygon instead of placeholder quad', () => {- const planarPacket = {- bodyId: 4,- analyticFaces: [- {- faceId: 401,- shellId: 1,- shellRole: 'Outer' as const,- surfaceGeometryId: 4001,- surfaceKind: 'Plane',- loopCount: 1,- domainHint: null,- planeGeometry: {- origin: { x: 0, y: 0, z: 0 },- normal: { x: 0, y: 0, z: 1 },- uAxis: { x: 1, y: 0, z: 0 },- vAxis: { x: 0, y: 1, z: 0 },- outerBoundary: [- { x: -2, y: -1, z: 0 },- { x: 3, y: -1, z: 0 },- { x: 3, y: 2, z: 0 },- { x: 1, y: 2, z: 0 },- { x: -2, y: 1, z: 0 },- ],- },- cylinderGeometry: null,- coneGeometry: null,- sphereGeometry: null,- torusGeometry: null,- },- ],- fallbackFaces: [],- };-- const mapped = mapAnalyticPacketToRenderData(planarPacket);-- expect(mapped.faces).toHaveLength(1);- expect(Array.from(mapped.faces[0].positions)).toEqual([- -2, -1, 0,- 3, -1, 0,- 3, 2, 0,- 1, 2, 0,- -2, 1, 0,- ]);- expect(mapped.faces[0].indices.length).toBe(9);- });-- it('is deterministic for the same analytic packet input', () => {- const first = mapAnalyticPacketToRenderData(analyticPreparation.analyticPacket);- const second = mapAnalyticPacketToRenderData(analyticPreparation.analyticPacket);-- expect(first.faces).toHaveLength(second.faces.length);- expect(Array.from(first.faces[0].positions)).toEqual(Array.from(second.faces[0].positions));- expect(Array.from(first.faces[0].normals)).toEqual(Array.from(second.faces[0].normals));- expect(Array.from(first.faces[0].indices)).toEqual(Array.from(second.faces[0].indices));+ expect(result.renderPath).toBe('mixed-fallback');+ expect(result.missingFallbackFaceIds).toEqual([101]);});});diff --git a/aetheris.client/src/viewer/AetherisViewport.tsx b/aetheris.client/src/viewer/AetherisViewport.tsxindex a0b109c2..aaf627ac 100644--- a/aetheris.client/src/viewer/AetherisViewport.tsx+++ b/aetheris.client/src/viewer/AetherisViewport.tsx@@ -5,7 +5,6 @@ import { useEffect, useMemo, useState } from 'react';import type { ReactNode } from 'react';import { BufferAttribute, BufferGeometry, Color, DoubleSide, MeshStandardMaterial, OrthographicCamera, Raycaster, Vector2, Vector3 } from 'three';import type { DisplayScene } from './displayRenderables';-import type { RenderSceneData } from './tessellationMapper';import { selectLogarithmicGridScales } from './logarithmicGrid';const VIEWPORT_THEME = {@@ -452,7 +451,8 @@ function DraftingGrid() {export interface AetherisViewportProps {displayScene?: DisplayScene | null;- sceneData: RenderSceneData | null;+ /** Compatibility-only input for callers not yet migrated to DisplayScene. */+ sceneData?: null;highlightedFaceId?: number | null;highlightedEdgeId?: number | null;showGrid?: boolean;@@ -586,15 +586,12 @@ function PickRayCapture({ onPickRay }: { onPickRay?: AetherisViewportProps['onPiexport function AetherisViewport({displayScene = null,- sceneData,highlightedFaceId = null,highlightedEdgeId = null,showGrid = true,showAxisGuide = true,onPickRay,}: AetherisViewportProps) {- const hasInteractionEdgeHighlight = highlightedEdgeId !== null;-return (<Canvas style={{ display: 'block', width: '100%', height: '100%' }} orthographic camera={{ position: [6, 6, 6], zoom: 90, near: -10000, far: 10000 }} gl={{ alpha: true }}>{/*Negative near value is indeed correct in order to show negative value on grid. Documentation is wrong.*/}@@ -617,26 +614,6 @@ export function AetherisViewport({return null;})}- {!displayScene ? sceneData?.faces.map((face) => (- <FaceMesh- key={`face-${face.faceId}`}- positions={face.positions}- normals={face.normals}- indices={face.indices}- isHighlighted={highlightedFaceId === face.faceId}- />- )) : null}- {!displayScene && hasInteractionEdgeHighlight- ? sceneData?.edges- .filter((edge) => edge.edgeId === highlightedEdgeId)- .map((edge) => (- <EdgeLine- key={`edge-${edge.edgeId}`}- points={edge.points}- isHighlighted- />- ))- : null}<PickRayCapture onPickRay={onPickRay} /><OrbitControls makeDefault enablePan enableZoom /></Canvas>diff --git a/aetheris.client/src/viewer/displayRenderables.ts b/aetheris.client/src/viewer/displayRenderables.tsindex 3821c7c2..347acf67 100644--- a/aetheris.client/src/viewer/displayRenderables.ts+++ b/aetheris.client/src/viewer/displayRenderables.ts@@ -36,11 +36,17 @@ export interface DiagnosticRenderable extends DisplayRenderableBase {export type DisplayRenderable = AnalyticRenderable | MeshRenderable | WireRenderable | DiagnosticRenderable;export interface DisplayScene {- renderables: DisplayRenderable[];+ status: string | null;sourceAuthority: string | null;displayAuthority: string | null;- displayLanes: DisplayLaneDto[];- displayStatus: string | null;+ lanes: DisplayLaneDto[];+ renderables: DisplayRenderable[];+ diagnostics: DisplayDiagnosticDto[];+ legacyCompatibility?: {+ source: 'tessellationFallback';+ facePatchCount: number;+ edgePolylineCount: number;+ };}function base(face: DisplayFaceDto): Omit<DisplayRenderableBase, 'kind'> {@@ -85,10 +91,11 @@ export function mapDisplayFaceToRenderable(face: DisplayFaceDto): DisplayRenderaexport function mapDisplayPreparationToDisplayScene(preparation: DisplayPreparationResponseDto | null): DisplayScene | null {if (!preparation) return null;return {- renderables: (preparation.faces ?? []).map(mapDisplayFaceToRenderable),+ status: preparation.status ?? null,sourceAuthority: preparation.sourceAuthority ?? null,displayAuthority: preparation.displayAuthority ?? null,- displayLanes: preparation.displayLanes ?? [],- displayStatus: preparation.status ?? null,+ lanes: preparation.displayLanes ?? [],+ renderables: (preparation.faces ?? []).map(mapDisplayFaceToRenderable),+ diagnostics: preparation.diagnostics ?? [],};}diff --git a/aetheris.client/src/viewer/displaySceneBounds.ts b/aetheris.client/src/viewer/displaySceneBounds.tsnew file mode 100644index 00000000..c24baf90--- /dev/null+++ b/aetheris.client/src/viewer/displaySceneBounds.ts@@ -0,0 +1,50 @@+import type { DisplayScene } from './displayRenderables';++export interface DisplaySceneBounds {+ minX: number;+ minY: number;+ minZ: number;+ maxX: number;+ maxY: number;+ maxZ: number;+}++function includePoint(bounds: DisplaySceneBounds, x: number, y: number, z: number): void {+ bounds.minX = Math.min(bounds.minX, x);+ bounds.minY = Math.min(bounds.minY, y);+ bounds.minZ = Math.min(bounds.minZ, z);+ bounds.maxX = Math.max(bounds.maxX, x);+ bounds.maxY = Math.max(bounds.maxY, y);+ bounds.maxZ = Math.max(bounds.maxZ, z);+}++function includeArray(bounds: DisplaySceneBounds, points: Float32Array): void {+ for (let index = 0; index + 2 < points.length; index += 3) {+ includePoint(bounds, points[index], points[index + 1], points[index + 2]);+ }+}++export function computeDisplaySceneBounds(scene: DisplayScene | null): DisplaySceneBounds | null {+ if (!scene) return null;++ const bounds: DisplaySceneBounds = {+ minX: Number.POSITIVE_INFINITY,+ minY: Number.POSITIVE_INFINITY,+ minZ: Number.POSITIVE_INFINITY,+ maxX: Number.NEGATIVE_INFINITY,+ maxY: Number.NEGATIVE_INFINITY,+ maxZ: Number.NEGATIVE_INFINITY,+ };++ for (const renderable of scene.renderables) {+ if (renderable.kind === 'AnalyticPatch') {+ includeArray(bounds, renderable.previewMesh.positions);+ } else if (renderable.kind === 'MeshPatch') {+ includeArray(bounds, renderable.mesh.positions);+ } else if (renderable.kind === 'WirePatch') {+ for (const wire of renderable.wires) includeArray(bounds, wire.points);+ }+ }++ return Number.isFinite(bounds.minX) ? bounds : null;+}diff --git a/aetheris.client/src/viewer/displaySceneBuilder.ts b/aetheris.client/src/viewer/displaySceneBuilder.tsindex 404d13a7..7cef6e07 100644--- a/aetheris.client/src/viewer/displaySceneBuilder.ts+++ b/aetheris.client/src/viewer/displaySceneBuilder.ts@@ -1,105 +1,68 @@import type { DisplayPreparationResponseDto } from '../api/aetherisApi';-import { mapAnalyticPacketToRenderData } from './analyticMapper';import { mapDisplayPreparationToDisplayScene, type DisplayScene } from './displayRenderables';-import { mapTessellationToRenderData, type RenderSceneData } from './tessellationMapper';+import { legacyTessellationToDisplayScene } from './legacyTessellationToDisplayScene';export type DisplayRenderPath = 'analytic-only' | 'mixed-fallback' | 'fallback';export interface DisplaySceneBuildResult {renderPath: DisplayRenderPath;- sceneData: RenderSceneData | null;displayScene: DisplayScene | null;missingFallbackFaceIds: number[];}-interface BuildDependencies {- mapAnalytic: typeof mapAnalyticPacketToRenderData;- mapFallback: typeof mapTessellationToRenderData;-}--const defaultDependencies: BuildDependencies = {- mapAnalytic: mapAnalyticPacketToRenderData,- mapFallback: mapTessellationToRenderData,-};--function composeSceneData(primary: RenderSceneData, secondary: RenderSceneData): RenderSceneData {- return {- faces: [...primary.faces, ...secondary.faces],- edges: [...primary.edges, ...secondary.edges],- };-}--function filterFallbackFaces(- fallbackScene: RenderSceneData,- analyticFaceIds: Set<number>,- fallbackFaceIds: Set<number>,-): RenderSceneData {- return {- faces: fallbackScene.faces.filter((face) => fallbackFaceIds.has(face.faceId) && !analyticFaceIds.has(face.faceId)),- edges: fallbackScene.edges,- };-}-function getMissingFallbackFaceIds(requiredFallbackFaceIds: Set<number>, renderedFallbackFaceIds: Set<number>): number[] {return Array.from(requiredFallbackFaceIds).filter((faceId) => !renderedFallbackFaceIds.has(faceId)).sort((left, right) => left - right);}+function sceneHasTypedRenderable(scene: DisplayScene | null): boolean {+ return (scene?.renderables.length ?? 0) > 0;+}+export function buildDisplaySceneData(preparation: DisplayPreparationResponseDto | null,- deps: BuildDependencies = defaultDependencies,): DisplaySceneBuildResult {if (!preparation) {return {renderPath: 'fallback',- sceneData: null,displayScene: null,missingFallbackFaceIds: [],};}const typedDisplayScene = mapDisplayPreparationToDisplayScene(preparation);+ const fallbackDisplayScene = !sceneHasTypedRenderable(typedDisplayScene) && preparation.tessellationFallback+ ? legacyTessellationToDisplayScene(preparation.tessellationFallback)+ : null;+ const primaryDisplayScene = sceneHasTypedRenderable(typedDisplayScene) ? typedDisplayScene : fallbackDisplayScene;if (preparation.lane === 'analytic-only') {return {renderPath: 'analytic-only',- sceneData: typedDisplayScene?.renderables.length ? null : deps.mapAnalytic(preparation.analyticPacket),- displayScene: typedDisplayScene,+ displayScene: primaryDisplayScene,missingFallbackFaceIds: [],};}if (preparation.lane === 'mixed-fallback') {- const analyticScene = deps.mapAnalytic(preparation.analyticPacket);- const analyticFaceIds = new Set(preparation.analyticPacket.analyticFaces.map((face) => face.faceId));const fallbackFaceIds = new Set(preparation.analyticPacket.fallbackFaces.map((face) => face.faceId));-- if (!preparation.tessellationFallback) {- return {- renderPath: 'mixed-fallback',- sceneData: typedDisplayScene?.renderables.length ? null : analyticScene,- displayScene: typedDisplayScene,- missingFallbackFaceIds: Array.from(fallbackFaceIds).sort((left, right) => left - right),- };- }-- const fallbackScene = deps.mapFallback(preparation.tessellationFallback);- const filteredFallbackScene = filterFallbackFaces(fallbackScene, analyticFaceIds, fallbackFaceIds);- const renderedFallbackFaceIds = new Set(filteredFallbackScene.faces.map((face) => face.faceId));+ const renderedFallbackFaceIds = new Set(+ (primaryDisplayScene?.renderables ?? [])+ .filter((renderable) => renderable.kind === 'MeshPatch' && fallbackFaceIds.has(renderable.faceId))+ .map((renderable) => renderable.faceId),+ );return {renderPath: 'mixed-fallback',- sceneData: typedDisplayScene?.renderables.length ? null : composeSceneData(analyticScene, filteredFallbackScene),- displayScene: typedDisplayScene,+ displayScene: primaryDisplayScene,missingFallbackFaceIds: getMissingFallbackFaceIds(fallbackFaceIds, renderedFallbackFaceIds),};}return {renderPath: 'fallback',- sceneData: typedDisplayScene?.renderables.length ? null : (preparation.tessellationFallback ? deps.mapFallback(preparation.tessellationFallback) : null),- displayScene: typedDisplayScene,+ displayScene: primaryDisplayScene,missingFallbackFaceIds: [],};}diff --git a/aetheris.client/src/viewer/legacyTessellationToDisplayScene.ts b/aetheris.client/src/viewer/legacyTessellationToDisplayScene.tsnew file mode 100644index 00000000..b90854ce--- /dev/null+++ b/aetheris.client/src/viewer/legacyTessellationToDisplayScene.ts@@ -0,0 +1,37 @@+import type { TessellationResponseDto } from '../api/aetherisApi';+import { mapFacePatchToRenderFacePatch } from './tessellationMapper';+import type { DisplayRenderable, DisplayScene, MeshRenderable } from './displayRenderables';++// Compatibility adapter for pre-DisplayIR /tessellate-style payloads only.+// New viewer code should consume DisplayScene renderables, not treat tessellation+// face patches as scene authority.+export function legacyFacePatchToMeshRenderable(patch: TessellationResponseDto['facePatches'][number]): MeshRenderable {+ return {+ kind: 'MeshPatch',+ faceId: patch.faceId,+ surfaceKind: null,+ status: 'Mesh',+ patchKind: 'MeshPatch',+ materializationLane: 'BoundedMesh',+ diagnostics: [],+ mesh: mapFacePatchToRenderFacePatch(patch),+ };+}++export function legacyTessellationToDisplayScene(tessellation: TessellationResponseDto): DisplayScene {+ const meshRenderables: DisplayRenderable[] = tessellation.facePatches.map(legacyFacePatchToMeshRenderable);++ return {+ status: meshRenderables.length > 0 ? 'Complete' : 'Partial',+ sourceAuthority: 'LegacyTessellation',+ displayAuthority: 'LegacyCompatibilityAdapter',+ lanes: [],+ renderables: meshRenderables,+ diagnostics: [],+ legacyCompatibility: {+ source: 'tessellationFallback',+ facePatchCount: tessellation.facePatches.length,+ edgePolylineCount: tessellation.edgePolylines.length,+ },+ };+}diff --git a/docs/display-architecture-x5-threejs-displayir-renderer-cleanup.md b/docs/display-architecture-x5-threejs-displayir-renderer-cleanup.mdindex 24b21fb2..2058fb88 100644--- a/docs/display-architecture-x5-threejs-displayir-renderer-cleanup.md+++ b/docs/display-architecture-x5-threejs-displayir-renderer-cleanup.md@@ -64,3 +64,7 @@ DISPLAY-ARCH-X6 — typed DisplayIR API cleanup / remove legacy render-scene ass## X5.1 follow-upDISPLAY-ARCH-X5.1 resolved the imported-occurrence server validation issue by documenting and testing the distinction between direct bounded `/tessellate` mesh lowering and DisplayIR-authoritative `/display/prepare`. The frontend typed renderable architecture from X5 remains unchanged.++## Follow-up: DISPLAY-ARCH-X6++DISPLAY-ARCH-X6 follows this cleanup by making `DisplayScene` / `DisplayRenderable` the primary frontend scene contract and quarantining legacy tessellation fallback conversion behind explicit compatibility adapters. See `docs/display-architecture-x6-retire-legacy-mesh-scene.md`.diff --git a/docs/display-architecture-x6-retire-legacy-mesh-scene.md b/docs/display-architecture-x6-retire-legacy-mesh-scene.mdnew file mode 100644index 00000000..2d332663--- /dev/null+++ b/docs/display-architecture-x6-retire-legacy-mesh-scene.md@@ -0,0 +1,76 @@+# DISPLAY-ARCH-X6 — Retire Legacy Mesh-Scene Assumptions from the Frontend Viewer++## 1. Purpose and scope++DISPLAY-ARCH-X6 makes `DisplayScene` / `DisplayRenderable` the primary frontend scene contract. The work is intentionally frontend-scoped: API DTOs are mapped into typed renderables before reaching `AetherisViewport`, and any older tessellation fallback payload is treated as compatibility input only.++## 2. Relationship to X5 and DISPLAY-QA-X2++DISPLAY-ARCH-X5 introduced typed DisplayIR records and renamed the viewport to `AetherisViewport`. DISPLAY-QA-X2 then fixed imported-body framing/status behavior by fitting to typed DisplayIR renderables. X6 follows those milestones by removing the remaining frontend habit of treating legacy mesh scene data as an equal source of truth.++## 3. What legacy mesh-scene assumptions remained++The remaining assumptions were:++- `buildDisplaySceneData` returned both typed `DisplayScene` and legacy `RenderSceneData` as parallel render contracts.+- `AetherisViewport` accepted legacy scene data as a required prop and rendered it when no typed scene was present.+- App inspector counts still used tessellation fallback face/edge counts.+- Tessellation fallback conversion lived in the generic scene builder rather than in a named compatibility adapter.++## 4. What was removed++- The app no longer stores tessellation fallback state as the active viewer scene.+- `AetherisViewport` no longer requires legacy `RenderSceneData` to render.+- The primary build result no longer exposes `sceneData` as a peer scene contract.+- Inspector mesh counts now derive from `DisplayScene` renderables first.++## 5. What remains as compatibility adapter++`legacyTessellationToDisplayScene` and `legacyFacePatchToMeshRenderable` remain as explicit compatibility adapters for old `/tessellate`-style or `tessellationFallback` payloads that have no typed DisplayIR faces. They convert legacy face patches into typed `MeshPatch` renderables and tag the scene with `legacyCompatibility` metadata.++## 6. New frontend scene flow++```text+API DTOs -> DisplayScene -> DisplayRenderable[] -> AetherisViewport -> Three.js primitives+```++Typed DisplayIR faces win whenever present. Legacy tessellation fallback is only used when no typed faces are available.++## 7. AetherisViewport responsibilities++`AetherisViewport` is now a dumb renderer for typed renderables:++- `AnalyticPatch` renders through its preview mesh.+- `MeshPatch` / `BoundedMesh` renders mesh arrays.+- `WirePatch` renders edge polylines.+- `DiagnosticPatch` is accepted without inventing geometry.++It does not decide display success from mesh patch counts and does not infer fallback semantics from old lane strings.++## 8. Three.js backend role++Three.js remains the backend primitive renderer. It receives already-classified renderables and is not responsible for scene authority, display lane selection, or fallback policy.++## 9. Tests run++- `npm test -- --run displayRenderables.test.ts AetherisViewport.test.tsx displaySceneBuilder.test.ts App.test.tsx` after dependency installation.+- `npm run build`.++Full .NET validation and CLI smoke were also run for this change set when preparing the PR.++## 10. What did not change++- STEP import/export semantics.+- BRep topology.+- Server DisplayIR authority.+- Tessellator algorithms.+- CIR authority.+- Firmament V2 language/lowering.+- AIR Region route policy.+- Firmasm.+- FTC-07 planar triangulation.+- CAD feature behavior.++## 11. Next milestone recommendation++Recommended next milestone: `DISPLAY-ARCH-X7 — remove deprecated tessellationFallback frontend compatibility once server clients are migrated`.diff --git a/docs/display-qa-x2-imported-body-framing-status.md b/docs/display-qa-x2-imported-body-framing-status.mdnew file mode 100644index 00000000..02d48665--- /dev/null+++ b/docs/display-qa-x2-imported-body-framing-status.md@@ -0,0 +1,4 @@++## Follow-up: DISPLAY-ARCH-X6++DISPLAY-ARCH-X6 keeps the imported-body framing/status behavior from this milestone while removing the remaining frontend dependency on legacy mesh-scene data as a primary viewport contract. Legacy tessellation fallback is now compatibility-only. See `docs/display-architecture-x6-retire-legacy-mesh-scene.md`.