Files
Claude 776058fb60 fix: second amy audit — group routing, deletions, renderer crashes
Each finding was reproduced by a failing test (or a harness check) first.

Shared code (app + amy):
- ThreadLevelCalculator: reply cycles (articles `a`-tagging each other or
  themselves) overflowed the stack in thread ordering and depth.
- UrlDetector: a run of '@' recursed once per character (StackOverflowError
  that escaped the renderer); every ':' rescanned the token for '@', which
  made 160 KB of `a:` take 27 s (now 0.3 s).
- ContentWarningTag.parse crashed on an empty tag, which reduced every kind
  to the minimal rendering.
- EventRendererRegistry.render catches Throwable, so hostile content can't
  kill a feed.

Renderer: kind:1 replies rooted by an `a` tag get reply_to/root; zap
amounts of zero or past 21M BTC are null instead of 0 or a wrapped value;
kind:3 no longer repeats every follow as a mention.

One-shot loaders:
- Deletions are applied by address too (a deleted article version came back
  from a stale relay), and to notifications and `notes show` relay results.
- `notifications --type` asks relays for those kinds only; it under-filled.
- An naddr of a replaceable kind no longer filters on `#d: [""]`.
- Each thread filter reads the store once per load, not on every pass.
- A relay list is fetched once per run; large author/id filters are chunked.
- seen_on lists only relays that served the event; every relay is hinted.

amy:
- NIP-29 group content found in the store has no host relay, so routing fell
  back to public relays. Reactions/replies now need the host (--relay HOST),
  reposts and quotes of group content are refused, and deletions go to the
  host only.
- The target author's relay list is loaded before the event is built, so a
  store hit writes the relay hints the app would.
- delete/react no longer fan out to every follow of a list event.
- A private or broadcast relay list that fails to decrypt is reported.

notes-headless.sh adds hint-on-store-hit and four group-routing checks (26/26).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmDZGXB7n5dLuegMARB1Rh
2026-10-06 18:29:33 +00:00
..