Skip to content

fix(routing): open the pathway a legacy news link points at - #172

Merged
adamjohnwright merged 1 commit into
mainfrom
fix/legacy-pathway-hash-links
Sep 4, 2026
Merged

fix(routing): open the pathway a legacy news link points at#172
adamjohnwright merged 1 commit into
mainfrom
fix/legacy-pathway-hash-links

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

86 links in this site's own news archive open the pathway browser with nothing in it.

They are the old browser's fragment links, and they come in two spellings because the old site produced both:

in the content count today
#/R-HSA-1430728 770 opens the pathway
#R-HSA-202733 41 blank page
#R-HSA-8853659.1 45 blank page

FRAGMENT_PATTERN required the leading slash:

/\/(?<id>R-[A-Z]{3}-\d+)?&?(?<params>.*)/

Without a slash there is no match at all, so no id is extracted and the browser opens on no pathway — from a link in a release announcement, which is exactly where someone arrives from a citation.

The fix

The slash is optional and the id is required. Requiring the id is what keeps a fragment that is not a pathway — #introduction, naming a section to scroll to — falling through untouched instead of being read as a stale route.

A trailing stIdVersion is consumed and dropped: the content service does not want it, and it used to arrive as a query parameter literally named .1.

Verified on beta

link before after
#R-HSA-913531 empty opens (illustrated pathway)
#R-HSA-202733 empty opens, 440 elements
#R-HSA-8853659.1 empty opens, 162 elements, version dropped
#/R-HSA-447115 517 elements unchanged
#/R-HSA-8876384&PATH=… works unchanged, path preserved

The test cases are taken from what is actually in the content rather than invented, and they fail against the old pattern: bare id and version go red, the four that already worked stay green.

Not covered

37 links spell #TOOL=AT, the old analysis-tool fragment. They fall through as before rather than opening anything. Where they should land is a product decision rather than a regex — happy to wire it up once someone says where.

86 links in this site's own news archive open the pathway browser with
nothing in it. They are the old browser's fragment links, and they come in
two spellings because the old site produced both:

    #/R-HSA-1430728    770 links, work
    #R-HSA-202733       41 links, blank page
    #R-HSA-8853659.1    45 links, blank page

FRAGMENT_PATTERN required the leading slash. Without one nothing matched,
so no id was extracted and the browser opened on no pathway -- from a link
in a release announcement, which is where someone arrives from a citation.

The slash is now optional and the id is required, which is what keeps a
fragment that is not a pathway -- `#introduction`, naming a section to
scroll to -- falling through untouched instead of being read as a stale
route. A trailing stIdVersion is consumed and dropped: the content service
does not want it, and it used to arrive as a query parameter called ".1".

Verified on beta: all three previously blank forms now open their pathway,
and the two that already worked are unchanged, parameters included. The
test cases are taken from what is actually in the content rather than
invented, and fail against the old pattern -- bare id and version go red,
the four that already worked stay green.

Not covered: 37 links spelling `#TOOL=AT`, the old analysis tool fragment.
They fall through as before rather than opening anything, and where they
should land is a product decision rather than a regex.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright enabled auto-merge (squash) September 4, 2026 23:23
@adamjohnwright
adamjohnwright merged commit 5eeef11 into main Sep 4, 2026
6 checks passed
@adamjohnwright
adamjohnwright deleted the fix/legacy-pathway-hash-links branch September 4, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant