diff --git a/docs/site/dependencies.html b/docs/site/dependencies.html index 86fd70e9e..070c88882 100644 --- a/docs/site/dependencies.html +++ b/docs/site/dependencies.html @@ -67,7 +67,7 @@

Claim dependency viewer

Consumes

Edges point from a dependent claim to the source it consumes.

Consumed by

Direct dependents recorded in this source snapshot.

-

Paths to unresolved dependencies

Shortest source-edge paths found below the selected node. A missing path is not evidence that no dependency exists outside this snapshot.

    +

    Paths to unresolved dependencies

    Shortest required source-edge paths found below the selected node. Contextual edges remain visible in the direct-dependency list but are not counted as consumed dependency paths. A missing path is not evidence that no dependency exists outside this snapshot.

      diff --git a/docs/site/dependencies.mjs b/docs/site/dependencies.mjs index 433a8de5b..f1c630340 100644 --- a/docs/site/dependencies.mjs +++ b/docs/site/dependencies.mjs @@ -26,6 +26,7 @@ function prepareInitialSelectionRestore({ windowObject = window, documentObject const cleanup = () => events.forEach(event => windowObject.removeEventListener(event, cancel, options)); const cancel = event => { if (event.type === 'pointermove' && !event.buttons) return; + if (event.type === 'focusin' && event.target === documentObject.getElementById('node-detail')) return; cancelled = true; cleanup(); }; @@ -85,9 +86,17 @@ function emptyItem(message) { function metadata(node) { const fragment = document.createDocumentFragment(); - for (const [label, value] of metadataEntries(node)) { + for (const [label, value, href] of metadataEntries(node)) { const wrapper = element('div'); - wrapper.append(element('dt', { text: label }), element('dd', { text: value })); + const description = element('dd'); + if (href) { + const link = element('a', { text: value }); + link.href = href; + description.append(link); + } else { + description.textContent = value; + } + wrapper.append(element('dt', { text: label }), description); fragment.append(wrapper); } return fragment; @@ -184,7 +193,7 @@ function run({ index, provenance }) { )); const paths = dependencyPaths(index, selected.id); byId('dependency-paths').replaceChildren(...( - paths.length ? paths.map(renderPath) : [emptyItem('No path to another unresolved target is recorded below this node.')] + paths.length ? paths.map(renderPath) : [emptyItem('No required path to another unresolved target is recorded below this node.')] )); if (writeURL) updateURL(selected.id); if (focus) byId('node-detail').focus({ preventScroll: true }); diff --git a/docs/site/dependency-model.mjs b/docs/site/dependency-model.mjs index 129cff754..993e8f90c 100644 --- a/docs/site/dependency-model.mjs +++ b/docs/site/dependency-model.mjs @@ -64,6 +64,26 @@ function displayValue(value) { return String(value); } +function metadataHref(field, value) { + if (!['source', 'review_source', 'review_url'].includes(field) || typeof value !== 'string') + return undefined; + try { + const url = new URL(value); + if (url.protocol === 'https:' && url.hostname === 'github.com' && + !url.username && !url.password && !url.port) + return value; + return undefined; + } catch { + const segments = value.split('/'); + if (!value || value.startsWith('/') || value.includes('\\') || + segments.some(segment => !segment || segment === '.' || segment === '..') || + !segments.every(segment => /^[A-Za-z0-9._-]+$/.test(segment))) + return undefined; + const path = segments.map(encodeURIComponent).join('/'); + return `https://github.com/${PINNED_GRAPH_SOURCE.repository}/blob/${PINNED_GRAPH_SOURCE.commit}/${path}`; + } +} + export function metadataEntries(node) { const values = [ ['Identifier', node.id], @@ -78,6 +98,7 @@ export function metadataEntries(node) { ['fingerprint', 'Fingerprint'], ['scope', 'Scope'], ['notes', 'Notes'], + ['component_role', 'Component role'], ['author_provider', 'Author provider'], ['review_provider', 'Review provider'], ['review_providers', 'Review providers'], @@ -90,7 +111,7 @@ export function metadataEntries(node) { ]; for (const [field, label] of fields) { if (node[field] !== undefined && displayValue(node[field]).length) - values.push([label, displayValue(node[field])]); + values.push([label, displayValue(node[field]), metadataHref(field, node[field])]); } return values; } @@ -189,6 +210,7 @@ export function buildGraphIndex(graph) { node.source, node.notes, node.scope, + node.component_role, node.author_provider, node.review_provider, node.review_providers, @@ -244,6 +266,7 @@ export function dependencyPaths(index, startId) { recordedTargets.add(currentId); } for (const edge of current.dependencies) { + if (!edge.required) continue; if (path.ids.includes(edge.id)) continue; const nextDepth = path.ids.length; if (shortestDepth.has(edge.id) && shortestDepth.get(edge.id) <= nextDepth) continue; diff --git a/tests/test_dependency_viewer.mjs b/tests/test_dependency_viewer.mjs index 44e27a289..2dcb42bd9 100644 --- a/tests/test_dependency_viewer.mjs +++ b/tests/test_dependency_viewer.mjs @@ -111,6 +111,27 @@ test('classification styling and metadata preserve source review lineage', async ); assert.ok(searchNodes(index, 'never discharge') .some(node => node.id === 'math.d1-component.reconciliation-record')); + const component = index.nodes.get('math.d5-component.punctured-pin-continuum-check'); + const componentEntries = new Map(metadataEntries(component)); + assert.equal(componentEntries.get('Component role'), 'review_checker'); + assert.ok(searchNodes(index, 'review_checker') + .some(node => node.id === component.id)); + + const remainderEntries = metadataEntries(index.nodes.get('math.lifetime-remainder')); + const source = remainderEntries.find(([label]) => label === 'Source'); + const reviewSource = remainderEntries.find(([label]) => label === 'Review source'); + assert.equal(source[2], + 'https://github.com/d6g8k5htny-coder/Math-/blob/7858329974e28be79f29b22644370084ff43da4f/frontiers/three_fronts_20260924/LIFETIME_REMAINDER.md'); + assert.equal(reviewSource[2], + 'https://github.com/d6g8k5htny-coder/main/issues/67#issuecomment-5841782206'); + const externalSource = metadataEntries(index.nodes.get('math.rn-mesoscopic-reduction')) + .find(([label]) => label === 'Source'); + assert.equal(externalSource[2], undefined); + assert.equal(metadataEntries({ + id: 'synthetic', classification: 'OPEN_ACTIVE', layer: 'test', kind: 'candidate', + controlling: false, impact: 0, source: '../private.txt', + review_source: 'https://example.com/review', + }).filter(([, , href]) => href !== undefined).length, 0); }); test('classification CSS identifiers use locale-neutral ASCII case folding', () => { @@ -124,17 +145,22 @@ test('classification CSS identifiers use locale-neutral ASCII case folding', () } }); -test('dependency paths are source-edge paths and retain relation metadata', async () => { +test('dependency paths use required source edges and retain relation metadata', async () => { const index = buildGraphIndex(await fixture()); const paths = dependencyPaths(index, 'math.rn-mesoscopic-reduction'); const target = paths.find(path => path.ids.at(-1) === 'hist.Piece-2-annulus'); - assert.ok(target); - assert.equal(target.ids[0], 'math.rn-mesoscopic-reduction'); - assert.equal(target.edges.length, target.ids.length - 1); - assert.ok(target.edges.every(edge => typeof edge.relation === 'string' && edge.relation.length)); + assert.equal(target, undefined); const nested = paths.find(path => path.ids.at(-1) === 'math.rn-count-interface'); assert.ok(nested); assert.ok(nested.ids.includes('math.rn-fixed-remote-window')); + assert.equal(nested.ids[0], 'math.rn-mesoscopic-reduction'); + assert.equal(nested.edges.length, nested.ids.length - 1); + assert.ok(nested.edges.every(edge => edge.required && edge.relation.length)); + + const annulusPaths = dependencyPaths(index, 'math.rn-fixed-annulus-window'); + assert.deepEqual(annulusPaths.map(path => path.ids.at(-1)), ['math.rn-count-interface']); + assert.ok(!annulusPaths.some(path => path.ids.includes('regional.fixed-annulus.high-jet-route'))); + assert.ok(!annulusPaths.some(path => path.ids.includes('hist.CH-LIFT'))); }); test('saved node links fail visibly instead of selecting an unrelated node', async () => { @@ -185,6 +211,7 @@ test('the viewer page exposes its source boundary and accessible interaction con assert.match(app, /popstate[\s\S]*writeURL:\s*false,\s*focus:\s*false/); assert.match(app, /prepareInitialSelectionRestore/); assert.match(app, /\['wheel',[\s\S]*'pagehide'\]/); + assert.match(app, /event\.type === 'focusin'[\s\S]*node-detail/); assert.match(app, /requestAnimationFrame/); assert.match(app, /scrollIntoView\(\{\s*block:\s*'start',\s*behavior:\s*'instant'\s*\}\)/); assert.match(app, /dependencyPaths/); diff --git a/tests/test_public_shop_browser_contract.py b/tests/test_public_shop_browser_contract.py index 234ef4571..1a2b3266e 100644 --- a/tests/test_public_shop_browser_contract.py +++ b/tests/test_public_shop_browser_contract.py @@ -61,6 +61,11 @@ def test_reader_tools_have_desktop_and_mobile_browser_evidence(self): 'Pinned Math commit 7858329974e2', 'math.rn-fixed-annulus-window', 'Saved selection unavailable', 'to_be_focused', 'post-layout saved-link focus', 'https://github.com/d6g8k5htny-coder/main/blob/e60629edde151c27541847b61672e38965752b77/docs/research-translation/20260930/EXPERIMENT.md#1-freeze-the-observable-before-generating-data', + 'https://github.com/d6g8k5htny-coder/Math-/blob/7858329974e28be79f29b22644370084ff43da4f/frontiers/three_fronts_20260924/LIFETIME_REMAINDER.md', + 'https://github.com/d6g8k5htny-coder/main/issues/67#issuecomment-5841782206', + '#dependency-paths > li', + 'strong:text-is("math.lifetime-remainder")', + 'required dependency path and actionable source/review metadata', 'dated claim-dependency snapshot', 'page.keyboard.press("Tab")', 'page.keyboard.press("Enter")', 'documentElement.scrollWidth', diff --git a/tools/public_shop_browser_check.py b/tools/public_shop_browser_check.py index 0dd63df05..821573ddb 100644 --- a/tools/public_shop_browser_check.py +++ b/tools/public_shop_browser_check.py @@ -263,6 +263,21 @@ def check_reader_tools_flow(page, origin, expect, result, output): expect(page.locator("#node-detail")).to_be_focused() expect(page.locator("#node-metadata")).to_contain_text("Review source") expect(page.locator("#node-metadata")).to_contain_text("reviews/pr22_fixed_annulus_nonauthor_20260925/REVIEW.md") + expect(page.locator("#dependency-paths > li")).to_have_count(1) + expect(page.locator("#dependency-paths > li")).to_contain_text("math.rn-count-interface") + expect(page.locator("#dependency-paths")).not_to_contain_text("hist.CH-LIFT") + page.locator("#dependency-search").fill("math.lifetime-remainder") + remainder_result=page.locator( + '#search-results button:has(strong:text-is("math.lifetime-remainder"))' + ) + expect(remainder_result).to_have_count(1) + remainder_result.click() + expected_remainder_source="https://github.com/d6g8k5htny-coder/Math-/blob/7858329974e28be79f29b22644370084ff43da4f/frontiers/three_fronts_20260924/LIFETIME_REMAINDER.md" + expected_remainder_review="https://github.com/d6g8k5htny-coder/main/issues/67#issuecomment-5841782206" + expect(page.locator(f'#node-metadata a[href="{expected_remainder_source}"]')).to_have_count(1) + expect(page.locator(f'#node-metadata a[href="{expected_remainder_review}"]')).to_have_count(1) + result["steps"].append("required dependency path and actionable source/review metadata checked") + page.goto(origin+"dependencies.html?node=math.rn-fixed-annulus-window#node-detail") require(parse_qs(urlsplit(page.url).query)=={"node":["math.rn-fixed-annulus-window"]},"Saved dependency selection missing") page.reload() expect(page.locator("#detail-heading")).to_have_text("math.rn-fixed-annulus-window",timeout=45000)