Skip to content

feat(pr-review): re-review feature v0.8.0 + doc context enrichment planning#19

Merged
orioltf merged 34 commits intodevelopfrom
feature/pre-review/doc-context-enrichment
May 6, 2026
Merged

feat(pr-review): re-review feature v0.8.0 + doc context enrichment planning#19
orioltf merged 34 commits intodevelopfrom
feature/pre-review/doc-context-enrichment

Conversation

@orioltf
Copy link
Copy Markdown
Member

@orioltf orioltf commented May 6, 2026

Summary

  • Re-review feature (specs 00–09, v0.1.x → v0.8.0): review-pr now detects prior Claude Code reviews and enters re-review mode automatically — targeting the latest iteration, diffing only new commits, classifying existing threads, replying to them instead of duplicating, and posting a compact delta summary instead of a full one.
  • Test suite: 4 extracted JS modules (parse-signature, detect-prior-review, classify-thread, match-finding) with 25 passing tests and 11 fixture files covering all ADO thread scenarios.
  • Doc context enrichment (spec 10, planning only): ADRs 0010–0011, CONTEXT.md updates, spec file, and 4 ready-for-agent issues published. Implementation is on the next feature branch.

What changed in re-review mode

Spec Change
01 Normalize bot signature to 🤖 *Reviewed by Claude Code* — Iteration N
02 Detect prior review via paginated thread fetch; set IS_REREVIEW, SUMMARY_THREAD_ID, PRIOR_ITERATION_ID
03 Resolve LATEST_ITERATION_ID / LATEST_COMMIT_ID from PR iterations API; retire hardcoded iterationId=1
04 Incremental diff between PRIOR_COMMIT_ID and LATEST_COMMIT_ID; early exit when no new commits
05 Classify prior bot threads as addressed, disputed, pending, or obsolete
06 Reply to existing threads instead of posting duplicates; post run-completion marker
07 Post delta reply (counts + bullet list) to existing summary thread; skip if nothing changed; fall back to full summary if prior summary thread deleted
08 Version bump, README Re-review section, CLAUDE.md cleanup
09 Complete test fixture suite across all four extracted modules

Test plan

  • pnpm --filter pr-review test — 25 tests, 0 failures
  • pnpm --filter pr-review verify:changelog — passes
  • CI passes on all three OSes × Node 22 and 24

🤖 Generated with Claude Code

orioltf and others added 30 commits May 6, 2026 01:05
Introduces two new domain terms for the doc context enrichment feature:
- Doc Context: aggregated summaries of work items and Confluence pages
  injected as a preamble into every Review Aspect agent's prompt
- Doc Context Sub-agent: short-lived agent that fetches and summarises
  a single source in a diff-aware way

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ADR-0010: Confluence fetch logic lives as an inline .mjs script in
pr-review/ rather than depending on unic-confluence or extracting a
shared package — no runtime package resolution for installed plugins
without a bundler; credential lookup mirrors unic-confluence convention
(env vars → ~/.unic-confluence.json) for the shared Unic audience.

ADR-0011: New work item and doc sources are added as additive parallel
paths, not a plugin registry — one source each does not justify the
abstraction overhead. Condition to revisit: when a third distinct source
type is introduced.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… Confluence

Adds a Doc Context gathering phase (step 4a) that runs before review
agents and injects structured, diff-aware summaries of linked ADO work
items and any Confluence pages referenced in their descriptions. Context
is internal to agents only — no new PR comments are posted.

Key design decisions captured in the spec:
- Always-on; degrades gracefully at every tier (no work items, no creds,
  fetch errors) with console warnings where actionable
- Two levels of parallel Doc Context Sub-agents: per work item and per
  Confluence page
- Summaries are diff-aware and structured with source provenance labels
- Step 4a runs in parallel with steps 5–7; step 8 waits for it

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… scenarios

- extend-pr-review-to-check-docs: original idea (PR description, ADO
  work items, Confluence pages as reviewer context)
- alternative-work-item-sources-for-doc-context: Jira, GitHub Issues,
  etc. as future linked work item sources
- alternative-doc-sources-for-doc-context: GitHub Wiki, Notion, etc.
  as future doc link destinations; flags auto-detect vs. config-file
  design question for future grilling

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… range

Remove hardcoded 0.2.0 target from spec 10 — the correct version depends
on what the re-review feature ships at and must be determined at bump time.

Extend the PROMPT.md spec scan range from the hardcoded "00 → 09" to
"in order" so Ralph picks up spec 10 without manual edits.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d apply triage

Publishes the full issue set for the doc context enrichment feature:

- PRD.md: parent document (status: closed)
- 01: Confluence page client + node:test suite (ready-for-agent)
- 02: Work item Doc Context enrichment — step 4a (ready-for-agent)
- 03: Confluence page Doc Context enrichment (ready-for-agent, blocked by 01+02)
- 04: Version bump + CHANGELOG + docs (ready-for-human)

Issues 01–03 include agent briefs. Issue 04 includes a note explaining
why it cannot be delegated to an agent (version depends on re-review
shipping first; prose authorship benefits from human judgment).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…suffix

Interim commit before version bump — part of spec-01.
All emitted signatures now use asterisk italics and include the
— Iteration {LATEST_ITERATION_ID} suffix. Detection prefix documented
in Comment signature and Notes sections.
…ead fetch

Inserts Step 3.5 between the PR metadata fetch and file listing steps.
Paginates ADO pullRequestThreads, scans all comments for the bot signature
prefix, and exports IS_REREVIEW, PRIOR_THREADS_FILE, SUMMARY_THREAD_ID,
and PRIOR_ITERATION_ID for use by downstream re-review steps.
Step 3.5 unconditionally fetches all ADO PR threads via paginated API,
scans every comment for the bot signature prefix, and exports four
variables (IS_REREVIEW, PRIOR_THREADS_FILE, SUMMARY_THREAD_ID,
PRIOR_ITERATION_ID) for downstream re-review specs to consume.
…(v0.2.1)

Two prior summaries caused isSummaryThread=true on both entries.
Post-process the array to mark only the max-threadId candidate, and
use last() instead of first() when reading SUMMARY_THREAD_ID.
…th LATEST_ITERATION_ID

- Add Step 3.6 to fetch pullRequestIterations and resolve LATEST_ITERATION_ID
  and LATEST_COMMIT_ID via jq max_by(.id)
- Add PRIOR_COMMIT_ID resolution for IS_REREVIEW=true (direct lookup +
  timestamp fallback for legacy comments without the — Iteration N suffix)
- Replace hardcoded iterationId=1 in Step 4 with $LATEST_ITERATION_ID
- Update Notes section and CLAUDE.md rule
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Branch Step 5 on IS_REREVIEW for incremental vs full diff
- Early exit when PRIOR_COMMIT_ID == LATEST_COMMIT_ID (no new commits)
- Fallback warnings with both commit IDs on git fetch failure
- Export DIFF_HUNKS_FILE (JSON) for spec 05 thread classification
- Mark spec 04 done
…s checks

README row for spec 04 was left as pending after the implementation commit,
which would cause the loop to re-target and re-implement it. Also removed
the dead numeric comparisons (.status == 1 / .status == 6) from the Path C
jq filter — ADO returns thread status as strings, making these unreachable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dules

- Extract parseSignature, classifyThread, matchFinding, detectPriorReview into scripts/re-review/
- Add 11 fixture JSON files under tests/fixtures/ covering all classification scenarios
- Write 25 tests across 4 test files (node:test); all pass
- Wire modules into commands/review-pr.md; fix printf vs echo for zsh JSON safety

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the apps/claude-code/pr-review plugin to support automatic re-review mode on Azure DevOps PRs (v0.8.0), adds a dedicated node:test suite for the extracted re-review modules, and publishes planning-only documentation/ADRs/issues for upcoming “Doc Context enrichment”.

Changes:

  • Add re-review detection + incremental diff + thread classification + thread-reply + delta-summary behavior to review-pr (plus completion markers).
  • Extract core re-review logic into 4 small JS modules and add fixture-driven node:test coverage.
  • Publish spec/ADRs/issues/inbox notes for Doc Context enrichment (work items + Confluence), without implementing it yet.

Reviewed changes

Copilot reviewed 56 out of 56 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/issues/pr-review-doc-context-enrichment/PRD.md PRD for Doc Context enrichment (planning).
docs/issues/pr-review-doc-context-enrichment/04-version-bump-and-docs.md Human-guided release/docs checklist for spec 10 (planning).
docs/issues/pr-review-doc-context-enrichment/03-confluence-page-doc-context-enrichment.md Ready-for-agent issue: Confluence page sub-agent behavior (planning).
docs/issues/pr-review-doc-context-enrichment/02-work-item-doc-context-enrichment.md Ready-for-agent issue: work-item Doc Context step 4a (planning).
docs/issues/pr-review-doc-context-enrichment/01-confluence-page-client.md Ready-for-agent issue: Confluence client script + tests (planning).
docs/issues/inbox-collision-check/01-fix-exit-code.md Formatting/wording adjustment in an existing issue doc.
docs/inbox/extend-pr-review-to-check-docs.md Inbox note capturing initial doc-enrichment idea.
docs/inbox/alternative-work-item-sources-for-doc-context.md Inbox note on future non-ADO work-item sources.
docs/inbox/alternative-doc-sources-for-doc-context.md Inbox note on future non-Confluence doc sources.
apps/claude-code/pr-review/tests/parse-signature.test.mjs Unit tests for signature parsing module.
apps/claude-code/pr-review/tests/match-finding.test.mjs Unit tests for matching findings to prior threads.
apps/claude-code/pr-review/tests/detect-prior-review.test.mjs Unit tests for prior-review detection from thread lists.
apps/claude-code/pr-review/tests/classify-thread.test.mjs Unit tests for classifying prior threads vs diff hunks.
apps/claude-code/pr-review/tests/fixtures/threads-pending.json Fixture: pending threads + summary thread.
apps/claude-code/pr-review/tests/fixtures/threads-partial-run.json Fixture: partial run scenario threads + summary.
apps/claude-code/pr-review/tests/fixtures/threads-paginated-p2.json Fixture: pagination page 2.
apps/claude-code/pr-review/tests/fixtures/threads-paginated-p1.json Fixture: pagination page 1 with continuation token.
apps/claude-code/pr-review/tests/fixtures/threads-obsolete.json Fixture: obsolete thread scenario.
apps/claude-code/pr-review/tests/fixtures/threads-fresh-pr.json Fixture: no threads scenario.
apps/claude-code/pr-review/tests/fixtures/threads-disputed.json Fixture: disputed thread (human reply).
apps/claude-code/pr-review/tests/fixtures/threads-addressed-status.json Fixture: addressed thread via status.
apps/claude-code/pr-review/tests/fixtures/threads-addressed-diff.json Fixture: addressed thread via diff intersection.
apps/claude-code/pr-review/tests/fixtures/diff-hunks-with-changes.json Fixture: diff hunks with changes.
apps/claude-code/pr-review/tests/fixtures/diff-hunks-no-change.json Fixture: no diff hunks.
apps/claude-code/pr-review/scripts/re-review/parse-signature.mjs Module: parse iteration from canonical bot signature.
apps/claude-code/pr-review/scripts/re-review/match-finding.mjs Module: match new finding to prior thread via path/line overlap.
apps/claude-code/pr-review/scripts/re-review/detect-prior-review.mjs Module: identify prior bot threads + summary thread + prior iteration.
apps/claude-code/pr-review/scripts/re-review/classify-thread.mjs Module: classify prior threads as addressed/disputed/pending/obsolete.
apps/claude-code/pr-review/README.md Document new signature format + re-review behavior/limitations.
apps/claude-code/pr-review/ralph.yml Adjust Ralph orchestrator settings and quoting.
apps/claude-code/pr-review/PROMPT.md Update loop instruction to treat ignore specs as complete.
apps/claude-code/pr-review/package.json Bump to 0.8.0 and add explicit test script.
apps/claude-code/pr-review/docs/plans/README.md Mark specs 00–09 done; add spec 10 row.
apps/claude-code/pr-review/docs/plans/10-doc-context-enrichment.md New spec 10 (planning) for Doc Context enrichment.
apps/claude-code/pr-review/docs/plans/09-test-harness.md Mark spec 09 done.
apps/claude-code/pr-review/docs/plans/08-version-bump-and-docs.md Mark spec 08 done.
apps/claude-code/pr-review/docs/plans/07-summary-comment-policy.md Mark spec 07 done.
apps/claude-code/pr-review/docs/plans/06-reply-to-threads.md Mark spec 06 done.
apps/claude-code/pr-review/docs/plans/05-classify-existing-threads.md Mark spec 05 done.
apps/claude-code/pr-review/docs/plans/04-incremental-diff-baseline.md Mark spec 04 done.
apps/claude-code/pr-review/docs/plans/03-target-latest-iteration.md Mark spec 03 done.
apps/claude-code/pr-review/docs/plans/02-detect-prior-review.md Mark spec 02 done.
apps/claude-code/pr-review/docs/plans/01-normalize-signature.md Mark spec 01 done.
apps/claude-code/pr-review/docs/plans/00-preflight.md Mark spec 00 done.
apps/claude-code/pr-review/docs/adr/README.md Add plugin ADR index entries up to 0011.
apps/claude-code/pr-review/docs/adr/0011-additive-parallel-paths-for-doc-context-extensibility.md New ADR for extensibility model (planning).
apps/claude-code/pr-review/docs/adr/0010-inline-confluence-client.md New ADR justifying inline Confluence client (planning).
apps/claude-code/pr-review/docs/adr/0009-summary-delta-as-reply.md New ADR: summary delta as reply; supersedes 0007.
apps/claude-code/pr-review/docs/adr/0007-summary-rewritten-not-appended.md Mark ADR 0007 as superseded by 0009.
apps/claude-code/pr-review/CONTEXT.md Add Doc Context enrichment terminology to domain glossary.
apps/claude-code/pr-review/commands/review-pr.md Major: implement re-review orchestration steps, diff strategy, thread reuse, delta summary, completion markers.
apps/claude-code/pr-review/CLAUDE.md Update signature/iteration rules; remove re-review roadmap line.
apps/claude-code/pr-review/CHANGELOG.md Add 0.8.0 release entry describing re-review feature changes.
apps/claude-code/pr-review/.claude-plugin/plugin.json Bump plugin version to 0.8.0.
apps/claude-code/pr-review/.claude-plugin/marketplace.json Bump marketplace version to 0.8.0.
.prettierignore Ignore all **/CHANGELOG.md to prevent em-dash reflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/claude-code/pr-review/commands/review-pr.md
Comment thread apps/claude-code/pr-review/commands/review-pr.md Outdated
Comment thread apps/claude-code/pr-review/ralph.yml Outdated
Comment thread apps/claude-code/pr-review/scripts/re-review/detect-prior-review.mjs Outdated
orioltf and others added 3 commits May 6, 2026 10:32
… guard Step 11.5, dedup parseSignature

- Move partial-prior-run check from Step 10 Path B to end of Step 3.5 so
  the entire pipeline (diff range, agent analysis, posting) runs in a
  consistent mode from the start
- Guard Step 11.5 completion-marker post with `if [ -n "$SUMMARY_THREAD_ID" ]`
  to avoid a failed API call when no summary thread was detected
- Reuse `parseSignature` in `detect-prior-review.mjs` instead of duplicating
  the `/Iteration ([0-9]+)/` regex; eliminates dead-code risk for parse-signature.mjs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… missing tests, MARKER_FOUND guard

- match-finding.mjs: skip threads where start/end is null instead of
  defaulting to line 0, which caused false positive matches near top of file
- detect-prior-review.mjs: use max() over all parsed iteration IDs instead of
  last-seen; thread insertion order no longer affects priorIterationId
- review-pr.md (Step 3.5): add exit-code guard and value validation for
  MARKER_FOUND to prevent silent wrong-direction fallback on node failure
- tests: add 6 new cases (31 total) covering null-end classifyThread,
  deleted-file [0,0] hunks, numeric ADO status 2/5, null-start/end matchFinding,
  and priorIterationId max-ordering in detectPriorReview

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@orioltf orioltf merged commit 25b50bd into develop May 6, 2026
15 checks passed
@orioltf orioltf deleted the feature/pre-review/doc-context-enrichment branch May 6, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants