Help us shape the future of Go! Take the 2026 Go Developer Survey

feedback

package
v0.52.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package feedback builds and sends the reports `volcano feedback` files: a coding agent's (or a person's) account of a problem it hit with Volcano, such as a CLI bug, docs that disagree with the CLI, or a missing command.

A report is the agent's text plus the machine and agent fields a usage event carries (telemetry.Client). It is sent to POST /cli/feedback on the cloud API (volcano-hosting). The server joins a report to the usage events of the same device_id around its timestamp to find the failing command, so the CLI keeps no record of past runs. Feedback follows the telemetry setting unless the user ran `volcano feedback enable` or `disable`. Sending requires a login token, so only Volcano accounts can send reports; while telemetry is off, a report carries no device ID or project ID and is marked anonymous, so the server does not attribute it to the user.

Index

Constants

View Source
const (
	MaxSummary    = 120
	MaxDetails    = 4000
	MaxExpected   = 1000
	MaxActual     = 4000
	MaxWorkaround = 2000
	MaxCommand    = 500
	MaxCommands   = 10
)

Length limits, in characters.

Variables

View Source
var Categories = []string{
	"cli_bug",
	"docs_mismatch",
	"missing_capability",
	"platform_error",
	"confusing_ux",
	"instruction_conflict",
}

Categories are the kinds of problem a report can be about.

Functions

func Send

func Send(ctx context.Context, client *http.Client, apiURL, token string, payload []byte) error

Send posts payload to apiURL's /cli/feedback, with token as a bearer when it is set. The server rejects a report without a valid token. A nil client uses one with a timeout. The request goes through the API client's shared transport (api.WrapDoer), so --debug traces it and the CLI acts on the response's instructions, such as a reauth notice, as for any API call.

Types

type Input

type Input struct {
	Category   string   `json:"category"`
	Summary    string   `json:"summary"`
	Details    string   `json:"details"`
	Expected   string   `json:"expected"`
	Actual     string   `json:"actual"`
	Workaround string   `json:"workaround"`
	Commands   []string `json:"commands"`
}

Input is what the reporter wrote, from flags or from the JSON object `volcano feedback --input` reads.

func ParseInput

func ParseInput(r io.Reader) (Input, error)

ParseInput reads one JSON object with Input's keys from r. Unknown keys, keys that differ from Input's only in case, repeated keys, and anything after the object are errors, so a misspelled key is not silently dropped and no value silently replaces another.

func (Input) Validate

func (in Input) Validate() error

Validate checks the category, the required fields, and the length limits. Limits are checked on the text as written, so the reporter can shorten it; Report.Validate checks them again after redaction.

type Report

type Report struct {
	// FeedbackID is a UUIDv7 generated here, so the CLI can print it without
	// reading the response, and the server can read the time it was made
	// from it. Each run generates a new one, so an agent that reruns the
	// command after a failed send sends a new ID.
	FeedbackID string `json:"feedback_id"`
	// Anonymous asks the server not to attribute the report to the logged-in
	// user. It is set while telemetry is off.
	Anonymous bool `json:"anonymous"`
	// DeviceID is empty while telemetry is off, as is ProjectID.
	DeviceID   string   `json:"device_id,omitempty"`
	Timestamp  string   `json:"timestamp"`
	Category   string   `json:"category"`
	Summary    string   `json:"summary"`
	Details    string   `json:"details"`
	Expected   string   `json:"expected,omitempty"`
	Actual     string   `json:"actual,omitempty"`
	Workaround string   `json:"workaround,omitempty"`
	Commands   []string `json:"commands"`

	CLIVersion      string `json:"cli_version"`
	OS              string `json:"os"`
	Arch            string `json:"arch"`
	Agent           string `json:"agent"`
	AgentSource     string `json:"agent_source"`
	PluginInstalled bool   `json:"plugin_installed"`
	PluginVersion   string `json:"plugin_version"`
	ProjectID       string `json:"project_id,omitempty"`
}

Report is the request body of POST /cli/feedback. Field names are the wire contract with volcano-hosting; the server validates and redacts every value again.

func Build

func Build(in Input, client telemetry.Client, home string, now time.Time) (Report, error)

Build returns the report for in, with every text field passed through telemetry.ScrubText. It fails only when no report ID can be generated.

func (Report) Validate

func (r Report) Validate() error

Validate checks the report against the same limits as Input.Validate. Redaction can make text longer, such as an email address becoming "[redacted]", so text within a limit as written can be over it here.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL