Feature/davereinhart/617/tmp urn redirect - #720
Draft
davereinhart wants to merge 2 commits into
Draft
Conversation
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
marked this pull request as draft
September 2, 2026 22:55
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.
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
useCanonicalUrncomposable 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
useCanonicalUrninto theExperimentSetView,ExperimentView,ScoreSetCalibrationsView, andScoreSetViewcomponents 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
useCanonicalUrnto verify correct route replacement behavior in various scenarios, including query/hash preservation, sub-resource routes, and edge cases.Refs: #617 , VariantEffect/mavedb-api#863