Skip to content

ci: drop the nx cache that nx 22 cannot use - #3034

Open
mfal wants to merge 1 commit into
mainfrom
claude/deployment-actions-performance-74c095
Open

ci: drop the nx cache that nx 22 cannot use#3034
mfal wants to merge 1 commit into
mainfrom
claude/deployment-actions-performance-74c095

Conversation

@mfal

@mfal mfal commented Aug 31, 2026

Copy link
Copy Markdown
Member

The nx cache restored by prepare-workspace never produced a single hit. Nx 20
replaced the file-system task cache with a database keyed by the machine ID —
/etc/machine-id on Linux, which every hosted runner generates fresh. The
restored .nx/cache is therefore artifacts nx has no metadata for, so it warns
and re-runs every task:

Cache hit for restore-key: nx-Linux-85bbc3b2d353a6a9b55348f45571ac6ff926a84a
NX  Unrecognized Cache Artifacts
Nx found unrecognized artifacts in the cache directory and will not be able to use them.
Nx can only restore artifacts it has metadata about.

Measured on run 33385191014: both preview build jobs spent 4.3s downloading and unpacking 15MB, then executed all of their tasks — 13 for docs, 11 for storybook — with zero cache hits.

Adding .nx/workspace-data to the cached paths does not fix it. The database
file is named after the machine ID, so nx never opens a restored one:

IOPlatformUUID = "2B7F7181-01D5-53E4-9886-E9280B9C5C73"
.nx/workspace-data/2B7F7181-01D5-53E4-9886-E9280B9C5C73-v2.db

The old escape hatches are gone as well: DbCache does not read
NX_REJECT_UNKNOWN_LOCAL_CACHE (only the deprecated Cache class did), and
useLegacyCache exists neither in nx 22's code nor in nx-schema.json.

What changes

  • prepare-workspace: the restore step and its nx-cache input are gone, replaced by a comment recording why a local nx cache cannot work on CI — so the next reader does not re-add it
  • test.yml: the main-only save step is gone, as is the now-pointless nx-cache: "false" on the lint job

Effect

Roughly 4–5s per job, across every job that uses prepare-workspace. Small — the
point is mainly that the previous comment promised something that never happened
("a hit turns those ~40s into unpacking"). Actually sharing build results across
runners needs a remote cache (Nx Cloud, or nx's self-hosted cache API); that is a
separate decision, not part of this PR.

Tooling-only, so this publishes nothing.

🤖 Generated with Claude Code

@mfal mfal self-assigned this Aug 31, 2026
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./packages/components/

Status Category Percentage Covered / Total
🔵 Lines 78.69% 746 / 948
🔵 Statements 78.57% 763 / 971
🔵 Functions 80.09% 165 / 206
🔵 Branches 70.33% 377 / 536
File CoverageNo changed files found.
Generated in workflow #6569 for commit 8031512 by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

Preview environments are ready:

Type URL
docs pr-3034.docs.review.flow-components.de
storybook pr-3034.storybook.review.flow-components.de

Images:

  • docs: ghcr.io/mittwald/flow/docs:pr-3034
  • storybook: ghcr.io/mittwald/flow/storybook:pr-3034

@mfal
mfal marked this pull request as ready for review August 31, 2026 15:34
@mfal
mfal requested review from a team and ins0 August 31, 2026 15:34
Nx 20 replaced the file-system task cache with a database keyed by the
machine ID — `/etc/machine-id` on Linux, which every hosted runner
generates fresh. A restored `.nx/cache` is therefore artifacts nx has no
metadata for: it warns "Unrecognized Cache Artifacts" and re-runs every
task. Caching `.nx/workspace-data` alongside would not help either, since
the database file is named after the machine ID and nx never opens the
restored one. The old escape hatches are gone too — `DbCache` does not
read NX_REJECT_UNKNOWN_LOCAL_CACHE, and `useLegacyCache` no longer
exists in nx 22.

Measured on a preview run: both build jobs restored the 15MB cache in
4.3s and then executed all of their tasks (13 and 11) with zero hits.

Remove the restore step, its `nx-cache` input and the `main`-only save
step, and leave a comment in their place so the next reader does not
re-add them. Sharing build results across runners needs a remote cache
(Nx Cloud, or nx's self-hosted cache API).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mfal
mfal force-pushed the claude/deployment-actions-performance-74c095 branch from a7b0ff2 to 8031512 Compare September 2, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant