Repository navigation
test(api): cover canonical url-slug redirects for datasets, AI models, use cases (DataSpaceFrontend#524, #525) - #253
Merged
Conversation
…, use cases (DataSpaceFrontend#524, #525)
saqibmanan
force-pushed
the
test-sync/DataSpaceFrontend-pr525
branch
from
November 13, 2026 19:03
4bbb145 to
fd645bf
Compare
saqibmanan
marked this pull request as ready for review
November 13, 2026 19:36
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.
Source
dev2026-11-06T06:24:34Z, merge commite4f3783d9f9ca9236e85986d54a17933bb5f92ff.dev2026-11-06T07:44:43Z, merge commit8c4d7c62a7d555870677c9c4e76a638fdc2e7e9e.Both on the same
provider-flow-updatebranch, ~80 minutes apart. #525 is a same-day refactor of #524's own feature (moves queries intoqueries.tsfiles, deleteslib/canonical-redirect.ts, simplifies the redirect condition to fire only for a legacy integer/UUID id). Treated as one coverage unit: what matters is the behaviour that survived into the final, deployed state, not either diff in isolation.Confirmed deployed:
DataSpaceFrontend"Deploy DataSpace" run for the #525 merge commit (run 42182886658) completed withpromote→ success androllback→ skipped. Live on dev now.What actually changed (from the diff, not the titles)
lib/public-link.ts(new) introducesisUuid,isIntegerId,publicHref,publicPageUrl,datasetLookup,aiModelLookup. Applied to:/datasets/[datasetIdentifier],/aimodels/[modelId],/usecases/[useCaseSlug]now 308-redirect a legacy raw id (dataset UUID, AI model/use case integer id) to/<section>/<urlSlug>. Visiting theurlSlugaddress directly serves with no further redirect.Datasets/UseCases,ListingComponent, publishers'Datasets/UseCases, search'sUnifiedListingComponent, datasetSimilarDatasets/DatasetConnected, usecaseDatasetStories, the AI model/use case publish-preview links, and thecollaborativesdetail page all switched from linking by rawidtourlSlug(falling back toid).app/sitemap/[entityPage]/route.ts): dataset/aimodel/usecase<url><loc>entries switched from rawidtourlSlug.DatasetDetailsPage's chart-count query and analyticstrackDatasetcall now wait for the dataset's real UUID (recordId, from the GraphQL response) instead of firing on whatever string is in the URL — needed because that URL segment can now be a slug, not a UUID.Categories added, and why
Per the test-sync policy's §3 (new/changed UI page behaviour →
smoke, +functional), and since the whole user-visible surface here is "does the right page load at the right address" — a smoke-level concern. Added totests/api/smoke/test_api_053_canonical_url_slug_redirect.py:test_dataset_legacy_id_redirects_to_canonical_slugtest_aimodel_legacy_id_redirects_to_canonical_slugtest_usecase_legacy_id_redirects_to_canonical_slugtest_dataset_canonical_slug_serves_without_redirectingtest_aimodel_canonical_slug_serves_without_redirectingtest_usecase_canonical_slug_serves_without_redirectingAll unauthenticated (public detail pages, no login) — this run has no test credentials, so coverage is scoped to what can be proven without them.
Not
readonly:git merge-base --is-ancestor 8c4d7c62a7d555870677c9c4e76a638fdc2e7e9e origin/mainon DataSpaceFrontend is false — this hasn't shipped tomain/prod. Prod's backend GraphQL schema doesn't even have aurlSlugfield yet (Cannot query field 'urlSlug' on type 'TypeDataset', confirmed live againstapi.datakeep.civicdays.in). Marking thisreadonlywould fail every DataSpaceBackend/DataSpaceFrontendmaindeploy's smoke gate until the backend half ships too. Gated withdeployed_pr("DataSpaceFrontend#525", site="HOME_URL_DEV")instead — skips wherever the frontend under test doesn't yet serve the merge commit, and turns on by itself once it does. Follow-up: addreadonlyonce #525 is onmain.Red → green proof
GREEN, today, on dev (
HOME_URL_DEV=https://dev.civicdataspace.in API_BASE_URL=https://dev.api.civicdataspace.in):RED, today, on prod (
HOME_URL_DEV=https://civicdataspace.in API_BASE_URL=https://api.datakeep.civicdays.in), which still runs the pre-#524 code — a real "parent commit" red, not a flipped assertion. Ran with thedeployed_prmarker temporarily stripped locally (restored before committing — final diff has no test-content changes, only the marker gate):(Only the 3 legacy-id tests are schema-safe to point at prod — the 3 canonical-slug tests query
urlSlugin their fixtures, which doesn't exist on prod's backend schema, so they're dev-only by construction and weren't part of the red run.)With the
deployed_prmarker restored and pointed at prod, the 3 legacy-id tests correctly skip instead of failing:deployed_pr DataSpaceFrontend#525: https://civicdataspace.in runs 92cd5219, which doesn't include 8c4d7c62 yet— confirming the gate itself works.Collection check, matching
run-smoke.yml's realpull_requestfilter (tests/api/smoke -m smoke):Gaps — deliberately not covered here
urlSlug(home, search, publishers,SimilarDatasets,DatasetConnected,DatasetStories, collaboratives) — this is React-client-rendered (confirmed:curl'ing/datasetsreturns no server-renderedhrefin the initial HTML), so checking it needs a real browser, not an HTTP client. This cloud run has no credentials but these are public pages, so a browser check wouldn't need any — it's simply out of scope for an HTTP-only unauthenticated pass. A local/authenticated run should add a Selenium check (existinglocators//pages/Page Objects for dataset/use case listing cards) asserting cardhrefs end in the item'surlSlug, not its rawid.urlSlug(app/sitemap/[entityPage]/route.ts) — untestable right now: dev's sitemap is disabled by design (DataSpaceFrontend#493, covered bytest_api_027_dev_noindex.py; confirmed live:/sitemap.xmlon dev returns "Sitemaps are not enabled"), and the feature isn't on prod yet either. Once #525 (or whichever PR carries it) reachesmain, extendtest_api_006_seo_sitemap.py's prod checks to assert dataset/aimodel/usecase<url><loc>entries end in the backend'surlSlug, cross-checked per record, not just that the count matches.DatasetDetailsPage's chart-count/analytics fix (waiting forrecordIdbefore firing) — a real bug fix bundled into this diff, but it only matters once a dataset is reached by its slug (which the canonical-redirect tests above already exercise end-to-end as part of a normal page load); no separate assertion added, since the existing chart-count and analytics calls aren't independently observable without a browser and TanStack Query internals.regressionmarker used:regressionis never selected by any CI event here (deselected on push/PR/dispatch alike), so aregression-only test would merge and silently never run. Everything above carriessmoke+apiinstead.Safe to merge
Yes — not gated on the backend shipping anything further;
deployed_prhandles the only real hazard (dev rolling back or not yet carrying #525), and this file is notreadonlyso it never touches themain-deploy prod gate.