Redirect the legacy transaction guide - #147
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The redirect and its regression test currently cover only /learn/transactions and not the trailing-slash legacy route referenced in the PR description (/learn/transactions/).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the docs site’s redirect configuration to permanently route the legacy transactions guide URL to the canonical DuskDS transaction-models guide, and adds a regression test to prevent accidental removal of that redirect.
Changes:
- Add a redirect from
/learn/transactionsto/learn/deep-dive/duskds-tx-modelsinastro.config.js. - Add a machine-file regression test that asserts the redirect mapping exists in the Astro config.
File summaries
| File | Description |
|---|---|
astro.config.js |
Adds the legacy transactions redirect entry to the site redirect map. |
test/machine-files.test.mjs |
Adds a regression test that checks the redirect is present in configuration. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
The redirect/test currently assert a non-trailing-slash destination, which conflicts with the trailing-slash canonical target described in the PR and can introduce canonical/normalization inconsistencies.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
test/machine-files.test.mjs:57
- The fallback page's canonical link is asserted without a trailing slash, but the canonical URL for this doc appears to be the trailing-slash form (
.../duskds-tx-models/). Updating the assertion keeps the test consistent with the intended canonical URL.
assert.match(
redirectPage,
/<link rel="canonical" href="https:\/\/docs\.dusk\.network\/learn\/deep-dive\/duskds-tx-models">/,
);
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
There was a problem hiding this comment.
🟢 Approval recommended
The changes are small, consistent with the described Cloudflare-owned production redirect approach, and add a concrete build-output validation test.
Review details
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
test/machine-files.test.mjs:52
- The meta-refresh assertion is tightly coupled to a single HTML serialization (attribute order + double quotes + no whitespace). Since this is generated output, minor Astro/minifier changes could make the test fail without changing the redirect behavior; prefer a more tolerant regex that validates semantics.
This issue also appears on line 53 of the same file.
test/machine-files.test.mjs:57
- The
noindexand canonical assertions also depend on exact quoting/attribute formatting in the generated HTML. Using a slightly more flexible regex (like the existing sitemap assertion does) reduces false failures while still validating the page isnoindexand points to the intended canonical URL.
assert.match(redirectPage, /<meta name="robots" content="noindex">/);
assert.match(
redirectPage,
/<link rel="canonical" href="https:\/\/docs\.dusk\.network\/learn\/deep-dive\/duskds-tx-models\/">/,
);
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
Summary
/learn/transactions/route to the canonical DuskDS transaction-model guidenoindex, and canonical destinationProduction redirect
Deployed and enabled the Cloudflare Bulk Redirect list
docs_legacy_redirectsthrough ruledocs_legacy_redirects_301.Configured entries:
https://docs.dusk.network/learn/transactionshttps://docs.dusk.network/learn/transactions/Canonical target:
https://docs.dusk.network/learn/deep-dive/duskds-tx-models/Both entries use HTTP 301 and preserve query strings. Live GET verification confirms:
The Cloudflare list contains both exact source variants. Cloudflare executes Single Redirects before Bulk Redirects, which explains the additional normalization hop for the no-slash request.
Validation
npm run verifypassedgit diff --checkpasseddist/learn/transactions/index.htmlcontains the expected instant redirect,noindex, and canonical destinationBuild docs and validate linkspassed for84283b7d5fcad11d76544d3c94fde4f7c7d6a650