-
Notifications
You must be signed in to change notification settings - Fork 127
feat(daemon): surface daemon upgrade skew and staleness to CLI clients #611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
da3f8bb
feat(cli): warn when the connected daemon runs a different build
madeinoz67 0756a13
fix(cli): direction-aware daemon skew remedy; pin daemon-newer case
madeinoz67 872723e
feat(daemon): self-report on-disk binary drift in status
madeinoz67 594ee10
feat(cli): surface daemon skew and staleness in daemon status
madeinoz67 824c71e
fix(cli): drop dangling 'see warning' tail from the cli status row
madeinoz67 c4676ab
test(cli): pin SemVer §11 prerelease precedence; silence dev-daemon skew
madeinoz67 352131a
fix(mcp): skew remedy names 'gortex upgrade', not brew-only advice
madeinoz67 205b2e2
refactor(version): move semver precedence compare into internal/version
madeinoz67 668dfa4
feat(doctor): surface CLI-vs-daemon version skew in the environment p…
madeinoz67 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "testing" | ||
| ) | ||
|
|
||
| // TestPrintDoctorEnvironment_VersionSkew — the daemon handshake row | ||
| // carries ✓ when CLI and daemon agree and ! plus the skew remedy line | ||
| // when they don't, reusing daemonSkewWarning so doctor, `daemon | ||
| // status`, and the MCP proxy render one verdict. | ||
| func TestPrintDoctorEnvironment_VersionSkew(t *testing.T) { | ||
| t.Run("matching versions keep the check row", func(t *testing.T) { | ||
| env := DoctorEnvironment{ | ||
| DaemonRunning: true, | ||
| DaemonVersion: "v0.63.4+5f5fce2", | ||
| CLIVersion: "v0.63.4+5f5fce2", | ||
| DaemonSocket: "/tmp/gortex.sock", | ||
| } | ||
| if warn := daemonSkewWarning(env.DaemonVersion, env.CLIVersion); warn != "" { | ||
| t.Fatalf("precondition: expected no skew warning for matching versions, got %q", warn) | ||
| } | ||
| var buf bytes.Buffer | ||
| printDoctorEnvironment(&buf, env) | ||
| out := buf.String() | ||
| if !bytes.Contains([]byte(out), []byte("✓ daemon handshake: v0.63.4+5f5fce2")) { | ||
| t.Fatalf("expected check-marked handshake row, got:\n%s", out) | ||
| } | ||
| if bytes.Contains([]byte(out), []byte("warning:")) { | ||
| t.Fatalf("unexpected skew warning in matching-version render:\n%s", out) | ||
| } | ||
| }) | ||
|
|
||
| t.Run("skewed versions warn with the remedy", func(t *testing.T) { | ||
| env := DoctorEnvironment{ | ||
| DaemonRunning: true, | ||
| DaemonVersion: "v0.63.4+5f9ce2a", | ||
| CLIVersion: "v0.63.5+abcdef1", | ||
| DaemonSocket: "/tmp/gortex.sock", | ||
| } | ||
| env.VersionSkewWarning = daemonSkewWarning(env.DaemonVersion, env.CLIVersion) | ||
| if env.VersionSkewWarning == "" { | ||
| t.Fatal("precondition: daemonSkewWarning must fire for skewed versions") | ||
| } | ||
| var buf bytes.Buffer | ||
| printDoctorEnvironment(&buf, env) | ||
| out := buf.String() | ||
| if !bytes.Contains([]byte(out), []byte("! daemon handshake: v0.63.4+5f9ce2a")) { | ||
| t.Fatalf("expected warn-marked handshake row, got:\n%s", out) | ||
| } | ||
| if !bytes.Contains([]byte(out), []byte("run 'gortex daemon restart' to upgrade the daemon")) { | ||
| t.Fatalf("expected the skew remedy line, got:\n%s", out) | ||
| } | ||
| }) | ||
| } |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package main | ||
|
|
||
| import "testing" | ||
|
|
||
| func TestDaemonSkewWarning(t *testing.T) { | ||
| cases := []struct{ name, daemonV, localV, want string }{ | ||
| {"equal versions", "v0.63.4+5f5fce2", "v0.63.4+5f5fce2", ""}, | ||
| {"daemon older", "v0.63.4+5f9ce2a", "v0.63.5+abcdef1", | ||
| "warning: daemon v0.63.4+5f9ce2a != binary v0.63.5+abcdef1 — run 'gortex daemon restart' to upgrade the daemon"}, | ||
| {"daemon newer", "v0.63.5+abcdef1", "v0.63.4+5f9ce2a", | ||
| "warning: daemon v0.63.5+abcdef1 != binary v0.63.4+5f9ce2a — this binary is older than the running daemon — run 'gortex upgrade'"}, | ||
| {"same version different build", "v0.63.4+aaaaaaa", "v0.63.4+bbbbbbb", | ||
| "warning: daemon v0.63.4+aaaaaaa != binary v0.63.4+bbbbbbb — run 'gortex daemon restart' or 'gortex upgrade'"}, | ||
| {"unparseable daemon version", "strawberry", "v0.63.5+abcdef1", | ||
| "warning: daemon strawberry != binary v0.63.5+abcdef1 — run 'gortex daemon restart' or 'gortex upgrade'"}, | ||
| {"daemon version empty", "", "v0.63.5+abcdef1", ""}, | ||
| {"local dev build", "v0.63.4+5f9ce2a", "v0.0.0-dev", ""}, | ||
| {"daemon dev build", "v0.0.0-dev", "v0.63.5+abcdef1", ""}, | ||
| } | ||
| for _, tc := range cases { | ||
| t.Run(tc.name, func(t *testing.T) { | ||
| if got := daemonSkewWarning(tc.daemonV, tc.localV); got != tc.want { | ||
| t.Fatalf("daemonSkewWarning(%q, %q) = %q, want %q", tc.daemonV, tc.localV, got, tc.want) | ||
| } | ||
| }) | ||
| } | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.