fix(test-emu): fail-fast and corruption-aware avr8js npm cache#105
fix(test-emu): fail-fast and corruption-aware avr8js npm cache#105
Conversation
…#86) - ensure_avr8js_npm now verifies node_modules/avr8js/package.json exists, not just the dir; wipes a corrupt partial install before reinstalling. - Error when npm is unresolvable names 'npm', the cache dir, and the new FBUILD_REFRESH_EMU_CACHE recovery hint. - Capture both npm stdout and stderr on non-zero exit (previously only stderr was surfaced). - Fail-fast in run_avr8js_headless: re-verify the cache is intact right before spawning Node, with a clear "avr8js cache not populated at <path>; aborting" log instead of a cryptic ERR_MODULE_NOT_FOUND from Node. - Add FBUILD_REFRESH_EMU_CACHE=1 env to force a clean reinstall. Env-var only for now; daemon must be restarted for it to take effect. CLI flag not wired (would require daemon-client plumbing; env is sufficient). - Tests: PATH-minus-npm produces the specific error; corrupt cache triggers a wipe before reinstall; predicate unit tests for cache integrity and prep outcomes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 22 minutes and 57 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #86.
fbuild test-emu --emulator avr8jsfailed with NodeERR_MODULE_NOT_FOUNDwhen~/.fbuild/cache/avr8js-node/node_modules/avr8js/was missing or corrupt. Root cause:ensure_avr8js_npm'sexists()check accepted a directory that lackedpackage.json.Changes
node_modules/avr8js/package.jsonas the proof of a non-corrupt install. If the dir exists but the marker doesn't, wipe and reinstall.npmis not on PATH or install exits non-zero, capture both stdout and stderr and name the cache dir.FBUILD_REFRESH_EMU_CACHE=1forces reinstall regardless of marker state (accepts1|true|TRUE|yes|YES).nodewhen the cache state is still bad.Node-spawn audit
Two spawn sites:
find_node()(probesnode --version, no avr8js needed) andrun_avr8js_headless(). Both callers (deploy_avr8js,Avr8jsRunner::run) already calledensure_avr8js_npm()first — no bypass. The real gap was the integrity check.Test plan
uv run cargo test -p fbuild-daemon --lib— 107 passinguv run cargo clippy --workspace --all-targets -- -D warningsuv run cargo fmt --allDeferred
--refresh-emu-cacheplumbed throughTestEmuRequest(env var works but needs daemon restart)find_node()still returns a barenode/node.exePathBuf rather than an absolute resolved path — minor race window between probe and spawn if PATH changes🤖 Generated with Claude Code