Skip to main content

Module report_bug

Module report_bug 

Source
Expand description

Bug-report payload builder.

:report-bug shows the operator a scrubbed report containing version / OS / recent-log-lines / recent activity, and offers two ways to actually file it:

  • y — copy to clipboard (paste into a GitHub issue manually)
  • b — open a new GitHub issue in the browser, body pre-filled via URL query params
  • esc — cancel

Ebman itself never sends the payload anywhere. The friction (operator pastes into an issue) is the feature: it keeps the tool defensible to operators running against regulated workloads.

The scrubber runs over the assembled payload to redact the obvious leaks: account IDs, ARNs, env names from the live env list, profile / role names from the active context, and CNAMEs / FQDNs. It’s not bulletproof — a freeform error message could still embed a customer name — which is why the operator sees the exact payload before it leaves their machine.

Structs§

ReportInput
Markdown-ish report payload, ready to be displayed in the overlay or pasted into a GitHub issue. Caller passes pre-collected pieces of context so this module stays free of App / tokio dependencies — pure string assembly, testable in isolation.
ScrubContext
Sensitive tokens supplied by the caller — pulled from the live App state at report-build time. account_id is the operator’s own account, but it’s still PII for “this is the org running ebman” so gets the same treatment as the others.

Functions§

build_report
Build the full report. Returns the assembled + scrubbed payload. Two passes:
github_issue_url
Build the GitHub issues/new URL with the report pre-filled. GitHub caps URL length at ~8192 chars; truncate the body if it would push us past 7900 so the title + URL params still fit.
latest_crash_log
Read the most recent crash log written by the panic hook. Returns None when no crash logs exist. Helper so the report builder can stay synchronous + pure.
scrub
Apply identifier scrubbing to text. Order matters: longer / more-specific patterns first so the shorter ones don’t eat substrings of them. Pure; tested below.
tail_ebman_log
Read the tail of ~/.cache/ebman/ebman.log — up to n lines. Errors silently to an empty Vec; the report still ships, just without log context.
url_encode
URL-encode a body for GitHub’s issues/new?body= URL. Lighter than pulling in urlencoding for one call site; only encodes the characters GitHub’s URL parser is sensitive to.