fix: adapter resolution in wheels, eager-help crash, installer hardening (#367 follow-up) - #368
Merged
Merged
Conversation
pr #367 force-included adapters/ into the wheel but the resolver hunk never made the branch: ADAPTERS_DIR still walked three parents up from the module — the repo root in a checkout, but <prefix>/lib/pythonX.Y/ in an installed wheel. installed copies therefore *contained* the templates yet still failed install-mcp with "(available: (none))". prefer the repo-root directory when it exists (checkouts, editable installs) and fall back to the packaged vouch/adapters/ otherwise. the wheel-contents regression test could not catch this — a wheel can carry the files while the resolver misses them — so a second test now unpacks the built wheel, imports that copy with no repo checkout in sight, and asserts available_adapters() finds claude-code.
click renders --help and --version during argument parsing, before any group callback runs — and the group docstring's em dash already crashes a latin-1 stdout. so the callback-scoped _force_utf8_stdio() from #367 left the very first command a fresh user is likely to type (`vouch --help`) raising UnicodeEncodeError. run it at module import instead; it is idempotent and a no-op on utf-8 streams. also widen capture.load_config's except: reading config.yaml with pinned utf-8 can now raise UnicodeDecodeError on latin-1 bytes (e.g. a hand-edited config on exactly the hosts this fix targets), which escaped the (OSError, YAMLError) tuple and broke the documented fall-back-to-defaults contract. the stdio regression test is parametrized over `status` and `--help`; the help case fails against the callback-scoped variant.
three hardening fixes for the pep 668 fallback from #367: - probe ~/.local/bin *before* deciding pipx is missing: fresh non-login shells often lack it on PATH, so an installed pipx looked absent and a needless private venv shadowed it. the symlink into ~/.local/bin now also refuses to overwrite an existing entry. - recreate the private venv from scratch on re-runs: brew pythons ship read-only activate scripts, so `python -m venv` over a previous run's env dies with EACCES. - stop announcing every pip failure as "refused (PEP 668)" and stop discarding installer output: attempts log to $TMPDIR and the final error prints the last lines, so a missing python3-venv or a network outage is diagnosable from the terminal.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
This was referenced Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
an adversarial review pass over #367 (four independent lenses, findings re-verified empirically) caught one blocker and a handful of hardening gaps in that PR. this lands the fixes before 1.2.0 ships them.
the blocker: #367 force-included adapters/ into the wheel but the resolver hunk never made the branch — ADAPTERS_DIR still walked three parents up from the module, so installed wheels contained the templates and still failed
vouch install-mcpwith "(available: (none))". the resolver now falls back to the packaged vouch/adapters/ copy; checkouts and editable installs keep preferring the repo directory. the wheel-contents test could not catch this (a wheel can carry files the resolver misses), so a second regression test unpacks the built wheel, imports that copy with no repo checkout in sight, and asserts available_adapters() finds claude-code — it fails on current test/main.second:
vouch --helpstill crashed under latin-1 stdio. click renders eager --help/--version during argument parsing, before the group callback from #367 could reconfigure anything, and the group docstring's em dash is unrepresentable in latin-1. _force_utf8_stdio() now runs at module import (idempotent, no-op on utf-8 streams), and the stdio regression test is parametrized overstatusand--help. relatedly, capture.load_config's except tuple now includes UnicodeDecodeError, which the pinned-utf-8 read can raise on a hand-edited latin-1 config — it previously escaped the documented fall-back-to-defaults contract.third, installer hardening: ~/.local/bin is probed before deciding pipx is missing (fresh non-login shells often lack it on PATH, which made an installed pipx look absent and a needless private venv shadow it — the symlink also refuses to overwrite an existing entry now); the private venv is recreated from scratch on re-runs (brew pythons ship read-only activate scripts, so venv-over-existing dies with EACCES); and pip failures are no longer all announced as "refused (PEP 668)" with the output discarded — attempts log to $TMPDIR and the final error prints the last lines.
verified: full suite green; both new tests proven to fail against current test; install.sh exercised in a throwaway $HOME under LANG=en_US.ISO-8859-1 — fresh run and two re-runs all succeed,
vouch --helpandvouch statusincluded.one known-inert leftover for a future pass: hatchling applies the force-include to editable wheels too, so
pip install -edrops a stale physical vouch/adapters snapshot into site-packages. imports still resolve to the repo and ADAPTERS_DIR prefers the checkout, so nothing misbehaves today.