Commit 562d385
authored
docs: detect orphaned URLs, restore deleted-tutorial redirects, restructure llms.txt (#23567)
## Why
An agent pointed at docs.aztec.network hit 404s, gave up, fell back to
stale training data, and missed `SingleUseClaim` (the right primitive).
Causes: pages deleted without redirects, and `llms.txt` truncating its
API index at 100 of ~1,300 entries (alphabetical, hiding everything past
`m`).
Three fixes + a CI guard so the deletion case can't recur silently.
## What changed
**1. Orphan-URL detection** — `docs/scripts/check_orphaned_urls.sh`
(new)
- Flags any baseline URL that no longer resolves **and** has no
`netlify.toml` redirect (inverse of `validate_redirect_targets.sh`).
- Handles `*` splat / `:name` placeholders. `FAIL_ON_ORPHAN=1` = hard
gate (default warn-only).
**2. Restored redirects** — `docs/netlify.toml`
- 301s for 5 previously-404 pages (4 deleted in #16788, + bare
`/developers/getting_started`), e.g. `private_voting_contract` →
`state_variables` (where `SingleUseClaim` lives).
**3. llms.txt restructure** — `docs/scripts/append_api_docs_to_llms.js`
- Spec-compliant root: single H1 + `>` summary, `llms-full.txt` link up
top, droppable `## Optional` section
([awesome-aztec](https://github.com/AztecProtocol/awesome-aztec)).
- Hub-and-spoke (Cloudflare/Next/Svelte pattern): root `## API
Reference` is now 2 links, not a ~286-module dump (root API content 84
KB → <1 KB).
- Full per-symbol index moves to scoped files an on-task agent fetches:
`aztec-nr-api/mainnet/llms.txt` (~286 modules, structs/traits/fns inline
— `SingleUseClaim` stays grep-able) and
`typescript-api/mainnet/llms.txt`. Each is its own single-H1 doc.
`llms-full.txt` unchanged.
- Fail-loud sentinel: build aborts if the rustdoc index collapses below
floors (≥50 modules, ≥100 item names; currently 286/662), so a future
nargo HTML change can't silently gut the symbol index.
- Build: bare `docusaurus` → `yarn docusaurus` in `package.json` +
`clean.sh` (use repo-pinned binary, not global PATH).
**4. CI guard** — `docs/bootstrap.sh` +
`docs/snapshots/published-urls.txt`
- `check_orphaned_urls` runs on every docs PR with `FAIL_ON_ORPHAN=1`.
Catches accidental deletion-without-redirect (the incident class above).
- Baseline is read from the **base branch** (`git show
origin/$GITHUB_BASE_REF:…`), not the working tree, so a PR can't weaken
its own gate by editing the snapshot. (This PR introduces the file, so
it falls back to the working-tree snapshot for itself; tamper-resistance
applies to every PR after merge.)
- `refresh_url_snapshot.sh` only grows the protected set (registering
newly-published pages); retiring a page needs just the redirect, not a
snapshot edit.
## Test plan
- [x] `validate:redirects` + `validate:api-ref-links` clean
- [x] `check_orphaned_urls.sh`: 162 resolved, 0 orphaned; flags
synthetic deletions
- [x] Full `yarn build`: root single-H1 + `llms-full.txt` link + `## API
Reference` (2 dynamic-version links) + `## Optional`; scoped indexes
single-H1, `SingleUseClaim` present, 9 TS package links
- [x] No-API build: only `## Optional`, single H1, no scoped files
- [x] Sentinel fires (exit 1) when the rustdoc index is forced below the
floor
- [x] Base-branch baseline sourcing verified (falls back to working-tree
snapshot for this introducing PR, as designed)
- [x] `refresh_url_snapshot.sh` idempotent; Codex reviewed
- [x] [Netlify
preview](https://deploy-preview-23567--aztec-docs-dev.netlify.app): all
5 redirects 301 to targets that resolve 200; `/llms.txt`,
`/llms-full.txt`, `/aztec-nr-api/mainnet/llms.txt`,
`/typescript-api/mainnet/llms.txt` all serve 200; scoped module links
resolve
Refs: #16788, #17168, #23572 (scoped-index split, merged here).12 files changed
Lines changed: 1028 additions & 54 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
56 | 104 | | |
57 | 105 | | |
58 | 106 | | |
| |||
81 | 129 | | |
82 | 130 | | |
83 | 131 | | |
| 132 | + | |
84 | 133 | | |
85 | 134 | | |
86 | 135 | | |
87 | 136 | | |
88 | 137 | | |
| 138 | + | |
89 | 139 | | |
90 | 140 | | |
91 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
| 444 | + | |
444 | 445 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
428 | 459 | | |
429 | 460 | | |
430 | 461 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
0 commit comments