Files
amethyst/scripts
Claude db8089c084 feat: make a pasted crash report retrace itself in one command
Follow-up to the R8 mapping work: close the last two gaps between "user sends a
crash report over NIP-17" and "maintainer reads real names".

`scripts/retrace.sh <report>` now needs nothing else. A report's first line
already names its own build — `java.lang.IllegalStateException: 1.16.0-PLAY` —
so the script resolves the tag (v1.16.0) and flavor (PLAY -> googleplay),
downloads that release's mapping asset over plain HTTPS (no gh auth needed on a
public repo) and caches it. `--release`/`--flavor` for a bare stack trace with
no header, or a mapping path for a local build; all three forms tested.

It refuses to guess: a report's `r8-map-id-<hash>` is the `pg_map_id` of the one
mapping that built it, so the two are compared before anything is printed. The
wrong mapping does not fail loudly, it prints confident wrong names — worse than
no answer. `--force` overrides. A branch build (1.16.0-my-branch-PLAY) is named
as such instead of 404ing on a release that never existed.

Two ReportAssembler fixes, both found by running the real report format through
retrace rather than assuming it worked:

- Frames were written as "    <frame>" with no `at`. Retrace only rewrites
  frames it recognises and it recognises them by the leading `at`, so a release
  report was passed through completely untouched — every frame still
  obfuscated, looking exactly like a mapping problem. Now "    at <frame>",
  which is also what every other stack-trace tool expects. The script still
  repairs the missing `at` so reports from older builds retrace too.

- The headline used `e.javaClass.simpleName`, which obfuscates to "a:" and
  cannot be retraced back — a bare simple name has no package to resolve
  against. Now the fully qualified name, verified to retrace: "onh: 1.16.0-PLAY"
  comes back as
  "com.vitorpamplona.amethyst...ShortNotePostViewModel: 1.16.0-PLAY".
  The headline is what you skim and dedup on, so it is worth the extra chars.

Verified end to end against the real playRelease mapping: a full report (device
table, code fences, cause section) in via file and via stdin, frames retraced
including R8's inlined frames expanded 1 -> 3, device table untouched; wrong
map-id refused; missing release reported with the asset URL it looked for.
ReportAssemblerTest green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEoxktEZyTrAS33vVZBiwm
2026-09-18 22:24:14 +00:00
..