Repository navigation
Conversation
…s nothing to production
AI review: no P0-P2 findingsUnstamped ⚪ P3
Not checked: The AI review read the diff, the code, and the PR's text; it ran no tests or builds and read nothing outside this repository.
Human review: needed
The AI review found no P0-P2 problems at f997903, so the code needs no second review for bugs. Decide the points above: approve to accept them, or request changes. Suggested reviewer: |
| func TestFeedback_DevBuildSendsNothingToProduction(t *testing.T) { | ||
| reports := setup(t, &config.TelemetryConfig{DeviceID: "d", NoticeShown: true}) | ||
| // Never contacted: a development build stops before sending. | ||
| t.Setenv("VOLCANO_API_URL", "https://api.volcano.dev") |
There was a problem hiding this comment.
⚪ P3: Dev-build feedback test points the CLI at the real production API
TestFeedback_DevBuildSendsNothingToProduction replaces the httptest sink with https://api.volcano.dev and relies on the new gate to stop the request. If the gate ever breaks, go test posts a test report with token tok to production. That is the kind of traffic this PR is meant to stop, and the test also starts depending on the network. The Flush test avoids this with a recording transport. The feedback command could get a similar hook, for example a package-level client that feedback.Send uses, so a regression shows up as a recorded request and nothing goes out.
Found by claude-opus-5-5
There was a problem hiding this comment.
Fixed in f997903: the command now sends through a replaceable sendClient, and the test sets a recording transport. It asserts no request for the dev build (including debug saves) and exactly one request to /cli/feedback for a release build, so nothing leaves the process even if the gate breaks. The printReport doc comment from the summary now lists the development-build reason too.
| } | ||
| fmt.Fprintln(w, "Telemetry is enabled. Run `volcano telemetry disable` to turn it off.") | ||
| if telemetry.DevBuildToProduction(cfg.APIURL()) { | ||
| fmt.Fprintln(w, "This development build sends no usage data to the production API.") |
There was a problem hiding this comment.
🟡 P2: Make the status message match agent-header reporting
With telemetry enabled and the first-run notice saved, cmd/volcano/main.go still enables agent reporting through Recorder.Reporting(). Under a detected coding agent, internal/api/version_protocol.go therefore continues attaching X-Volcano-Agent* headers to production API requests. The new message incorrectly promises that no usage data is sent. Either apply the development-build gate to agent reporting too, or narrow the message to the usage events suppressed by Flush.
Found by gpt-6.1-sol
There was a problem hiding this comment.
Fixed in f997903: Recorder.Reporting() now also returns false for a development build pointed at the production API (internal/telemetry/telemetry.go), and cmd/volcano/main.go turns the X-Volcano-Agent* headers on only from Reporting(), so no usage data (events or agent headers) goes to production from such a build and the status line is accurate. TestReporting covers it.
…he feedback test off the network
| } | ||
| // A development build keeps its reports out of production | ||
| // analytics. Saving one locally still works. | ||
| devToProduction := telemetry.DevBuildToProduction(cfg.APIURL()) && !telemetry.FeedbackDebugByEnv(os.Getenv) |
There was a problem hiding this comment.
⚪ P3: Coding-agent feedback hint still shows in dev builds that can no longer send feedback
cmd/volcano/main.go:49 sets feedbackHint from recorder.FeedbackOn() && recorder.LoggedIn(), and neither check knows about the new DevBuildToProduction gate. In a go build/go run binary using the default API URL, a coding agent whose command fails is still told to "report it after your task with volcano feedback". The agent then runs it and gets only Feedback not sent: a development build .... That wastes a step in exactly the setup this PR targets: agents running dev builds. The fix is to also require !telemetry.DevBuildToProduction(cfg.APIURL()) || telemetry.FeedbackDebugByEnv(os.Getenv) when computing the hint, for example through a recorder helper so main.go and this command share one condition.
Found by claude-opus-5-5
There was a problem hiding this comment.
Deferred, not fixed in this PR: it is a P3 that affects only unstamped dev builds pointed at production, where the cost is one wasted volcano feedback call that exits 0 with a one-line reason on stderr. Gating the hint means threading the API URL through main.go's hint setup, which restarts this review. Listed as a deferred item for the reviewer.
Tracking
Why
go build,go run,go install) reports versiondevand still points athttps://api.volcano.dev, so developers' runs and test feedback reports reached the production PostHog project through the API. Bothcli_report_submittedevents in production came fromdevbuilds, and one was a testSummary
telemetry.DevBuildToProduction(apiURL): true whenversion.Versionisdevand the API host isapi.volcano.dev(any case, trailing dot allowed) (internal/telemetry/devbuild.go)Flushdrops the event before any request for such a build. Release builds, staging, and local APIs send as beforeRecorder.Reporting()is off for such a build, so API requests carry noX-Volcano-Agent*headers, which the API also forwards to product analyticsvolcano feedback: such a build sends nothing, says why on stderr, and exits 0, the same exit as feedback that is off.--dry-runsays the report would not be sent,volcano feedback statussays why, andVOLCANO_FEEDBACK_DEBUG=1still saves reports locallyvolcano telemetry statusadds a line saying a dev build sends no usage data to productionmake buildtake their version fromgit describe(for examplev0.57.0-3-gabc123), notdev, so they still send. This PR covers unstamped builds onlyRecordstill starts the detachedtelemetry flushprocess in a dev build, which then sends nothing. Gating inRecordtoo would mean changing the recorder tests, which rely on the default API URLReporting()reads the configured cloud API URL, so a dev build with the default URL also sends no agent headers to avolcano localserver. ExportingVOLCANO_API_URLto a non-production URL restores themVerification
make lint: 0 issues;golangci-lint fmt --diff: cleango test ./...: pass;go build ./...: okTestDevBuildToProduction,TestFlush_DevBuildSendsNothingToProductionandTestFeedback_DevBuildSendsNothingToProduction(recording transports: no request fromdev, one fromv0.60.0, nothing leaves the process),TestReporting(no agent headers),TestTelemetryStatus_DevBuildToProduction. With the gate disabled, the gate tests fail