✨ feat(pr-signals): a folded signal keeps every review thread folded into it (#586)

Merged
AT
3d ago
+60-11

Slice: #586

Part of https://github.com/veda-hq/niyam/issues/394 (spec v1). The lesson is dedupe-keeps-thread-ids: athya-rules docs/lessons/review-and-merge.md#deduplicated-threads-still-hold-the-merge (read 2026-11-24 at 1d3ffa1).

What it does

  • When niyam pr-signals folds near-duplicate concerns into one signal, the signal now keeps every review thread folded into it. Before this, dedupe kept one id (winner.thread ?? loser.thread), so the other thread stayed unresolved and held the merge.
  • Each signal with a thread carries a new threads: every { thread, comment } folded into it, the winner's first.
  • thread and comment stay the first thread's, the ids review-thread takes. threads[0] is always that pair.
  • duplicates counts as before.
  • A signal with no thread, such as a CI failure or a local finding alone, has no threads.
  • The README's pr-signals section names threads and says to answer every one.

Evidence

  • New tests in src/pr-signals.test.ts:
    • two bots' threads at one line, with the local finding, make one signal whose threads holds both { thread, comment }, the first one's ids as its own;
    • a thread and a local finding make one signal with one thread;
    • a lone thread has a single entry, and a local finding alone has none;
    • two same-body threads keep both ids;
    • prSignals' output carries threads.
  • Full gate on this branch, rebased on 9782b38 (which has #596): pnpm provenance && pnpm typecheck && pnpm lint && pnpm test && pnpm test:scripts && pnpm pins && pnpm pariksha && pnpm hooks:check && pnpm build && pnpm smoke exited 0.
    • pnpm test: 2199 of 2199 pass. pr-signals.ts coverage is 100% lines, 97.08% branches and 100% functions.
    • pnpm test:scripts: 138 of 138 pass.

🤖 Generated with Claude Code


Summary by cubic

Fixes niyam pr-signals deduplication so a folded signal keeps every review thread folded into it. Previously, dedupe kept only one thread id (winner.thread ?? loser.thread), leaving other threads unresolved and holding the merge. Now each signal with a thread carries a threads array with every {thread, comment} folded into it, winner's first; thread and comment still identify the first thread, duplicates counting is unchanged, and signals with no thread have no threads. The README now says each thread in threads holds the merge until it is resolved.