Repository navigation
Deadlines on the catalog client, and the legacy dataset rewrite - #192
Merged
Merged
Conversation
Deploying nemar-website with
|
| Latest commit: |
b1253ab
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b36e8ad9.nemar-website.pages.dev |
| Branch Preview URL: | https://fix-resolve-canonical-deadli.nemar-website.pages.dev |
This was referenced Jul 26, 2026
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.
Two changes on the path legacy citation URLs will travel after the apex cutover (#190). The first is a prerequisite for the second.
1. Deadlines on
src/lib/api.ts(website#173)All four fetches passed
signal: init.signal, which isundefinedwhenever the caller omits it — and no page caller passes one. Atry/catchcovers a request that fails; it does not cover one that opens and never writes a response. That promise never settles, so there is nothing to catch.resolveCanonicalis the one that mattered: it runs during SSR of everyds*dataset page, which after cutover is the path every legacy citation URL travels. A hung upstream there stalls the render rather than degrading it.Added the same
resolveSignal()pattern the admin clients already use, plus an optionaltimeoutMs.Scope:
api.tsonly. The same bug class remains inadmin-api.ts,collaborators-api.ts,dashboard-api.tsanddir-listing.ts— 10 more instances, all on authenticated surfaces with smaller blast radius. Those stay under #173 rather than being swept into a PR about the citation path.2. Legacy dataset URL rewrite (#190 §2)
After cutover
nemar.orgpoints at this build, so/dataexplorer/detaillands here with no route and would 404. Handled inmiddleware.ts— where the other redirects live, and the only place with both the query string and theRefererheader.Two audiences want opposite things from the same URL:
302/dataset/<id>on the new site301302for the ww1 bounce is deliberate. ww1 retires, and a cached permanent redirect would outlive it with no way to reach the clients holding it — the hazard #183 was filed for. The move to the new site is genuinely permanent, so that one is301. Both carryno-store, which matters doubly here because the response varies byRefererand caching it would serve one audience's answer to the other.Absent
Referermeans "new site", deliberately. It is unreliable — stripped by privacy modes, absent on typed and bookmarked navigation — so the default has to be the citation case, which is the one that must not break.The id is passed through untranslated
/dataset/ds007964already resolves to/dataset/on007964, viaresolveCanonicaldoing a real catalog lookup (GET /datasets/resolve/<sourceId>). That is better than the prefix swap originally proposed in #190: it declines when no mirror exists instead of confidently redirecting to anonid that doesn't exist. Re-deriving the mapping in the rewrite would duplicate that rule and could disagree with it, so this layer only changes the path shape.It also means the rewrite works unchanged for
nm######(native, no mapping) and any future prefix.Testing
889 passing (17 new), typecheck / lint / build clean.
Unit coverage for the referrer asymmetry, the 301-vs-302 distinction, malformed and lookalike referers (
ww1.nemar.org.evil.testmust not bounce), id pass-through fords/nm/on, path-encoding of a hostile id, the no-id fallback, and trailing-slash/case tolerance. Plus middleware-level tests covering the wiring, since the pure function can't see theRefererheader.Verified end to end against a running server:
Note
This ships before the cutover, which is safe:
/dataexplorer/*is not a route on this build today, so the rewrite is inert onww2until the apex points here. Landing it early means the cutover is a DNS-and-constants change rather than a code change.