feat(unic-pr-review): align code-simplifier with toolkit two-phase post-pass model#220
Open
orioltf wants to merge 3 commits into
Open
Conversation
…st-pass model Remove code-simplifier from the Phase 1 parallel fan-out and run it as a Phase 2 post-pass only when Phase 1 yields no Critical/Important findings and ≥3 non-test source files changed (ADR-0013). Exports shouldRunPhase2() from changed-file-analyser.mjs so the gate is unit-testable; adds 12 new tests covering the three canonical AC scenarios plus edge cases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ase2 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Implements a two-phase orchestration model for unic-pr-review so code-simplifier runs only as a sequential post-pass after Phase 1 “Review Aspect” agents, gated by (a) zero Critical/Important Phase 1 findings and (b) ≥3 changed non-test source files—aligning behavior with the pr-review-toolkit model and Issue #216.
Changes:
- Removes
code-simplifierfrom the Phase 1 spawn-set decision and introduces a unit-testableshouldRunPhase2(changedFiles, findings)gate. - Updates the
review-prcommand runbook to describe Phase 2 sequencing for Pre-PR, ADO, and re-review flows; records the decision in a new ADR. - Adds/updates tests and bumps plugin version + changelog for the 2.1.3 release.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| apps/claude-code/unic-pr-review/scripts/lib/changed-file-analyser.mjs | Removes Phase 1 code-simplifier spawn rule; adds shouldRunPhase2 gate helper. |
| apps/claude-code/unic-pr-review/tests/changed-file-analyser.test.mjs | Updates spawn-set assertions and adds a dedicated shouldRunPhase2 test suite. |
| apps/claude-code/unic-pr-review/commands/review-pr.md | Documents Phase 2 gating + sequencing in Pre-PR/ADO/re-review flows and adds a gate evaluation one-liner. |
| apps/claude-code/unic-pr-review/docs/adr/0013-two-phase-code-simplifier.md | New ADR capturing the two-phase decision, gating rules, and interaction with approval/re-review. |
| apps/claude-code/unic-pr-review/CHANGELOG.md | Adds 2.1.3 changelog entry describing the two-phase model. |
| apps/claude-code/unic-pr-review/package.json | Bumps package version to 2.1.3. |
| apps/claude-code/unic-pr-review/.claude-plugin/plugin.json | Bumps plugin version to 2.1.3. |
| apps/claude-code/unic-pr-review/.claude-plugin/marketplace.json | Bumps marketplace entry version to 2.1.3. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+639
to
+644
| node -e " | ||
| const {shouldRunPhase2}=await import('${CLAUDE_PLUGIN_ROOT}/scripts/lib/changed-file-analyser.mjs') | ||
| const files=JSON.parse(process.env.FILES) | ||
| const findings=JSON.parse(process.env.FINDINGS) | ||
| process.stdout.write(shouldRunPhase2(files,findings)?'true':'false') | ||
| " FILES='<JSON.stringify(changedFiles from Step 6)>' FINDINGS='<JSON.stringify(all Phase 1 findings flattened)>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adopts the two-phase post-pass model from
pr-review-toolkitforcode-simplifier:code-reviewer,silent-failure-hunter,type-design-analyzer,pr-test-analyzer,comment-analyzercode-simplifiersequentially — only when Phase 1 has zero Critical/Important findings AND ≥3 non-test source files changedPreviously
code-simplifierwas included in the Phase 1 parallel fan-out, producing misleading "polish" suggestions on code that still had real correctness problems.Changes
scripts/lib/changed-file-analyser.mjs— removecode-simplifierfromSPAWN_TABLE; exportshouldRunPhase2(changedFiles, findings)pure-function gatecommands/review-pr.md— add Phase 2 gate call after Phase 1 fan-out in Pre-PR (Step 7), ADO (Step 1.8), and re-review modestests/changed-file-analyser.test.mjs— addshouldRunPhase2test suite (12 cases covering all canonical AC scenarios); assertcode-simplifierabsent from alldecideSpawnSetoutputsdocs/adr/0013-two-phase-code-simplifier.md— new ADR recording the two-phase decision, gate definition, and interaction with ADR-0002/0003/0007CHANGELOG.md— v2.1.3 entryValidation
pnpm --filter unic-pr-review typecheckpnpm --filter unic-pr-review testpnpm -w run check(Biome + Prettier)pnpm --filter unic-pr-review verify:changelogArchitecture
Fixes #216