Skip to content

fix(tenv): reinstall when a shim is missing - #231

Merged
chromy merged 1 commit into
mainfrom
chromy/2026-09-07-tenv-tofu-shim
Sep 8, 2026
Merged

chromy merged 1 commit into
mainfrom
chromy/2026-09-07-tenv-tofu-shim

Conversation

@chromy

@chromy chromy commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Previously tenv.install() checked the version of tenv - so if if a PR introduced a new shim but kept the tenv
version devenv sync would not add the new shim. This changes the code to directly check all shims are present.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c428adb. Configure here.

Comment thread devenv/lib/tenv.py
@chromy
chromy force-pushed the chromy/2026-09-07-tenv-tofu-shim branch from c428adb to 425c2c6 Compare September 7, 2026 19:12
@chromy chromy changed the title fix(tenv): install the tofu shim fix(tenv): reinstall when a shim is missing Sep 7, 2026
@chromy
chromy marked this pull request as draft September 8, 2026 13:28
@chromy
chromy force-pushed the chromy/2026-09-07-tenv-tofu-shim branch from 425c2c6 to cc2f18b Compare September 8, 2026 13:37
#230 added the `tofu` shim, but only for checkouts that don't already
have the pinned tenv. install() early-returns on a version match, so an
existing checkout with tenv v1.3.0 never gets the new shim — it stays
broken until tenv itself is bumped. That's most of getsentry/ops, where
`terragrunt run` fails outright because root.hcl sets
`terraform_binary = "tofu"`:

    ERROR  Failed to execute "tofu -version" in ...
    exec: "tofu": executable file not found in $PATH

So check that the shims exist too, not just the version, and reinstall
if any are absent. install() now converges on the shim set devenv wants
rather than on whatever the first install happened to write.

Also drive the extract, shim and uninstall lists from two module-level
tuples. Three hand-maintained copies is what let `tofu` go missing from
one of them in the first place. `tf` stays extracted but unshimmed; it
picks tofu or terraform based on which version files are present, so
nothing wants to invoke it by name.

Adds tests/lib/test_tenv.py — this module had no coverage.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chromy
chromy force-pushed the chromy/2026-09-07-tenv-tofu-shim branch from cc2f18b to ceb6f35 Compare September 8, 2026 13:48
@chromy
chromy marked this pull request as ready for review September 8, 2026 13:58
@chromy
chromy merged commit 6ce6fd7 into main Sep 8, 2026
18 checks passed
@chromy
chromy deleted the chromy/2026-09-07-tenv-tofu-shim branch September 8, 2026 20:00
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.

2 participants