Repository navigation
fix(backends): refuse an hc below the verified version floor - #8001
Closed
LuizBrugnera wants to merge 2 commits into
Closed
LuizBrugnera wants to merge 2 commits into
LuizBrugnera wants to merge 2 commits into
Conversation
container_ensure, the spawn-time gate, now reads `hc --version` and refuses anything older than 0.1.13, the oldest herdr-core this backend was measured on, or a version it cannot read, before any terminal is created. A node with a stale hc then fails with an update hint instead of partway through a spawn, which matters once several machines run different hc releases. A `-pre` or `+build` suffix is ignored, so a prerelease of a newer version passes. A fake-hc case pins the refusal (older, missing, or non-numeric versions, with the core never touched) and the accepted versions; the real-hc smoke suite passes through the same gate with hc 0.1.14.
[Low impact] The PR appears safe to merge; the failed-probe issue is fixed. Reviews (2) · Last reviewed commit: "fix(hc): refuse a version probe that exi..." · Reviewed by Greptile |
Capture the full `hc --version` output and check its exit status before taking the first line, so a probe that prints a valid version but fails is refused like an unreadable version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hi! I'm following this one closely: I'm waiting on the hc backend work to move my Firstmate setup to the Herdr desktop app. A version floor check would save me from silent breakage when my hc and the adapter drift apart. If anything is needed to move this forward (testing on macOS against a real Herdr.app/herdr-core, reproducing a review finding, or picking up a follow-up), I'm happy to help. Just let me know. |
Author
|
Superseded by #8037, which ships the same version-floor and failed-probe checks with a stricter 0.1.14 floor. |
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.
Intent
Follow-up to #7963 (the experimental, explicit-only hc / herdr-core runtime backend), offered on that PR as "a minimum
hc --versioncheck in container_ensure with a clear message, which helps when nodes run different hc versions" and accepted by its author for after it landed.Goal: container_ensure, the spawn-time gate, reads
hc --versionand refuses an hc older than 0.1.13, the oldest herdr-core this backend was measured on, or a version it cannot read, before any terminal is created, with an update hint (hc update).A
-preor+buildsuffix is ignored, so a prerelease of a newer version passes; anything else that is not plain dotted digits is refused.The version probe drops HC_SOCKET like every other hc call.
Scope is only the floor: the HC_SOCKET drop originally planned next to it already landed in #7963, so it is not repeated here, and nothing else changes.
Tests: a fake-hc case pins refusal of older, missing and non-numeric versions with the core never touched, and acceptance of 0.1.13, a newer prerelease, 0.2.0 and 1.0 (disabling the check makes it fail); the real-hc smoke suite passes through the same gate with hc 0.1.14, and the verification table records the
hc --versionoutput shape on 0.1.13 and 0.1.14.Keep #7963's names; no private host names, IPs, accounts or people; one sentence per line in Markdown.
What Changed
fm_backend_hc_container_ensureinbin/backends/hc.shnow readshc --version, withHC_SOCKETdropped, before it touches the core. It refuses any hc older thanFM_BACKEND_HC_MIN_VERSION=0.1.13, and any output it cannot parse as a version, with an error that names the floor and suggestshc update. The new helperfm_backend_hc_version_at_leastcompares the version numerically part by part. It drops a-preor+buildsuffix first and rejects anything else that is not plain dotted digits.hcstub intests/fm-backend-hc.test.shnow answers--version. A new test checks thathc 0.1.12,hc 0.0.99, a barehc,hc 0.1.xand empty output are refused before anyservercall. It also checks thathc 0.1.13,hc 0.1.15-rc.1,hc 0.2.0andhc 1.0are accepted.docs/hc-backend.mdnow lists hc 0.1.13 or newer as a prerequisite and says a spawn refuses an older or unreadable version.docs/verification/runtime-backends.mdadds a row recording thehc --versionoutput shape on 0.1.13 and 0.1.14.🤖 Generated with Claude Code
Risk Assessment
✅ Low: This is a small, contained spawn-time gate on the explicit-only hc backend:
container_ensureis the only caller ahead ofcreate_task(bin/fm-spawn.sh:5078), the version probe drops HC_SOCKET, and tracing the comparator through the floor, prerelease, unreadable and newer-version inputs gave the right answer each time.Testing
hc is not on PATH. I copied a real herdr-core 0.1.14 binary, left in /tmp by an earlier session, into a scratch directory and drove the adapter against private cores only. I ran the real-hc smoke suite, which passes through container_ensure. I ran the fake-hc unit suite, the gate in 13 version cases, and a mutation check showing the new test catches a disabled gate. Everything passed, and the scratch directories were removed.
Evidence: Real-hc smoke suite through the version gate (hc 0.1.14)
Source: Real-hc smoke suite through the version gate (hc 0.1.14)
Evidence: container_ensure version-floor matrix against a real core (refuse/accept, HC_SOCKET dropped, no core on refusal)
Source: container_ensure version-floor matrix against a real core (refuse/accept, HC_SOCKET dropped, no core on refusal)
Evidence: Fake-hc backend suite
Source: Fake-hc backend suite
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
PATH=<scratch hc 0.1.14>:$PATH bash tests/fm-backend-hc-smoke.test.sh(real herdr-core, private core)bash tests/fm-backend-hc.test.sh(fake-hc suite including test_container_ensure_refuses_an_hc_below_the_version_floor)Ran the realfm_backend_hc_container_ensure(sourced through bin/fm-backend.sh) against real hc 0.1.14. A scratch shim changed only the--versionoutput (13 cases), with HC_SOCKET exported. Each case recorded the exit code, the message, the HC_SOCKET value the probe saw, and whether a core socket was created.Mutation check: disabled the floor check in bin/backends/hc.sh, confirmed the new test fails ('container_ensure must refuse version hc 0.1.12'), then restored the file (clean worktree)✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → no changes applied ✅
🔧 No changes applied.
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.