Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/site/dependencies.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h1>Claim dependency viewer</h1>
<article><h3>Consumes</h3><p class="muted">Edges point from a dependent claim to the source it consumes.</p><ul id="dependency-list" class="relation-list"></ul></article>
<article><h3>Consumed by</h3><p class="muted">Direct dependents recorded in this source snapshot.</p><ul id="dependent-list" class="relation-list"></ul></article>
</div>
<div class="path-panel"><h3>Paths to unresolved dependencies</h3><p class="muted">Shortest source-edge paths found below the selected node. A missing path is not evidence that no dependency exists outside this snapshot.</p><ol id="dependency-paths" class="path-list"></ol></div>
<div class="path-panel"><h3>Paths to unresolved dependencies</h3><p class="muted">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.</p><ol id="dependency-paths" class="path-list"></ol></div>
</div>
</section>

Expand Down
15 changes: 12 additions & 3 deletions docs/site/dependencies.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 });
Expand Down
25 changes: 24 additions & 1 deletion docs/site/dependency-model.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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'],
Expand All @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
37 changes: 32 additions & 5 deletions tests/test_dependency_viewer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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 () => {
Expand Down Expand Up @@ -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/);
Expand Down
5 changes: 5 additions & 0 deletions tests/test_public_shop_browser_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
15 changes: 15 additions & 0 deletions tools/public_shop_browser_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading