Skip to content

fix(esptool): reinstall a cached source esptool venv whose interpreter no longer resolves (#1655) - #1714

Merged
zackees merged 1 commit into
mainfrom
fix/1655-esptool-venv-interpreter
Oct 24, 2026
Merged

zackees merged 1 commit into
mainfrom
fix/1655-esptool-venv-interpreter

Conversation

@zackees

@zackees zackees commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Fixes #1655.

  • verify_esptool_once no longer trusts its stamp when the launcher sits in a venv (../pyvenv.cfg) whose bin/python is missing or a dangling symlink, which is what a cache restored onto a runner with a different interpreter path produces.
  • ensure_source_installed removes the uv tool/bin dirs and reinstalls once on a failed verify, instead of failing the build at elf2image.

Tests: new verify_once_rejects_a_stamped_venv_with_a_dangling_interpreter and missing_venv_interpreter_ignores_binaries_outside_a_venv; cargo test -p fbuild-library esptool 31 passed, clippy clean. The reinstall loop itself isn't covered by a unit test because it shells out to real uv.

Summary by CodeRabbit

  • Bug Fixes
    • Installation now retries once when a tool environment fails verification, helping recover from incomplete or damaged installations.
    • Verification now detects when a tool’s required Python interpreter is unavailable, rather than treating an existing verification record as sufficient.
    • If the retry also fails, the installation reports an error identifying the affected tool archive.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between af838a4 and 8b4c365.

Files selected for processing: 2
  • crates/fbuild-library/src/library/esptool.rs
  • crates/fbuild-library/src/library/esptool_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Esptool source installation now retries after verification fails. Verification also rejects a venv launcher when its Python interpreter does not resolve, including when a verification stamp exists.

Changes: Esptool source recovery

Layer / File(s) Summary
Venv interpreter validation
crates/fbuild-library/src/library/esptool.rs, crates/fbuild-library/src/library/esptool_tests.rs
Verification checks whether the Python interpreter beside a venv launcher resolves before consulting the verification stamp or launching the executable. Tests cover a dangling symlink and a binary outside a venv.
Source installation retry
crates/fbuild-library/src/library/esptool.rs
Source installation retries verification once after removing the tool and bin directories. A second failure returns a package error containing the archive URL and verification error.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

  • FastLED/fbuild#1505: This PR changes source esptool verification and adds recovery after verification fails.
  • FastLED/fbuild#1503: This PR changes the source esptool tool and bin directory helpers used to remove the cached environment before reinstalling.
Merge Risk: Minimal · up to 8b4c3

The recovery path is ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: reinstalling a cached source esptool virtual environment when its interpreter no longer resolves.
Linked Issues check Passed Issue #1655 requires validation of cached esptool venv interpreters and reinstall after failed validation. verify_esptool_once checks the venv interpreter before it trusts the verification stamp. `e…
Out of Scope Changes check Passed The changes are limited to source esptool verification, one reinstall retry, and focused tests for the cached-venv failure. The changes directly address issue #1655. No unrelated implementation or tes…
Full details: Linked Issues check

Explanation

Issue #1655 requires validation of cached esptool venv interpreters and reinstall after failed validation. verify_esptool_once checks the venv interpreter before it trusts the verification stamp. ensure_source_installed removes the cached uv tool and bin directories and retries installation and verification once. The added tests cover a stamped venv with a dangling interpreter and binaries outside a venv. These changes satisfy the coding requirements.

Full details: Out of Scope Changes check

Explanation

The changes are limited to source esptool verification, one reinstall retry, and focused tests for the cached-venv failure. The changes directly address issue #1655. No unrelated implementation or test changes are shown.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…r no longer resolves (#1655)

Co-Authored-By: Claude <noreply@anthropic.com>
@zackees
zackees force-pushed the fix/1655-esptool-venv-interpreter branch from 4e6f3d2 to 8b4c365 Compare October 24, 2026 02:25
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Oct 24, 2026
@zackees
zackees merged commit 33ea199 into main Oct 24, 2026
24 checks passed
@zackees
zackees deleted the fix/1655-esptool-venv-interpreter branch October 24, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Cached esptool venv loses bin/python on restored CI cache: elf2image exit 127 / spawn ENOENT

1 participant