Skip to content

fix(cdk): redirect CDK synth/test temp output to disk-backed TMPDIR#217

Open
scottschreckengaust wants to merge 2 commits into
mainfrom
fix/216-tmpdir-cdk-synth
Open

fix(cdk): redirect CDK synth/test temp output to disk-backed TMPDIR#217
scottschreckengaust wants to merge 2 commits into
mainfrom
fix/216-tmpdir-cdk-synth

Conversation

@scottschreckengaust
Copy link
Copy Markdown
Contributor

@scottschreckengaust scottschreckengaust commented May 29, 2026

Summary

  • Redirects CDK synth and Jest test temp output from /tmp (tmpfs) to $HOME/.cache/cdk-tmp (disk-backed, outside repo tree)
  • Prevents tmpfs exhaustion that crashes the OS during full test suite or pre-push hooks
  • CI explicitly uses runner.temp (already disk-backed on GHA runners)

Changes

File Change
cdk/mise.toml [env] TMPDIR = "{{env.HOME}}/.cache/cdk-tmp" + mkdir -p $TMPDIR in test/synth tasks
.pre-commit-config.yaml Export TMPDIR in pre-push hook entry
.github/workflows/build.yml TMPDIR: ${{ runner.temp }} on build step

Key constraint: TMPDIR must be outside the repo tree. CDK's AgentRuntimeArtifact.fromAsset(repoRoot) fingerprints the entire repo recursively — if TMPDIR is inside it, the fingerprinter enters cdk.out*/asset.*/ (which contains a copy of the repo), finds the nested TMPDIR, enters its cdk.out*/asset.*/, and loops until ENAMETOOLONG.

Test plan

  • Run mise //cdk:test — verify $HOME/.cache/cdk-tmp gets artifacts, /tmp stays at 17M
  • Confirm no cdk.out* files appear in /tmp during test run
  • Pre-push hook entry exports correct TMPDIR
  • CI build step sets TMPDIR: ${{ runner.temp }}
  • CI build passes (awaiting second run after ENAMETOOLONG fix)

Closes #216.

🤖 Generated with Claude Code

scottschreckengaust and others added 2 commits May 29, 2026 17:34
…216)

CDK synth, Jest tests, and esbuild bundling write large cdk.out
artifacts to TMPDIR (defaults to /tmp). On systems where /tmp is a
size-limited tmpfs, the full test suite exhausts space and crashes.

Changes:
- cdk/mise.toml: set TMPDIR={{config_root}}/.tmp via [env] so all
  mise //cdk:* tasks use a disk-backed directory; add mkdir -p .tmp
  to test and synth task runs
- .pre-commit-config.yaml: export TMPDIR in pre-push hook entry
  so hooks inherit the same override
- .github/workflows/build.yml: explicit TMPDIR=${{ runner.temp }}
  for the build step (CI runners have disk-backed temp)
- .gitignore: add /cdk/.tmp/

Closes #216.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CDK's fingerprinter recursively walks the asset directory (repoRoot).
When TMPDIR was set to cdk/.tmp/ (inside the repo), the fingerprinter
entered .tmp/cdk.out*/asset.*/ which contained another copy of the
repo, creating infinitely nested paths until ENAMETOOLONG.

Fix: use $HOME/.cache/cdk-tmp which is outside the repo tree entirely.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@scottschreckengaust scottschreckengaust marked this pull request as ready for review May 29, 2026 18:21
@scottschreckengaust scottschreckengaust requested a review from a team as a code owner May 29, 2026 18:21
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.

fix(cdk): redirect CDK synth temp output to disk-backed TMPDIR to prevent tmpfs exhaustion

1 participant