From e627270425c8db9e33644222edc5e96d9f728975 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 18:53:32 +0000 Subject: [PATCH 1/2] fix(xr): opaque, depth-tested panels so content behind never reads through Info cards drew every surface with depthTest:false, and A-Frame 1.7.1 draws transparent objects in DOM order rather than by distance, so virtual screens and the guide (appended later) painted over a card in front of them and the two texts interleaved (audit PANELS-1). Panel backings were also 3-34% transparent (PANELS-2), clicks passed through cards to the Share button behind them (PANELS-4), and the idle status line was 1.4 m wider than its screen (PANELS-6). - common tooltip: no depthTest:false; opaque background that carries the raycaster class (opt-out with raycastClass: ''). - dependency-graph path chip, virtual-screen frame, screen manager list, guide, mapping panel, comparison card and evolution overlay: opaque. - virtual-screen status width = frame width - 0.3. - tests: tooltip material/raycast assertions, a scan that forbids depthTest:false in every runtime and pins the opaque backings; the screen chrome characterization re-recorded (only the frame material and status width differ). Verified headless with real A-Frame: the card now hides the screen behind it and the ray's first hit is the card. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014FkKtAtQus8TVjhG9bhytC --- apps/vscode-extension/CHANGELOG.md | 1 + .../dependencyGraphRuntime/componentCore.js | 8 +-- .../guideScreenRuntime/guideScreen.js | 2 +- .../selectionPanel.js | 2 +- .../overlayAndPanel.js | 2 +- .../codexrMultiScreenManagerRuntime.js | 2 +- .../visibilityAndLayout.js | 6 +- .../xrChartMappingUiRuntime/panelUi.js | 1 - .../components/common/codexrCommonRuntime.js | 19 ++++-- .../analysis/codexrCommonRuntime.test.cjs | 22 +++++++ .../analysis/virtualScreenRuntime.test.cjs | 7 ++- .../test/analysis/xrPanelLayering.test.cjs | 59 +++++++++++++++++++ 12 files changed, 112 insertions(+), 19 deletions(-) create mode 100644 apps/vscode-extension/test/analysis/xrPanelLayering.test.cjs diff --git a/apps/vscode-extension/CHANGELOG.md b/apps/vscode-extension/CHANGELOG.md index 7418cb28..f95147de 100644 --- a/apps/vscode-extension/CHANGELOG.md +++ b/apps/vscode-extension/CHANGELOG.md @@ -34,6 +34,7 @@ #### Fixed +- **Panels in the XR scene no longer show the content behind them.** Opening an element's info card in front of a virtual screen or the guide mixed the text of both: the card skipped the depth test, and the scene draws see-through surfaces in page order rather than by distance, so screens farther away were painted over it. Info cards, the dependency-graph path chip, virtual screens, the guide, the controller panel, the "Virtual screens" list, the comparison card and the evolution overlay now have opaque, depth-tested backings. Clicking an info card no longer passes through it to whatever is behind (it could start a screen share), and a virtual screen's idle message now wraps inside the screen instead of spilling past its edges. - **Historical comparison and project evolution no longer refuse a folder opened through a link.** When the analyzed folder was reached through a symbolic link, a junction, or a shortened Windows path (`C:\Users\JOHNDO~1\...`), Code-XR compared it with the repository path Git reports and wrongly concluded the folder was outside the repository, so the Git-based analyses were unavailable. Both paths are now resolved to their real location before they are compared. - **The installed extension only ever runs the Python analysis scripts it ships with.** If its bundled copy of an analysis script was missing (a damaged or partially deleted install), Code-XR fell back to a developer location two folders above the extension, which in an installed copy is your home folder, and could have run a file found there. That fallback is now limited to development builds; an installed extension reports the missing script instead. - **The analysis backend loads again on Python 3.8 and 3.9.** One type annotation in the line-metrics module used syntax that only exists from Python 3.10, so on 3.8 or 3.9 every analysis failed as soon as the backend loaded, although the extension asks only for Python 3.7 or newer. The annotation now uses the older spelling; results on newer Python versions are unchanged. diff --git a/apps/vscode-extension/templates/components/codexr/dependency-graph/dependencyGraphRuntime/componentCore.js b/apps/vscode-extension/templates/components/codexr/dependency-graph/dependencyGraphRuntime/componentCore.js index 75cc80fe..84d26de2 100644 --- a/apps/vscode-extension/templates/components/codexr/dependency-graph/dependencyGraphRuntime/componentCore.js +++ b/apps/vscode-extension/templates/components/codexr/dependency-graph/dependencyGraphRuntime/componentCore.js @@ -173,13 +173,13 @@ position: SCOPE_LABEL_HOME, class: 'codexr-scope-breadcrumb' }); - // Dark contrast chip behind the breadcrumb so the path stays legible - // over the graph and the white table; depthTest:false keeps it from - // being occluded by nodes/edges at either the home or docked position. + // Dark, opaque contrast chip behind the breadcrumb so the path stays + // legible over the graph and the white table. It is depth-tested like + // every panel: depthTest:false let farther surfaces paint over it. this.scopeLabelChip = entity('a-plane', { position: '0 0 -0.01', width: 3, height: 0.34, - material: 'color: #0b1220; opacity: 0.82; shader: flat; side: double; transparent: true; depthTest: false' + material: 'color: #0b1220; shader: flat; side: double' }); this.scopeLabel = text('', '0 0 0.02', 5.4, '#67e8f9'); this.scopeLabel.setAttribute('side', 'double'); diff --git a/apps/vscode-extension/templates/components/codexr/guide-screen/guideScreenRuntime/guideScreen.js b/apps/vscode-extension/templates/components/codexr/guide-screen/guideScreenRuntime/guideScreen.js index 7a071b38..ee86f671 100644 --- a/apps/vscode-extension/templates/components/codexr/guide-screen/guideScreenRuntime/guideScreen.js +++ b/apps/vscode-extension/templates/components/codexr/guide-screen/guideScreenRuntime/guideScreen.js @@ -203,7 +203,7 @@ function buildGuideContent(slotRoot) { slotRoot.appendChild(guideEntity('a-plane', { width: SCREEN.width, height: SCREEN.height, - material: 'color: #0b1220; opacity: .97; shader: flat; side: double' + material: 'color: #0b1220; shader: flat; side: double' })); slotRoot.appendChild(guideEntity('a-plane', { position: '0 ' + (SCREEN.height / 2 - 0.24) + ' 0.01', width: SCREEN.width, height: 0.44, diff --git a/apps/vscode-extension/templates/components/codexr/historical-comparison/historicalComparisonRuntime/selectionPanel.js b/apps/vscode-extension/templates/components/codexr/historical-comparison/historicalComparisonRuntime/selectionPanel.js index 1918048a..972acd2b 100644 --- a/apps/vscode-extension/templates/components/codexr/historical-comparison/historicalComparisonRuntime/selectionPanel.js +++ b/apps/vscode-extension/templates/components/codexr/historical-comparison/historicalComparisonRuntime/selectionPanel.js @@ -235,7 +235,7 @@ }); refs.companionCard = createEntity('a-plane', { position: '0 0 -0.03', width: COMPANION_CARD_W, height: 1, - material: 'color: #0e1526; opacity: 0.66; shader: flat' + material: 'color: #0e1526; shader: flat' }); refs.companionRoot.appendChild(refs.companionCardBorder); refs.companionRoot.appendChild(refs.companionCard); diff --git a/apps/vscode-extension/templates/components/codexr/project-evolution/projectEvolutionRuntime/overlayAndPanel.js b/apps/vscode-extension/templates/components/codexr/project-evolution/projectEvolutionRuntime/overlayAndPanel.js index f2692bf4..975c3a0c 100644 --- a/apps/vscode-extension/templates/components/codexr/project-evolution/projectEvolutionRuntime/overlayAndPanel.js +++ b/apps/vscode-extension/templates/components/codexr/project-evolution/projectEvolutionRuntime/overlayAndPanel.js @@ -12,7 +12,7 @@ overlay.appendChild(entity('a-plane', { width: 6.2, height: 0.72, - material: 'color: #111827; opacity: 0.78; transparent: true; shader: flat' + material: 'color: #111827; shader: flat' })); refs.overlayTitle = text('', '0 0.17 0.02', 5.8, '#fde68a'); refs.overlayDetail = smallText('', '-2.7 -0.15 0.02', 5.4, '#e0f2fe', 'left', 52); diff --git a/apps/vscode-extension/templates/components/codexr/virtual-screen/codexrMultiScreenManagerRuntime.js b/apps/vscode-extension/templates/components/codexr/virtual-screen/codexrMultiScreenManagerRuntime.js index f8f0c5bc..2ad35dc8 100644 --- a/apps/vscode-extension/templates/components/codexr/virtual-screen/codexrMultiScreenManagerRuntime.js +++ b/apps/vscode-extension/templates/components/codexr/virtual-screen/codexrMultiScreenManagerRuntime.js @@ -212,7 +212,7 @@ this.panelPlane.setAttribute('height', '2'); this.panelPlane.setAttribute('color', '#0f172a'); this.panelPlane.setAttribute('position', '0 -1 -0.01'); - this.panelPlane.setAttribute('material', 'opacity: 0.9; transparent: true; shader: flat;'); + this.panelPlane.setAttribute('material', 'shader: flat;'); const title = document.createElement('a-text'); title.setAttribute('value', 'Virtual screens'); diff --git a/apps/vscode-extension/templates/components/codexr/virtual-screen/virtualScreenRuntime/visibilityAndLayout.js b/apps/vscode-extension/templates/components/codexr/virtual-screen/virtualScreenRuntime/visibilityAndLayout.js index 9923be63..1cce05cd 100644 --- a/apps/vscode-extension/templates/components/codexr/virtual-screen/virtualScreenRuntime/visibilityAndLayout.js +++ b/apps/vscode-extension/templates/components/codexr/virtual-screen/virtualScreenRuntime/visibilityAndLayout.js @@ -66,7 +66,7 @@ refs.frame = createEntity('a-plane', { id: getScopedId('codexrVirtualScreenFrame'), color: '#0F172A', - material: 'color: #0F172A; opacity: 0.86; transparent: true; shader: flat;', + material: 'color: #0F172A; shader: flat;', position: '0 0 -0.01', }); @@ -316,7 +316,9 @@ refs.headerStrip.setAttribute('height', minimized ? '0.20' : '0.16'); refs.headerStrip.setAttribute('position', minimized ? '0 0 0.03' : `0 ${headerY} 0.03`); - refs.status.setAttribute('width', String(Math.max(6, width + 1.4))); + // The status line wraps inside the frame: it used to be 1.4 m wider than + // the screen, so the idle message spilled over whatever stood beside it. + refs.status.setAttribute('width', String(Math.max(1, width - 0.3))); // Fixed-content screens keep transient hints (move/resize/lock) above the // screen so they never cover the content; broadcast screens keep the // classic centered placement over the empty idle surface. diff --git a/apps/vscode-extension/templates/components/codexr/xr-chart-mapping-ui/xrChartMappingUiRuntime/panelUi.js b/apps/vscode-extension/templates/components/codexr/xr-chart-mapping-ui/xrChartMappingUiRuntime/panelUi.js index cc309fa9..aec6b399 100644 --- a/apps/vscode-extension/templates/components/codexr/xr-chart-mapping-ui/xrChartMappingUiRuntime/panelUi.js +++ b/apps/vscode-extension/templates/components/codexr/xr-chart-mapping-ui/xrChartMappingUiRuntime/panelUi.js @@ -400,7 +400,6 @@ refs.panelBackground = createEntity('a-plane', { color: '#0A1628', - opacity: 0.94, width: 6.2, height: 2.2, position: '0 0 0' diff --git a/apps/vscode-extension/templates/components/common/codexrCommonRuntime.js b/apps/vscode-extension/templates/components/common/codexrCommonRuntime.js index 8701f5f3..95978e85 100644 --- a/apps/vscode-extension/templates/components/common/codexrCommonRuntime.js +++ b/apps/vscode-extension/templates/components/common/codexrCommonRuntime.js @@ -98,26 +98,33 @@ position: '0 0 -0.012', width: width + .06, height: height + .06, - material: 'color: ' + accentColor + '; opacity: .5; shader: flat; side: double; transparent: true; depthTest: false' + material: 'color: ' + accentColor + '; opacity: .5; shader: flat; side: double; transparent: true' }); + // The backing is opaque and depth-tested, and it absorbs the pointer ray. + // depthTest:false here once let every screen behind the card paint over it + // (A-Frame 1.7.1 draws transparent objects in DOM order, not by distance), + // and a card without the raycaster class let clicks fall through to + // whatever was behind it. const background = createEntity('a-plane', { width: width, height: height, - material: 'color: #0e1626; opacity: .97; shader: flat; side: double; transparent: true; depthTest: false' + class: opts.raycastClass === undefined ? 'babiaxraycasterclass' : opts.raycastClass, + 'data-codexr-role': 'tooltip background', + material: 'color: #0e1626; shader: flat; side: double' }); // Left vertical accent bar carries the selected element's type colour. const accent = createEntity('a-plane', { position: (-(width / 2) + .035) + ' 0 .008', width: .07, height: height, - material: 'color: ' + accentColor + '; shader: flat; depthTest: false' + material: 'color: ' + accentColor + '; shader: flat' }); // Thin accent divider under the header. const divider = createEntity('a-plane', { position: '0 0 .01', width: width - .3, height: .006, - material: 'color: ' + accentColor + '; opacity: .4; shader: flat; depthTest: false' + material: 'color: ' + accentColor + '; opacity: .4; shader: flat' }); const textX = -(width / 2) + .2; const title = tooltipText('', (textX + .02) + ' .26 .018', width - .4, '#f8fafc', 'left'); @@ -183,7 +190,7 @@ segmentsHeight: 6, class: 'codexr-tooltip-connector-marker codexr-tooltip-auxiliary', 'data-codexr-role': 'tooltip connector marker', - material: 'color: #f59e0b; shader: flat; opacity: .92; transparent: true; depthTest: false' + material: 'color: #f59e0b; shader: flat; opacity: .92; transparent: true' }); connectorRoot.appendChild(tooltip.connectorMarker); } @@ -226,7 +233,7 @@ opacity: Number(opts.opacity) || .88 }); tooltip.connectorMarker.setAttribute('position', formatPosition(end)); - tooltip.connectorMarker.setAttribute('material', 'color: ' + color + '; shader: flat; opacity: .92; transparent: true; depthTest: false'); + tooltip.connectorMarker.setAttribute('material', 'color: ' + color + '; shader: flat; opacity: .92; transparent: true'); connectorRoot.setAttribute('visible', true); return true; } diff --git a/apps/vscode-extension/test/analysis/codexrCommonRuntime.test.cjs b/apps/vscode-extension/test/analysis/codexrCommonRuntime.test.cjs index ecccaf9e..1cc3fd8e 100644 --- a/apps/vscode-extension/test/analysis/codexrCommonRuntime.test.cjs +++ b/apps/vscode-extension/test/analysis/codexrCommonRuntime.test.cjs @@ -308,3 +308,25 @@ test('manual XR mode harness loads common runtime before component runtimes that assert.ok(harness.indexOf('templates/components/common/codexrCommonRuntime.js') < harness.indexOf('historicalComparisonRuntime.js')); assert.ok(harness.indexOf('templates/components/common/codexrCommonRuntime.js') < harness.indexOf('dependencyGraphRuntime.js')); }); + +// XR epic, story S1 (audit PANELS-1 and PANELS-4). A-Frame 1.7.1 draws +// transparent objects in DOM order, not by distance, so a card whose surfaces +// skip the depth test is painted over by every screen behind it; and a card +// the pointer ray cannot hit lets clicks fall through to the screen behind it. +test('tooltip cards are depth-tested, opaque and absorb the pointer ray', () => { + const runtime = loadRuntime().CodeXRCommonRuntime; + const host = createElement('a-entity'); + const tooltip = runtime.createTooltip({ accentColor: '#22d3ee', width: 3.6 }); + host.appendChild(tooltip.root); + runtime.updateTooltip(tooltip, { title: 'dependentium', rows: [{ label: 'Fan-in', value: '46' }] }, + { x: 0, y: 0, z: 0 }, { connectorTarget: { x: 0, y: -1, z: 0 } }); + + for (const name of ['border', 'background', 'accent', 'divider', 'connectorMarker']) { + assert.doesNotMatch(String(tooltip[name].getAttribute('material')), /depthTest\s*:\s*false/, name); + } + const background = String(tooltip.background.getAttribute('material')); + assert.doesNotMatch(background, /opacity/); + assert.doesNotMatch(background, /transparent\s*:\s*true/); + assert.equal(tooltip.background.getAttribute('class'), 'babiaxraycasterclass'); + assert.equal(runtime.createTooltip({ raycastClass: '' }).background.getAttribute('class'), ''); +}); diff --git a/apps/vscode-extension/test/analysis/virtualScreenRuntime.test.cjs b/apps/vscode-extension/test/analysis/virtualScreenRuntime.test.cjs index b8f04389..714338b8 100644 --- a/apps/vscode-extension/test/analysis/virtualScreenRuntime.test.cjs +++ b/apps/vscode-extension/test/analysis/virtualScreenRuntime.test.cjs @@ -896,9 +896,12 @@ const foreignBroadcast = { }; // [transcript lines, sha256 of the transcript] per screen kind. +// Re-recorded for the XR epic's panel fix: the only differences from the +// previous recording are the opaque frame material and the status line width +// (frame width - 0.3 instead of frame width + 1.4). const SCREEN_CHROME_CHARACTERIZATION = { - broadcast: [2454, '07402aa5766f39fb0e88a8b0f72d609153e3635634345ac3c6754ebdfa02d20b'], - fixed: [972, 'f0765c01e853932d327596bc75ac6377dc78082ad1d75d09183cbc08655e699b'], + broadcast: [2454, '4af95d19788758a83c0ea0967a81f3b5dff008cece0723815cfe47c902790761'], + fixed: [972, '27f4b8e685155cb6f82dc7fd8cf097a3b9262be1db35f2230ab75690e3af4194'], }; test('the screen chrome renders identically through every state (characterization)', () => { diff --git a/apps/vscode-extension/test/analysis/xrPanelLayering.test.cjs b/apps/vscode-extension/test/analysis/xrPanelLayering.test.cjs new file mode 100644 index 00000000..151c8fd2 --- /dev/null +++ b/apps/vscode-extension/test/analysis/xrPanelLayering.test.cjs @@ -0,0 +1,59 @@ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); + +// XR epic, story S1 (audit PANELS-1, PANELS-2): panels must be readable +// wherever they stand. A-Frame 1.7.1 keeps `sortTransparentObjects: false`, so +// transparent surfaces are drawn in DOM order, not by distance. Two rules +// follow, checked here over every runtime that ships in a generated scene: +// 1. no material skips the depth test (a surface that does is painted over +// by anything drawn after it, however far away); +// 2. the backing of every panel is opaque (a translucent backing lets the +// panels behind it read through). + +const componentsRoot = path.resolve(__dirname, '..', '..', 'templates', 'components'); + +function listRuntimeFiles(dir) { + return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => { + const full = path.join(dir, entry.name); + if (entry.isDirectory()) { + return listRuntimeFiles(full); + } + return entry.name.endsWith('.js') ? [full] : []; + }); +} + +test('no scene runtime disables the depth test on a material', () => { + const offenders = listRuntimeFiles(componentsRoot).flatMap((file) => fs.readFileSync(file, 'utf8') + .split('\n') + .map((line, index) => ({ line, index })) + .filter(({ line }) => /depthTest\s*:\s*false/.test(line) && !/^\s*\/\//.test(line)) + .map(({ index }) => `${path.relative(componentsRoot, file)}:${index + 1}`)); + assert.deepEqual(offenders, []); +}); + +const PANEL_BACKINGS = [ + // [file, a unique snippet that identifies the backing's declaration] + ['common/codexrCommonRuntime.js', "material: 'color: #0e1626; shader: flat; side: double'"], + ['codexr/virtual-screen/virtualScreenRuntime/visibilityAndLayout.js', "material: 'color: #0F172A; shader: flat;',\n position: '0 0 -0.01',"], + ['codexr/virtual-screen/codexrMultiScreenManagerRuntime.js', "this.panelPlane.setAttribute('material', 'shader: flat;');"], + ['codexr/guide-screen/guideScreenRuntime/guideScreen.js', "material: 'color: #0b1220; shader: flat; side: double'"], + ['codexr/xr-chart-mapping-ui/xrChartMappingUiRuntime/panelUi.js', "refs.panelBackground = createEntity('a-plane', {\n color: '#0A1628',\n width: 6.2,"], + ['codexr/historical-comparison/historicalComparisonRuntime/selectionPanel.js', "material: 'color: #0e1526; shader: flat'"], + ['codexr/project-evolution/projectEvolutionRuntime/overlayAndPanel.js', "material: 'color: #111827; shader: flat'"], + ['codexr/dependency-graph/dependencyGraphRuntime/componentCore.js', "material: 'color: #0b1220; shader: flat; side: double'"], +]; + +test('every panel backing is opaque', () => { + for (const [file, snippet] of PANEL_BACKINGS) { + const source = fs.readFileSync(path.join(componentsRoot, file), 'utf8'); + assert.ok(source.includes(snippet), `${file}: opaque backing not found`); + } +}); + +test('the virtual-screen status line wraps inside the frame', () => { + const source = fs.readFileSync(path.join(componentsRoot, + 'codexr/virtual-screen/virtualScreenRuntime/visibilityAndLayout.js'), 'utf8'); + assert.match(source, /refs\.status\.setAttribute\('width', String\(Math\.max\(1, width - 0\.3\)\)\)/); +}); From f80cbe54002488b71d48db843c1336b083986e6c Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 19:02:16 +0000 Subject: [PATCH 2/2] test(xr): normalise CRLF before matching multi-line backing snippets (Windows CI) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014FkKtAtQus8TVjhG9bhytC --- apps/vscode-extension/test/analysis/xrPanelLayering.test.cjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/vscode-extension/test/analysis/xrPanelLayering.test.cjs b/apps/vscode-extension/test/analysis/xrPanelLayering.test.cjs index 151c8fd2..d698066d 100644 --- a/apps/vscode-extension/test/analysis/xrPanelLayering.test.cjs +++ b/apps/vscode-extension/test/analysis/xrPanelLayering.test.cjs @@ -47,7 +47,8 @@ const PANEL_BACKINGS = [ test('every panel backing is opaque', () => { for (const [file, snippet] of PANEL_BACKINGS) { - const source = fs.readFileSync(path.join(componentsRoot, file), 'utf8'); + // Windows checkouts use CRLF; the multi-line snippets are written with LF. + const source = fs.readFileSync(path.join(componentsRoot, file), 'utf8').replace(/\r\n/g, '\n'); assert.ok(source.includes(snippet), `${file}: opaque backing not found`); } });