Fix embedding-plot click-through (404 on every point)#148
Merged
Conversation
…href map The UMAP and sfdp-graph pages recomputed each trait's page URL client-side as `CATEGORY_DIR[d.category]/slugify(d.label).html`. Two bugs made this wrong: 1. `CATEGORY_DIR` is keyed UPPERCASE but `d.category` is lowercase (and already equals the directory slug), so the lookup always missed and every one of the 477 points navigated to a non-existent `traits/other/...` page (0/477 resolved). 2. Trait page filenames are the YAML file stems, which spell digits as words (`dicarboxylate_four_hydroxybutyrate_cycle`) and use abbreviations (`reductive_tca_cycle`); no label-slugifier can reproduce those. Fix: stop recomputing slugs in the browser. The renderer already knows the authoritative id→page map (`page_path`), so inject it as `HREF_BY_ID` and have the click handler look up `HREF_BY_ID[d.id]` directly. Now 477/477 points link to a real page, and the link is immune to future label/filename drift. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
11 tasks
Contributor
Author
|
Reviewed the PR's own diff (source templates + renderer; regenerated pages are consistent). Clean — no issues. The fix is correct:
(Minor, non-blocking: the now-unused |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Both embedding pages (
umap.html,graph.html) recomputed each trait's page URL in the browser asCATEGORY_DIR[d.category]/slugify(d.label).html. Two defects:CATEGORY_DIRis keyed UPPERCASE, but the data'scategoryis lowercase and already equals the directory slug — soCATEGORY_DIR[d.category]was alwaysundefined, and every one of the 477 points fell through to a non-existenttraits/other/…page. 0/477 resolved.dicarboxylate_four_hydroxybutyrate_cycle) and use abbreviations (reductive_tca_cycle). No client-side label-slugifier can reproduce those.Surfaced by a front-end design review against the
dataviz/artifact-designskills.Fix
Stop recomputing slugs client-side. The renderer already builds the authoritative id→page map (
page_path), so inject it into the two templates asHREF_BY_IDand have the click handler useHREF_BY_ID[d.id]directly.Verification
Recomputed every point's click target against files on disk:
Immune to future label/filename drift since the href is now data, not a re-derivation.
Files:
scripts/render_trait_pages.py(inject map),src/traitmech/templates/{umap,graph}.html, regeneratedpages/{umap,graph}.html.🤖 Generated with Claude Code