Skip to content

fix: name the real cause when the Very Good CLI version is unreadable - #176

Open
ryzizub wants to merge 4 commits into
mainfrom
fix/hook-blames-path-for-stale-snapshot
Open

ryzizub wants to merge 4 commits into
mainfrom
fix/hook-blames-path-for-stale-snapshot

Conversation

@ryzizub

@ryzizub ryzizub commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Closes #171

check_vgv_cli returned unverifiable for every unreadable version, and all three hooks reported it as a PATH problem. After a Dart SDK upgrade the pub shim runs a snapshot built for the old SDK, the VM rejects it, and the fallback rebuild leaves the version unreadable while dart is on PATH the whole time — so the hooks sent users to edit shell profiles that were never at fault.

The state now splits on command -v dart. dart_missing keeps the PATH advice, no longer naming one shell's startup file. unverifiable points at the stale snapshot, the very_good --version rebuild, and the /mcp reconnect a server started before the upgrade needs; block-cli-workarounds.sh goes back to redirecting at the MCP tool there, since dart runs and the server is no longer a dead end.

Two follow-up commits clean up the same file: one rank comparison in place of the three-part one, dead 2>/dev/null guards removed, globals scoped to the function, both advice strings shared as constants, and an explicit ok branch and default in each PreToolUse case.

Type of Change

  • New feature (feat)
  • Bug fix (fix)
  • Code refactor (refactor)
  • Documentation (docs)
  • CI change (ci)
  • Chore (chore)

🤖 Generated with Claude Code

@ryzizub
ryzizub marked this pull request as ready for review October 13, 2026 09:31
@ryzizub
ryzizub requested a review from a team as a code owner October 13, 2026 09:31
@unicoderbot

unicoderbot Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Heads up — I'm auto-updating this PR by merging the latest main into this branch. No action needed; I'll comment again only if this update hits a conflict or an unexpected error.

@unicoderbot

unicoderbot Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

I tried to auto-update this PR with main but ran into conflicts. The branch is unchanged — please merge it manually.

check_vgv_cli returned "unverifiable" for every unreadable version, and every
caller reported it as a PATH problem. After a Dart SDK upgrade the shim runs a
snapshot built for the old SDK and the fallback rebuild leaves the version
unreadable while dart is on PATH the whole time, so the hooks sent users to edit
shell profiles that were never at fault.

Split the state on `command -v dart`: dart_missing keeps the PATH advice, without
naming one shell's startup file; unverifiable points at the stale snapshot, the
rebuild, and the /mcp reconnect a server started before the upgrade needs.

Closes #171
…ording

The three-part comparison in check_vgv_cli was five decision points in one
expression, guarded by three `2>/dev/null` redirects that could never fire: the
grep above it matches digits only. It is now one rank comparison, with the
minimum derived from MIN_VERSION instead of four constants that had to agree.
The 10# prefix keeps a zero-padded part such as 1.08.0 out of octal, which bash
arithmetic rejects.

Also scope raw and version to the function instead of leaking five globals into
every sourcing hook, lift the PATH and rebuild advice into constants both hooks
share, and give both PreToolUse case statements an explicit "ok" branch and
default so a state added later cannot silently widen permissions.
@ryzizub
ryzizub force-pushed the fix/hook-blames-path-for-stale-snapshot branch from 35b51d0 to 78c0e51 Compare October 13, 2026 20:59
@ryzizub
ryzizub requested a review from marcossevilla October 13, 2026 21:00

# The MCP server starts through the same very_good shim, so redirecting to it when the
# shim cannot exec dart would be a dead end. The reason must point at PATH instead.
no_dart

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

BASE_PATH here starts with jq's directory. On a Mac with Homebrew that's /opt/homebrew/bin, which usually has dart in it too, so no_dart can't make dart disappear and this dart_missing assertion fails locally.

Could we symlink jq into a dedicated directory (e.g. mkdir "$STUB_DIR/jq-bin" && ln -s "$(command -v jq)" "$STUB_DIR/jq-bin/jq") and put that on BASE_PATH instead of jq's whole directory?

check-vgv-cli_test.sh has the same setup. It passes only because both states expect aside, so it doesn't really test the split either.

echo "unverifiable"
local raw version
raw=$("$vgv_bin" --version 2>/dev/null)
version=$(echo "$raw" | head -1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Did you check what very_good --version actually prints on stdout when the shim falls back after exit 253?

It runs dart pub -v global run …, so any build/log output printed before the version line would be dropped by head -1. That would make the version unreadable even though the CLI works.

If that's the cause, matching the version line anywhere in the output (e.g. grep -m1 -oE '^[0-9]+\.[0-9]+\.[0-9]+$') might turn this case into ok instead of a warning.

@unicoderbot

unicoderbot Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Heads up — I'm auto-updating this PR by merging the latest main into this branch. No action needed; I'll comment again only if this update hits a conflict or an unexpected error.

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: SessionStart hook blames PATH when a Dart SDK upgrade leaves very_good with a stale snapshot

2 participants