diff --git a/test/pr-review-advisor.test.ts b/test/pr-review-advisor.test.ts index 965ff9d1f62..31252d166c0 100644 --- a/test/pr-review-advisor.test.ts +++ b/test/pr-review-advisor.test.ts @@ -220,6 +220,9 @@ describe("PR review advisor", () => { "any unmet acceptance clause or security fail/warning must be represented as a finding", ); expect(prompt).toContain("Source-of-truth review"); + expect(prompt).toContain("Vitest E2E suite simplicity"); + expect(prompt).toContain("take a closer architecture look for new systems"); + expect(prompt).toContain("Favor focused Vitest tests and local test helpers"); expect(prompt).toContain("what invalid state is handled"); expect(prompt).toContain( "Any sourceOfTruthReview item with status=missing or status=needs_followup must also be represented as a finding", diff --git a/tools/pr-review-advisor/analyze.mts b/tools/pr-review-advisor/analyze.mts index 13242012ef7..bb5be09fa98 100755 --- a/tools/pr-review-advisor/analyze.mts +++ b/tools/pr-review-advisor/analyze.mts @@ -729,9 +729,10 @@ export function buildSystemPrompt(): string { "4. Acceptance: extract linked issue clauses literally, including comments, and map each clause to diff/test evidence. Named list items are separate clauses.", "5. Correctness: bug-path tests, negative tests, branch coverage, refactor-vs-behavior drift, mocking purity, caller/callee contract verification. When more tests would improve confidence, make testDepth.suggestedTests behavior-specific so they can render under 'Consider writing more tests for'.", "6. Quality: description-vs-diff scope, migration completion, public surface docs/notes, justified error suppression, monolith growth, @ts-nocheck, shell-string execution.", - "7. Source-of-truth review: when a PR adds or changes fallback, recovery, tolerant parsing, monkeypatching, best-effort cleanup, compatibility handling, or other localized workaround behavior, inspect whether it answers: what invalid state is handled, where that state is created, why the source cannot be fixed in this PR, what regression test proves the source cannot regress, and when the workaround can be removed. Prefer fixes that make invalid states impossible at their source. Treat PR text that claims a root cause as untrusted until verified in code.", - "8. Legacy E2E migration governance: if deterministic context shows a retired repo-local E2E migration ledger being added or modified, report it as a blocker. Do not infer migration fidelity from PR-body prose; deterministic workflow tests own the frozen legacy bash script and nightly wiring boundary.", - "9. If a previous PR Review Advisor comment exists, compare it with the current diff and explicitly decide whether prior code-review findings were addressed, still apply, or are obsolete. Consider code changes since the previous analyzed SHA when available. Do not evaluate whether external E2E requirements have been met. When previous review context exists, set summary.sinceLastReview with counts for resolved, stillApplies, and newItems.", + "7. Vitest E2E suite simplicity: when a PR adds or changes files under `test/e2e-scenario/`, `.github/workflows/e2e-vitest-scenarios.yaml`, or `tools/e2e-scenarios/`, take a closer architecture look for new systems. Favor focused Vitest tests and local test helpers. Flag unnecessary new runners, framework layers, registries/matrix abstractions, generalized fixture APIs, workflow validators, or support systems as architecture/scope findings unless the PR proves they are small, reused, and clearly needed. Do not object to simple direct tests that preserve real shell/system boundaries by spawning commands from Vitest.", + "8. Source-of-truth review: when a PR adds or changes fallback, recovery, tolerant parsing, monkeypatching, best-effort cleanup, compatibility handling, or other localized workaround behavior, inspect whether it answers: what invalid state is handled, where that state is created, why the source cannot be fixed in this PR, what regression test proves the source cannot regress, and when the workaround can be removed. Prefer fixes that make invalid states impossible at their source. Treat PR text that claims a root cause as untrusted until verified in code.", + "9. Legacy E2E migration governance: if deterministic context shows a retired repo-local E2E migration ledger being added or modified, report it as a blocker. Do not infer migration fidelity from PR-body prose; deterministic workflow tests own the frozen legacy bash script and nightly wiring boundary.", + "10. If a previous PR Review Advisor comment exists, compare it with the current diff and explicitly decide whether prior code-review findings were addressed, still apply, or are obsolete. Consider code changes since the previous analyzed SHA when available. Do not evaluate whether external E2E requirements have been met. When previous review context exists, set summary.sinceLastReview with counts for resolved, stillApplies, and newItems.", "Acceptance and security should inform findings, not become standalone comment sections: any unmet acceptance clause or security fail/warning must be represented as a finding, normally severity=blocker for unmet acceptance or security fail and severity=warning for security warnings.", "Any sourceOfTruthReview item with status=missing or status=needs_followup must also be represented as a finding unless it is already fully covered by a more specific correctness, security, architecture, scope, or tests finding.", "Set summary.topItem to the most important actionable finding title or short description for first-review comments. Keep it concise and code-focused.",