Repository navigation
Speed up site build with Astro 7.4 parallel prerender and incremental builds - #1927
Sébastien Ros (sebastienros) wants to merge 1 commit into
Conversation
…ntal builds Upgrade to Astro 7.4.1 and enable experimental.parallelPrerender (4 workers, override with ASPIRE_PRERENDER_WORKERS) and incrementalBuild. - API reference and glossary routes pass package names and indexes in props instead of whole documents, so worker-thread prop cloning stays cheap. - API reference and OG card routes return a cacheKey so unchanged pages are reused between builds. - Patch Astro 7.4.1 so imported SVG components don't break structured clone in the prerender worker. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 7fae752f-9a4b-40b9-afa8-fe291e54acb6
There was a problem hiding this comment.
🔵 Needs a closer look
The patched experimental build pipeline needs target-runner validation, and the Markdown processor peer-version mismatch remains unresolved.
1 open issue
What changed in this PR
Speeds up aspire.dev’s static build by enabling parallel rendering and reuse of unchanged pages.
Changes:
- Upgrades Astro to 7.4.1 and patches SVG metadata serialization.
- Reduces API and glossary route props to lower worker memory usage.
- Adds API and social-card cache keys and updates route tests.
| File | Description |
|---|---|
src/frontend/tests/unit/ts-api-route-catalog.vitest.test.ts |
Adapts catalog assertions to resolved documents. |
src/frontend/tests/unit/api-markdown.vitest.test.ts |
Updates member-route assertions. |
src/frontend/src/utils/ts-modules.ts |
Adds module lookup by package name. |
src/frontend/src/utils/ts-api-routes.ts |
Resolves handle methods by index. |
src/frontend/src/utils/packages.ts |
Adds package document lookup. |
src/frontend/src/utils/og-cache-key.ts |
Hashes card inputs and renderer assets. |
src/frontend/src/utils/api-cache-key.ts |
Provides document-based cache keys. |
src/frontend/src/pages/reference/api/typescript/[module]/index.astro |
Adds module-page caching. |
src/frontend/src/pages/reference/api/typescript/[module]/[item]/index.astro |
Reduces props and adds caching. |
src/frontend/src/pages/reference/api/typescript/[module]/[item]/[member]/index.astro |
Uses indexed member props and caching. |
src/frontend/src/pages/reference/api/typescript/[module]/[item]/[member].md.ts |
Resolves indexed members for Markdown. |
src/frontend/src/pages/reference/api/typescript/[module]/[item].md.ts |
Loads module data during rendering. |
src/frontend/src/pages/reference/api/typescript/[module].md.ts |
Adds module Markdown caching. |
src/frontend/src/pages/reference/api/csharp/[package]/index.astro |
Adds package-page caching. |
src/frontend/src/pages/reference/api/csharp/[package]/[type]/index.astro |
Reduces type-page props and adds caching. |
src/frontend/src/pages/reference/api/csharp/[package]/[type]/[memberKind].md.ts |
Resolves package data for member Markdown. |
src/frontend/src/pages/reference/api/csharp/[package]/[type]/[memberKind].astro |
Reduces member-page props and adds caching. |
src/frontend/src/pages/reference/api/csharp/[package]/[type].md.ts |
Resolves package data for type Markdown. |
src/frontend/src/pages/reference/api/csharp/[package].md.ts |
Adds package Markdown caching. |
src/frontend/src/pages/og/[...slug].ts |
Adds social-card cache keys. |
src/frontend/src/pages/hub/glossary/[term].astro |
Resolves glossary entries during rendering. |
src/frontend/pnpm-workspace.yaml |
Registers Astro patch and release-age exception. |
src/frontend/pnpm-lock.yaml |
Locks updated dependencies and patch. |
src/frontend/patches/[email protected] |
Makes SVG metadata cloneable. |
src/frontend/package.json |
Upgrades Astro dependency. |
src/frontend/astro.config.mjs |
Enables parallel and incremental builds. |
Review effort: Balanced
| "@mdx-js/mdx": "^3.1.1", | ||
| "asciinema-player": "^3.17.0", | ||
| "astro": "^7.2.8", | ||
| "astro": "^7.4.1", |
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
…tal builds (#1929) ## Summary <!-- Describe what this pull request changes and why. --> Explores incremental builds, parallel prerender and Bun together, based on `main`. Only the build changes are here; the hybrid API work stays in #1874, which targets `release/17.0`. An earlier version of this branch targeted `release/17.0` and also shared contributor fetches across prerender workers. `main` now pre-generates contributor data (#1803), so that change is dropped. - **Parallel prerender and incremental builds:** Sébastien Ros's #1927 (Astro 7.4 `experimental.parallelPrerender` and `incrementalBuild`, plus `cacheKey` refactors for the glossary, API and OG routes) is the first commit, applied unchanged with his authorship kept. Whichever of #1927 and this PR merges second rebases and drops it. This PR also fixes a quadratic comparison in `ts-api-route-catalog.vitest.test.ts` (about 34 s down to about 1.6 s in a local run). Astro is then bumped to 7.4.2 (the structured-clone patch is renamed and applies unchanged), and the TypeScript item Markdown routes now take an item index instead of the whole item: parallel prerender workers get a structured clone, so a slug lookup by identity fell back to the unsuffixed slug for a duplicate handle such as `thing-thing-2`. - **Bun replaces pnpm** (1.4.3) for installs and scripts. `bun.lock` is migrated from `pnpm-lock.yaml`, and the pnpm workspace settings move to `package.json` (`overrides`, `patchedDependencies`, `trustedDependencies`) and `bunfig.toml` (one-day release age gate). The `devalue` override from #1940 moves with them (`devalue@<5.9.3` resolves to 5.9.4). `patches/README.md` keeps the patch rationale that lived in `pnpm-workspace.yaml` comments. - **The production Astro build runs on the Bun runtime** (`bunx --bun astro build`). Dev, preview, Vitest, ESLint and Playwright stay on Node. Two Bun differences are handled in config: - `ec.config.mjs` imports the `starlight-plugin-icons` TypeScript source natively, because Bun has no Node module hooks, which `tsx` needs. - `astro.config.mjs` defaults `process.env.BASE_URL` to `/`. Bun resolves `import.meta.env` to `process.env`, and `starlight-links-validator` reads `import.meta.env.BASE_URL`, so without it `astro:build:done` crashed with `undefined is not an object (evaluating 'path.replace')`. - **CI:** `frontend-build`, `indexnow` and `update-integration-data` use the SHA-pinned `oven-sh/setup-bun` action (`bun-version-file` points at `src/frontend/package.json`), then `bun install --frozen-lockfile`. The CodeQL ADO pipeline, dev container and Dependabot (`bun` ecosystem) are converted too. - **Astro build cache in `frontend-build`:** `node_modules/.astro` is restored on every run (keyed on `bun.lock`, `astro.config.mjs` and the patches) so incremental builds can skip unchanged pages. It is saved only by push builds and by a PR build that found nothing to restore, so each PR commit doesn't write another entry against the 10 GB repo cache limit. The job summary reports the restored key, exact hit and size. - **`Frontend Build` runs on the 8-core runner.** The `build` job in `frontend-build.yml` uses `8-core-ubuntu-latest` (runner group `aspire-runners`, granted to this repository in microsoft/github-operations#1993) when the repository owner is `microsoft`, and `ubuntu-latest` otherwise, because forks can't use the label. The other jobs stay on `ubuntu-latest`. With the same four prerender workers, the cold build step went from 731 s to 296 s and the job from 968 s to 417 s (see the timings below). - **One flaky E2E test is fixed.** The `a missing live API stays disabled across navigation and visibility changes until reload` test in `live-status.spec.ts` failed on CI runners where the real WCP script shows its consent banner: the test helper rejects it, WCP reloads the page, and `/api/live/` is requested a second time. The test now aborts the WCP script, as other specs already do. - **Docs, agents and skills** now say Bun. In the contributor guide, the prerequisites list Bun, the pnpm | npm install tabs became one `bun install` step with a note (other package managers ignore `bun.lock` and the patches), and the `pnpm` commands became `bun run ...`. `CONTRIBUTING.md`, `CODESPACES.md`, the agent instructions and the skills match, and the pnpm card is gone from the thanks page. The contributor data hint in `ContributorList.astro` (and its unit test) now says `bun run update:contributors`. Timings (four prerender workers throughout; `ubuntu-latest` is 4 vCPU and 16 GB, `8-core-ubuntu-latest` is 8 vCPU and 32 GB). The `main` rows are push builds of `main`, which has sequential prerender, Node and no cache: | Run | Runner | Prerender | Astro build step | `Frontend Build` job | | --- | --- | --- | --- | --- | | `main` push `a62b64bec` (this PR's earlier base) | `ubuntu-latest` | 18 m 22 s | 1,252 s | 1,471 s | | `main` push `6be625cd0` (a fast runner) | `ubuntu-latest` | 12 m 13 s | 826 s | 976 s | | `main` push `3120da6c3` (a fast runner) | `ubuntu-latest` | 11 m 36 s | 786 s | 934 s | | This PR, cold (no cache) | `ubuntu-latest` | 9 m 36 s | 732 s | 963 s | | This PR, cold (no cache), after the rebase | `ubuntu-latest` | 9 m 33 s | 731 s | 968 s | | This PR, warm cache, same commit (re-run) | `ubuntu-latest` | 3 m 27 s | 438 s | 650 s | | This PR, cold (no cache) | `8-core-ubuntu-latest` | 3 m 53 s | 296 s | 417 s | | This PR, cold (no cache), after the Astro 7.4.2 bump | `8-core-ubuntu-latest` | 3 m 49 s | 386 s | 534 s | | This PR, warm cache, same commit (re-run) | `8-core-ubuntu-latest` | 3 m 15 s | 297 s | 485 s | On the 8-core runner the cold build step took 296 s against 731 s on `ubuntu-latest` for the same content and the same four workers, and the job 417 s against 968 s. That is more than the doubled vCPU count alone explains, and I didn't isolate why (the runner also has twice the memory). The cold artifact upload went from 171 s to 87 s and the cache save from 29 s to 6 s. The warm re-run on the 8-core runner took the same 297 s: prerender was 38 s faster, but Vite (38 s to 64 s) and Pagefind (43 s to 66 s) were each about 25 s slower, which looks like run-to-run noise in a single sample, and its artifact upload took 146 s. So on the larger runner the incremental cache gains little, while on `ubuntu-latest`, which forks fall back to, it saved about 5 min. A second cold run on the 8-core runner, after the Astro 7.4.2 bump, took 386 s for the build step and 534 s for the job: prerender took the same time (3 m 49 s), but Vite (54 s), Pagefind (52 s) and the artifact upload (109 s) were each slower, so read the 8-core figures as a range (417 to 534 s for the job). Runner speed varies a lot, so a single run says little. `Frontend Build` on `main` took 15.6 to 27.0 min over its last 20 pushes (median 23.5 min), and the cold run on `ubuntu-latest` (16 m 03 s) sits inside that spread, level with `main`'s two fastest pushes. The cold 8-core jobs (6 m 57 s and 8 m 54 s) are far below that spread. Prerender is the cleaner comparison on `ubuntu-latest`: 9 m 36 s here against 11 m 36 s to 18 m 22 s on `main`. The warm re-run on `ubuntu-latest` took 10 m 50 s. Prerender is the phase that moved; on `ubuntu-latest` Vite (about 70 s) and Pagefind (about 2 min over roughly 32k HTML files) don't change with parallelism or caching. On the 8-core runner the cold Astro build took 4 m 55 s (Vite 38 s, prerender 2 m 57 s, Pagefind 43 s). In the warm re-run on `ubuntu-latest` the Astro build took 7 m 17 s (Vite 1 m 10 s, prerender 3 m 27 s, Pagefind 2 m). It restored 48,685 of 57,144 routes from the cache (24,057 API reference pages, 24,094 reference `.md` endpoints and 534 OG images) and re-rendered 8,459, 7,546 of them locale pages. Those routes have no `cacheKey` and are the floor for a warm build. The cache entry is about 164 MB. `main` has no Astro cache entry yet, so the first push build after merge is cold and saves the entry that later PR builds restore. An earlier version of this branch, based on `release/17.0`, measured 447 s and 465 s for warm builds of new commits, so read the warm numbers as a range. The whole workflow gained less than the build job, because E2E dominates it now. Each of the six Playwright shards downloads the roughly 2.1 GB `frontend-dist` artifact (about 30 s to 13 min, depending on the run) and then runs Playwright for about 7 to 15 min, which this PR doesn't change. On `main` pushes `ci-gate` took 33.5 to 65.2 min over the last 20 (median 43.6 min). With the 8-core build the last shard finished about 37 min after the run started in attempt 1 (one shard spent 10 min installing Playwright Chromium) and about 28 min after in attempt 2, against about 33 and 38 min with the `ubuntu-latest` build on the previous head. All of these are inside `main`'s existing range, because the faster build only moves the point where the shards start. Speeding up E2E (more workers per shard, a compressed E2E artifact, the 8-core runner for the shards) is left out of this PR because it can affect test reliability or, for the 8-core runner, multiply the larger-runner minutes. ### Risks to watch in CI - The Bun-runtime build has passed CI on the current head (run `40014533725`, cold) and on the previous one (run `39981757109`, cold and warm), including the E2E shards on the Bun-built output. If it misbehaves later, fall back to Node for Astro only: change `bunx --bun astro build` to `astro build` in the three `build*` scripts and `scripts/build-static-host.mjs`. - About 8.5k routes (mostly locale pages) have no `cacheKey`, so they always re-render. That is the floor for a warm build. - `Frontend Build` now depends on the shared `aspire-runners` group (granted in microsoft/github-operations#1993, and also used by microsoft/aspire). A job whose runner label can't be served waits in the queue, and `timeout-minutes` only counts once it runs. Over a 12 h sample of microsoft/aspire (74 `8-core-ubuntu-latest` jobs) the queue time had a median of 5 s, a 95th percentile of 9 s and a maximum of 116 s, so contention looks low, but the sample was small and mostly off-peak. To fall back, change the `runs-on` line to `ubuntu-latest`. Larger runners are billed per minute, including in public repositories. - `PUBLIC_GIT_COMMIT_ID` (the merge base with `origin/main`) is rendered into every page: the footer, the commit link and `<meta name="git-commit-id">`, and client-side navigation between pages with different IDs falls back to a full page load (`deployment-guard.ts`). From reading Astro 7.4's incremental build code, I expected the dependency hash to ignore `.env`-derived values, so a page restored from the cache could keep an older commit ID after `main` advances. I tested that on a throwaway build: it restored a cache saved for a different commit and built with a new `PUBLIC_GIT_COMMIT_ID`, and all 32,200 built HTML pages carried the new ID (none kept the old one). Nothing is affected today either way: the CI `frontend-dist` only feeds E2E and the internal build has no Astro cache. Repeat that check before using the cache in a build that gets deployed, or key the cache on the commit ID. - Built HTML is no longer byte-for-byte reproducible between runs: Starlight tab ids (`tab-panel-N`) depend on which worker renders a page. They stay unique within each page, so nothing breaks, but diffing two builds shows tab-id noise. - The internal Azure DevOps build runs `frontend.esproj` (`bun run build`), so it needs Bun on its agents. A companion internal PR (Azure DevOps 67205, into `deploy`) installs the package manager that `package.json` names (pnpm while `main` still pins it, Bun once this lands), so it can merge first. A throwaway run of the same install and publish steps on the same internal agent type passed (Bun install, parallel prerender, no drift in the committed `.generated` output), but the companion PR itself hasn't run in the real pipeline yet. - pnpm-only settings were dropped: `allowedDeprecatedVersions`, `peerDependencyRules` and the version-pinned release-age excludes. Bun's `minimumReleaseAgeExcludes` matches names only, and a locked install isn't age-gated. ## Third-party links and affiliations <!-- List any third-party links added or changed by this pull request and disclose any material affiliation with the linked organizations, such as employment, sponsorship, or ownership. Write "None" if this pull request doesn't add or change third-party links. --> - https://bun.sh/docs/installation: Bun install docs in the contributor guide (replaces pnpm.io). - https://github.com/oven-sh/setup-bun: GitHub Action that installs Bun in CI, pinned to a commit SHA (v2.2.0) and added to the organization's allowed actions. - Rettend/starlight-plugin-icons#9: upstream fix tracked for one of the patches; moved from a comment in `pnpm-workspace.yaml` to `patches/README.md`. - The `bun` npm package (installed by the CodeQL ADO pipeline) and the `ghcr.io/devcontainers-extra/features/bun:1` dev container feature are new third-party tooling. No material affiliation with these projects or organizations to disclose. ## Validation <!-- List the checks you ran or explain why validation isn't needed. --> CI on the current head `f1a7ba038` (run `40014533725`, with `Frontend Build` on `8-core-ubuntu-latest`): every job passed on the first attempt with a cold Astro cache, including `Frontend validation` (lint, then 81 test files with 1,103 tests passed and 1 skipped), `AppHost Build`, `release-sync-tests`, all six Playwright E2E shards (no test failed or needed a retry), the report merge and `ci-gate`. On the previous head `5988e6ecd` (before the Astro 7.4.2 bump and the item route fix), run `39981757109` also passed, with `Frontend Build` on `8-core-ubuntu-latest`: - Attempt 1 (cold cache): every job passed, including `Frontend validation` (lint, then 80 test files with 1,094 tests passed and 1 skipped), `AppHost Build`, `release-sync-tests`, all six Playwright E2E shards, the report merge and `ci-gate`. One E2E test passed only on its retry: `mermaid-navigation.spec.ts` `Mermaid stays centered and responsive after client navigation in dark mode` timed out after 15 s on the tablet project while waiting for the Mermaid SVG to center. It polls client-side rendering, so it looks timing-sensitive on a loaded runner. It didn't retry in any of the last 14 `main` push runs (84 shard logs), where other tests did in 4 of the 14 (`twoslash-navigation` and `homepage`). - Attempt 2 (full re-run, exact cache hit): every job passed, including all six E2E shards and `ci-gate`. No test failed or needed a retry. On an earlier head `369123798` (before the rebase onto `main` at `1e4b28d3b` and the runner change), run `39804194596` on `ubuntu-latest` also passed. In attempt 1 (cold cache) only shard `mobile-chromium` 1/2 failed, with `Artifact download failed after 5 retries` before it ran any test, and attempt 2 (full re-run) passed every job. No test failed or needed a retry in either attempt. The E2E test fixed here (`live-status.spec.ts`, `a missing live API stays disabled across navigation and visibility changes until reload`) had failed on tablet shard 2/2 of run `39620067289` (the original attempt and both retries) and on an unrelated docs PR's run (`39344794778`). The failing trace shows the WCP consent banner appearing, the test helper clicking Reject, and the page reloading, which requested `/api/live/` a second time. The test now blocks the WCP script. It passed on its first attempt on the desktop, tablet and mobile projects in both attempts on each head above, and in run `39655383949` on the earlier version of this branch. The banner depends on the runner's region, so a few green runs don't prove the fix; the check is that this test stays green across further runs. `homepage.spec.ts` `keeps every dashboard screenshot loaded and fully contained in both themes` is a separate known flake that passes on retry (it failed once and passed on retry in runs `39655383949`, `39641836015` and `39513380035`); it didn't appear in these runs. Local checks ran on the earlier, `release/17.0`-based version of this branch with Bun 1.4.3 and Node 24. After the rebases onto `main`, `bunfig.toml`, `ec.config.mjs`, the `build*` scripts and `live-status.spec.ts` are identical, the Astro patch only moved to `[email protected]` with the same content, `bun.lock` differs by the `devalue` override ported from #1940 and the Astro 7.4.2 bump, `package.json` differs by those and by the `update:contributors` script that `main` added in #1803, and `frontend-build.yml` differs only by the `runs-on` line, so those results still apply (CI repeats the install, lint and unit tests on the current head): - `bun install --frozen-lockfile`: passed, lockfile unchanged. - `bun run lint`: passed (exit 0). - `bun run test:unit`: passed, including the workflow guard tests in `build-performance.vitest.test.ts` for the cache restore and save steps. CI's `Frontend validation` passed the same tests on the rebased head. - `bunx --bun astro sync`: passed. - `bunx --bun astro dev` probe: a docs page, a twoslash page and an OG PNG all returned 200. - A Bun probe of `starlight-links-validator` reproduced the `path.replace` crash without the `BASE_URL` default and returned the expected slug with it. - A throwaway Playwright probe against `astro dev` (Node): with a stand-in WCP that requires consent, the unchanged test body failed at `live-status.spec.ts:83` (`Expected: 1, Received: 2`, the CI failure), and with the abort line it passed. The changed spec then passed 15 of 15 (five repeats on each of the desktop, tablet and mobile projects). - YAML parse of the changed workflows: passed. On the rebased head I also ran the `contributor-list` and `ts-api-route-catalog` unit tests with Node 24 (18 tests passed). The first rebase conflicted only in `.agents/skills/update-integrations/SKILL.md` and `.github/instructions/astro.instructions.md`. The second one, onto `main` at `1e4b28d3b` (#1940, a `devalue` bump), conflicted in `pnpm-lock.yaml` in the first commit (I kept its `[email protected]` entries, which `[email protected]` pins) and in the Bun migration commit, which deletes `pnpm-lock.yaml` and `pnpm-workspace.yaml`. There I ported the override to `package.json` and `bun.lock`, and `bun install --lockfile-only` reported no changes. Output check: on the previous head, I compared the `frontend-dist` artifact from this PR's cold build (run `39804194596`, attempt 1) with the one from the `main` push build of the PR's earlier base (`a62b64bec`, sequential, Node). The later commits only change the `devalue` override and the `runs-on` line, and I didn't repeat the comparison: - Both contain 32,386 HTML pages, and no `/_astro/` reference in the HTML dangles. - Pagefind reports the same counts. - Non-HTML files are byte-identical except six: the Markdown of the two edited community pages, `llms-full.txt` and `llms-small.txt` (this PR's docs edits), and `rss.xml` and the Pagefind entry (hash and commit noise that also differs between two builds of `main`). - Two random samples of 201 and 251 pages have identical visible text. I didn't diff every page. - 150 PNG and 1 WEBP originals in `_astro/` that no page referenced are no longer emitted. Not run locally: `bun run build` (a full site build is too heavy to run locally; CI covers it), the full Playwright E2E suite (CI ran it; locally only the deflaked test ran, against `astro dev`) and the internal Azure DevOps pipelines. --------- Co-authored-by: Sébastien Ros <[email protected]> Co-authored-by: Copilot App <[email protected]> Co-authored-by: David Pine <[email protected]> Copilot-Session: 7fae752f-9a4b-40b9-afa8-fe291e54acb6 Copilot-Session: 5b3c83c2-1729-4e35-863d-c38bc4e0b41f
Documentation accuracy review - not applicableReviewed all 26 changed-file diffs at Phase A - Claim verificationNo changed Aspire product-documentation claims found. This PR changes the site build configuration/dependency graph, Astro worker patch, API/glossary route implementation, cache helpers, and route tests. It does not change guide prose, API data, tutorial samples, or Aspire CLI instructions. Claims: 0; verified: 0; verified-with-nuance: 0; unverifiable: 0; contradicted: 0. No Aspire/Toolkit/Azure source checkout was warranted; there are no product claims to compare with those repositories. Astro/npm dependency compatibility belongs to the code review, not Aspire product-claim verification. Phase B - Documentation test reportFocus: changed user instructions/examples. Result: not applicable (empty scope), not a runtime pass.
Critical issues / warnings: none assessed; no changed teaching content. Passed checks: scope assessment only. Recommendations / knowledge gaps: none within this documentation-accuracy scope. Routes exercised / local server: none; no unrelated tutorial run or browser session was invented. The affected generated API/glossary/OG routes, output equivalence, and production incremental-cache behavior remain implementation-review concerns and are not certified by this report. This records the once-per-PR documentation stage only. The code review follows separately; no formal approval or change-request verdict is submitted. |
Project code reviewReviewed the 26-file change at 6ac1951, relative to exact base fa51b99, following the repository's High1. The content-comparison adaptation makes the catalog test exceed CI's timeout. The new Smallest fix: build the expected legacy maps first and compare them once per module, outside the per-handle loop; avoid repeatedly serializing the same objects (precompute fingerprints if needed). Preserve the canonical/legacy assertions rather than only raising the timeout. The isolated local run passes, so the defect is CI-budget reliability, not a claim that the route assertions always fail. Medium2. Production cache reuse/invalidation is enabled without an integration regression covering a second build. The two adapted tests verify route/Markdown behavior with mocked collections; neither performs production worker serialization or restores incremental output. There are no tests referencing Targeted fix: add a small production fixture/control in CI that builds cold, builds warm with unchanged inputs, then changes one API document and one OG input/asset. Assert unchanged output equivalence, changed-page invalidation, removed-path pruning, HTML/Markdown route parity, and SVG image metadata surviving the worker boundary. This need not repeat the full site build locally. Existing finding, not duplicatedThe direct Test coverage and evidence
Workspace restored to its session branch with a clean tracked tree; no source fixes, pushes, formal review verdict, or merge performed. This comment consumes the once-per-PR code-review stage, independent of future head SHAs. |
## Summary Follow-up to #1929, carrying over the two items from the review of #1927 (now closed) that still apply to `main`. - **`@astrojs/markdown-remark` peer range:** Astro 7.4.1 declares `^7.3.0`, but the site's Markdown processor in `astro.config.mjs` was pinned to 7.2.1. This bumps it to 7.3.4, which also moves the direct dependency onto the same `@astrojs/internal-helpers` version as Astro (0.13.0). - **Second-build coverage:** nothing tested incremental reuse across builds. `tests/unit/incremental-build.vitest.test.ts` builds a small throwaway site several times with the real experimental flags, `api-cache-key.ts`, `og-cache-key.ts`, patched Astro and the Bun runtime. It checks: - unchanged inputs produce byte-identical output - a changed API document re-renders only its own HTML and Markdown routes - a changed OG renderer asset re-renders only social cards - a new deployment commit re-renders API pages but not social cards - a removed document is pruned from `dist` and the page cache - an imported SVG's image metadata crosses the worker boundary and still resolves on restored pages The test takes about 12s and needs `bun` on `PATH`, which the validation job already provides. `@astrojs/[email protected]` still depends on its own exact copy of `@astrojs/markdown-remark` 7.2.1, so two versions stay installed until `mdx` is updated. The lockfile change also moves the hoisted `acorn`, `source-map`, `remark-smartypants` and `@astrojs/prism` versions that the new `markdown-remark` needs; other consumers keep their previous versions nested. ## Third-party links and affiliations None. ## Validation - `bun run build:production`: passed, 32,203 pages built. - `bun run test:unit`: passed (1163 passed, 1 skipped). - `bun run lint`: passed. - `bun install --frozen-lockfile`: passed. - Confirmed the new test fails when it should, by temporarily removing the Astro worker patch (`DataCloneError`), dropping `og-image.png` from the OG key, and removing deployment metadata from the API key. - Not run: E2E tests, and the test on Linux or Windows. It has only run on macOS so far. Co-authored-by: Sébastien Ros <[email protected]>

Summary
The full-site build takes ~7 minutes (8m27s on Astro 7.3.2). This upgrades to Astro 7.4.1 and enables
experimental.parallelPrerenderandincrementalBuild, which brings a cold build to ~3m40s and a warm rebuild to ~2m30s. All 32,203 pages are still built.ASPIRE_PRERENDER_WORKERS. Peak memory is ~16 GB summed across processes, so smaller runners may need a lower value.getPackageDocument,getTsModuleDocument,getTsHandleMethod.cacheKeyon API reference routes (src/utils/api-cache-key.ts): a hash of the package or module data. Pages only read their own package's data, so there are no cross-package dependencies. Template/code changes are covered by Astro's own dependency hash.cacheKeyon OG cards (src/utils/og-cache-key.ts): hash of the card inputs plus the fonts andog-image.pngthe renderer reads from disk. These were ~1/4 of summed render time.patches/[email protected]): imported SVG components end up inmetadata.staticImages[].transform.srcand cannot be structured-cloned, which breaks the prerender worker. This is an upstream bug; the patch is a workaround and can be dropped once fixed.[email protected]is also added tominimumReleaseAgeExclude.Measured on a 14-core / 48 GB Mac:
Incremental builds only help if
node_modules/.astrois restored between builds. A fresh CI checkout still pays the cold cost, so a CI cache step would be a follow-up. The remaining warm time is mostly fixed: startup and Vite (~40s), Pagefind (~27s), and Starlight docs pages (their route is not under our control, andstarlight-links-validatorresets the content cache on every run).Third-party links and affiliations
None.
Validation
pnpm exec vitest run --config vitest.config.ts tests/unit: passed (1093 passed, 1 skipped).rss.xml. Incremental OG PNGs (563) are byte-identical to a cold build. API HTML differs from the earlier cold build only in the hashedpage-ssrCSS filename, and every/_astro/reference resolves.