Repository navigation
improve(build): reuse tsdown declarations across full builds - #109737
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 016eb6372c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| cache: { | ||
| env: ["OPENCLAW_RUN_NODE_SKIP_DTS_BUILD"], | ||
| inputs: [...TSDOWN_DECLARATION_TOOL_INPUTS, "tsdown.config.ts", TSDOWN_PACKAGES_CACHE_INPUT], | ||
| outputs: declarationCacheOutputs(TSDOWN_MAIN_PACKAGE_OUTPUT_ROOTS), |
There was a problem hiding this comment.
Include web-content-core declarations in package cache
When a full build restores a fresh tsdown-packages cache, this step reruns tsdown with OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1 and restores only TSDOWN_MAIN_PACKAGE_OUTPUT_ROOTS. That root list excludes packages/web-content-core/dist, even though tsdown.config.ts:570 builds that package and packages/web-content-core/package.json:11 exports ./dist/provider-runtime-shared.d.mts as its types entry, so warm CI/release builds from a clean runner can finish without that declaration file. Please add web-content-core to the restored declaration roots or otherwise cache/restore its dts before skipping declarations.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
What Problem This Solves
Full builds rerun three expensive tsdown declaration graphs even when most or all inputs are unchanged. Measurements showed about 196 seconds of declaration work across the AI package, workspace packages, and unified core/plugin graph, while the runtime JavaScript build itself took about 4 seconds.
Why This Change Was Made
This adds content-addressed, module-level declaration reuse for the three independent tsdown build groups. Runtime JavaScript is still rebuilt every time. Each group restores only its own declaration outputs, validates an internal fingerprint, and reruns declarations when relevant source, tool, environment, or configuration inputs change.
Public full-build workflows persist the reusable payload with
actions/cache, using exact content keys plus a coarse restore key. The internal group fingerprints make loose restores safe. Private-QA declaration output is deliberately excluded because the Actions cache namespace is not an authorization boundary.The implementation also narrows tsdown cleanup to the selected group, keeps concurrent jobs isolated, rotates the cache key with an explicit version, and relies on GitHub cache quota/LRU eviction. Rolldown's upstream incremental build cache remains watch-process-only, so it cannot provide cross-job reuse: https://rolldown.rs/reference/InputOptions.experimental
User Impact
No product/runtime behavior change. Repeated full builds become materially faster. Partial changes invalidate only affected declaration groups: core/plugin changes preserve package caches; package changes conservatively invalidate dependent groups. Cold or unsupported builds behave as before.
Evidence
git diff --check: green.AI-assisted implementation and review.