fix(cli): complete version protocol follow-ups#45
Conversation
There was a problem hiding this comment.
Pull request overview
Completes CLI-side version protocol handling for development builds and long-running log streams.
Changes:
- Reports source builds as
devwhile preserving diagnostic User-Agent data. - Displays and consumes API notices when log streams open.
- Expands protocol, login, stream, and state-cleanup tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
internal/logfollow/follow.go |
Adds stream-open callbacks. |
internal/cmd/upgrade/upgrade.go |
Consumes one-shot notices. |
internal/cmd/upgrade/upgrade_test.go |
Tests deprecation and cleanup. |
internal/cmd/functions/logs.go |
Prints notices before following logs. |
internal/cmd/functions/logs_test.go |
Tests runtime-follow notices. |
internal/cmd/frontends/logs.go |
Prints notices before following logs. |
internal/cmd/frontends/logs_test.go |
Tests runtime-follow notices. |
internal/api/version_protocol.go |
Adds consumption and development-version reporting. |
internal/api/version_protocol_test.go |
Tests version classification and consumption. |
internal/api/log_stream_test.go |
Tests stream protocol headers. |
cmd/volcano/main_test.go |
Expands end-to-end notice and login coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| lastInstructions.CLIInstruction = "" | ||
| lastInstructions.LatestVersion = "" |
aabab83 to
44e8be5
Compare
swkeever
left a comment
There was a problem hiding this comment.
LGTM. Reviewed the full change against the source on both branches.
Verified
reportedCLIVersion(): git-describe/dirty/bare-SHA builds reportdev; release/rc/nightly pass through. No false positives on real releases (v*prefix isn't all-hex;-g<sha>detection requires a numeric distance segment + ≥7-char hex sha, so-graphql/-gammaare correctly rejected). Full build id preserved in User-Agent.ConsumeCLIInstructions()one-shot semantics prevent the log-follow early notice from being reprinted byrun()after Execute returns;LastInstructions()still retainsLatestVersion/DeviceInstructionfor the error paths. No duplicate reauth hint (printError reads DeviceInstruction from LastInstructions; PrintAPIInstructionNotices only switches on CLIInstruction).RuntimeWithStreamOpenedfires theopenedcallback via sync.Once after the first successful open, at which point instructions are already recorded by the doer.- Test coverage is thorough and correctly wired (shared thread-safe buffer for the stderr-notice assertions; exempt-auth-route test pins the exactly-once behavior).
No correctness, convention, performance, or security concerns.
marckong
left a comment
There was a problem hiding this comment.
Reviewed as a PR (after-merge). Overall: correct — build, full test suite, and -race all pass; no blocking bugs found.
The consume-once mechanism (ConsumeCLIInstructions + consumedCLIInstructions) and the sync.Once stream-opened callback compose correctly across the success, error, 426, and reconnect paths — no double-print or lost-notice cases. The reportedCLIVersion git-describe/SHA/dirty heuristics correctly map source builds to dev while passing through releases, -rc. prereleases, and -nightly.* forms.
Only a P3 nit: the header-constants comment dropped the pointer to volcano-hosting's canonical copy, so a maintainer changing these values loses the "where to sync" hint — intentional per the PR description.
Approve.
Summary
Follow-up to #39 that completes the CLI-side version-protocol fixes:
devrequest version for source, dirty, and detached-revision builds while preserving the full build identifier inUser-Agentand preserving release/nightly version forms.--followblocks; consume the one-shot instruction so it is not printed again when command execution returns./auth/*device-flow login, and sticky global-state cleanup.Audience
httptestcases, including source-build and login flows.Test
go build ./...go test ./... -count=1go test -race ./internal/api ./internal/cmd/upgrade ./internal/cmd/functions ./internal/cmd/frontends ./cmd/volcano -count=1