Skip to content

Feature/davereinhart/617/tmp urn redirect - #720

Draft
davereinhart wants to merge 2 commits into
release-2026.3.0from
feature/davereinhart/617/tmp-urn-redirect
Draft

Feature/davereinhart/617/tmp urn redirect#720
davereinhart wants to merge 2 commits into
release-2026.3.0from
feature/davereinhart/617/tmp-urn-redirect

Conversation

@davereinhart

@davereinhart davereinhart commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a new composable, useCanonicalUrn, to ensure that the address bar always displays the canonical URN for datasets, especially after publishing when a temporary URN is replaced by a permanent one. The composable is integrated into several views to automatically update the route if the loaded record's URN differs from the one in the URL. Additionally, comprehensive tests are added for this new behavior.

New feature: Canonical URN routing

  • Added the useCanonicalUrn composable to watch for changes in a loaded item's URN and replace the route with the canonical URN if necessary. This prevents users from bookmarking or sharing outdated, retired URNs.

Integration into views

  • Integrated useCanonicalUrn into the ExperimentSetView, ExperimentView, ScoreSetCalibrationsView, and ScoreSetView components to ensure the canonical URN is always reflected in the URL after the record loads. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Testing

  • Added a dedicated test suite for useCanonicalUrn to verify correct route replacement behavior in various scenarios, including query/hash preservation, sub-resource routes, and edge cases.

Refs: #617 , VariantEffect/mavedb-api#863

Publishing a dataset replaces the tmp: URN it was created with by a
permanent one, and the API forwards a read of the retired URN to the
published record with a 308. The request follows that redirect on its
own, so the record loads, but the address bar still names a URN that no
longer resolves, and that is the URL someone would copy, bookmark or
share.

useCanonicalUrn watches the loaded record and replaces the route once it
reports a URN that differs from the one the route asked for. It replaces
rather than pushes, so the retired URN does not become a history entry
to go back to, and it rebuilds the target from the route name so path
suffixes survive: /score-sets/:urn/calibrations keeps its suffix, and
the query and hash come along untouched.

Changing the urn route param reloads the record, so arriving by a
retired link now loads it twice. That is the cost of a rare path that
used to 404 outright.

Wired into the four screens that resolve a dataset by URN. Each needed
its useItem call pulled out into a local binding so the item ref could
be handed to the composable before being spread into the setup return.
Stubs vue-router so the composable can be exercised on its own, without
mounting a component or standing up a real router, and asserts on what
the router was told to do.

Covers the replacement itself: the shape of the replace call, that the
query and hash come along, and that a sub-resource route rebuilds under
its own name so /score-sets/:urn/calibrations keeps its suffix.

The remaining four cases are the ones that should leave the address bar
alone: the record already answers to the URN asked for, no record has
arrived yet, the record reports no URN, and the route has no name to
rebuild it from.
@davereinhart
davereinhart marked this pull request as draft September 2, 2026 22:55
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 10.496% (+0.2%) from 10.271% — feature/davereinhart/617/tmp-urn-redirect into release-2026.3.0

@davereinhart davereinhart linked an issue Sep 2, 2026 that may be closed by this pull request
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.

Forwarding tmp URN to the new published record

2 participants