Repository navigation
feat(cli): link a prefilled GitHub issue from voltage feedback and panics - #130
Draft
thebrandonlucas wants to merge 2 commits into
Draft
thebrandonlucas wants to merge 2 commits into
thebrandonlucas wants to merge 2 commits into
Conversation
…nics `voltage feedback` prints a new-issue link with the build, platform, and the misbehaving command's words and flag names (never values), plus a link to search existing issues. A person at a terminal gets it opened in a browser; an agent or script never does, gets the report as JSON for `gh issue create`, and its report is marked agent-written. A panic hook prints the same link after the panic message, with the source line and a message scrubbed of IDs, keys, tokens, invoices, addresses, emails, and URLs. Every part is capped so the URL stays under 6,000 bytes. A bug report template gives manual reports the same sections.
The prefilled link wrapped across about nine terminal lines. When a browser opens it, the terminal now says so instead of printing it, and a person's report leaves out the agent instructions, so a --no-browser link stays near 700 characters. Agent and --json reports are unchanged.
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.
Fixes DEV-2955
Problem
When a person or an agent hit a CLI bug, there was no short path to a useful GitHub issue. Reports had to be written by hand, with no build or platform, and could easily carry IDs or keys copied from a failing command.
Behavior
voltage feedback [--title TEXT] [--no-browser] [-- COMMAND...]prints a link to a prefilled new issue, and a link to search existing issues first.--no-browser› Search existing issues first: URLand› File the issue: URL(orOpened in your browser: URL)--no-input,--json, or--output-filetitle,labels,reporter,body,url,search_url,opened[x] An AI agent wrote this report)--is reduced tovoltage, its subcommand words, and flag names, so-- wallets get WALLET --profile prod --jsonbecomesvoltage wallets get --profile --json. No positional or flag value is kept.voltage --versionoutput, OS and architecture, command), and Checks: a search-first box and the agent box. A hidden comment asks agents to search first, keep the agent box checked, and give steps a person can run.After a panic, the default panic message is followed by
This is a bug in voltage. Report it: URL, with the sourcefile:lineand a scrubbed panic message. A dependency's absolute source path keeps only its file name, so the builder's home directory is not included.Scrubbing and caps. Report text passes through
scrub_line(control and bidi characters), and then any word that contains@or://, is 32 or more characters, or is 16 or more characters with a digit becomes[REDACTED](the existing redaction marker). That covers UUIDs, API keys, tokens, invoices, addresses, emails, and URLs. The title is capped at 120 characters, the command at 300, and the panic message at 500. If the encoded URL is still more than 6,000 bytes, the body is trimmed until it fits.Template.
.github/ISSUE_TEMPLATE/bug_report.mdgives manually filed reports the same sections and thebuglabel. Blank issues stay enabled, because the prefilled link usestitle/body/labelsparameters.Design notes
feedbackis a new module (prefilled reports, scrubbing, and the panic hook).cli::outlinewalks the clap command tree without parsing, so it also works on a line that does not parse.startup::runinstalls the hook, andexecutesendsfeedbacktofile_feedbackbefore the configuration is read.labels=from a URL only for users with triage access, so the label is best effort.urlandwebbrowserare already used).output::REDACTEDbecomespub(crate)so the scrubber reuses the marker.Try it
From the repository root, on this branch, with
.envin place:Expect two
›lines: a search link, and aFile the issue:link. Open the second link. The form shows the title, the body with your version and platform,Command: voltage wallets get --account --json(no UUID, nome), and an unchecked agent box.Expect the browser to open the same form.
voltage feedback --json -- payments send lnbc1example --execute | cat voltage feedback --no-inputExpect JSON with
"reporter": "agent","opened": false, and a body with[x] An AI agent wrote this reportandCommand: voltage payments send --execute. No browser opens for either command.The panic link can't be triggered on a normal build. The unit tests cover it, and I checked it by hand with a temporary
panic!that echoed a wallet UUID. The link came out withsrc/startup.rs:LINE, the UUID as[REDACTED], and exit code 101.Checks
docs/guides/troubleshooting.md(new Report a problem),docs/guides/scripting.md,docs/README.md,README.md,docs/quality.md(module ownership), the regenerateddocs/commands.md, andCHANGELOG.md(Unreleased).cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo machete --with-metadata(innix develop),cargo test --locked(207 unit, 150 integration), andpython3 scripts/check-coverage.py.masterwithvoltage-pr-review. Tests cover the new paths: an empty title, no command, an agent versus a person,--no-browser,--, negative values, attached short-flag values, a line that does not parse, the length cap, and the trimming loop.scripts/crap-report.sh, cargo-llvm-cov 0.8.5, knots 1.16.0): 0 violations. The highest score is 18.10 (api.rswait_for_payment, baseline). New functions:cli::outline6,feedback::push_word6,startup::file_feedback4.03, and the rest 1 to 4.startup::executeis 16.file_feedback: the suite has no pty harness, so I checked it by hand under a pty.