Skip to content

[Epic] Trust the PR: risk digest, shortcut scan, review categories, acceptance criteria - #3476

Merged
integry merged 4 commits into
mainfrom
3461-epic-trust-the-prq
Nov 12, 2026
Merged

integry merged 4 commits into
mainfrom
3461-epic-trust-the-prq

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Trust the PR: risk digest, shortcut scan, review categories, acceptance criteria

This Epic PR aggregates all changes for the plan: Trust the PR: risk digest, shortcut scan, review categories, acceptance criteria

Issues in this Epic

Auto-close

When this PR is merged, the following issues will be automatically closed:

Fixes #3461
Fixes #3462
Fixes #3463
Fixes #3464


Created automatically by ProPR

propr-dev[bot] and others added 2 commits November 12, 2026 10:52
…low-up and `/fix` runs now include a "Review digest" section. It groups the changed files into high, normal and low risk, then shows per-command validation results, then the diff size. With no diff it renders as an empty string, so existing PR bodies are unchanged. Typecheck and `eslint --max-warnings 0` are clean for root `src/`, core, cli and shared. The new and affected test files all pass, and so do the 45 test files that import the job modules I touched.

Template section and docs
- `digest` is a new section in `PR_TEMPLATE_SECTIONS`, fixed after `summary`. It has a `{{digest}}` placeholder, which is treated as untrusted text so HTML in it gets escaped.
- The `propr init` template scaffold has a commented-out `## digest` example, and `propr repo validate` accepts the section.
- `docs/docs/features/pr-templates.md` has a new "Review digest" section.

What the digest contains (`packages/core/src/workflow/reviewDigest.ts`, `reviewDigestMarkdown.ts`, `reviewDependencies.ts`)
- High risk by default: CI and workflow files, `.propr/`, agent config files (`CLAUDE.md`, `AGENTS.md`, `.claude/`, `.mcp.json`…), lockfiles, dependency manifests and migrations.
- Low risk: docs and tests. A test or doc about auth stays low risk.
- Auth- and payment-looking paths are checked after docs and tests, and are high risk.
- Everything else is normal risk.
- New dependencies are listed by name for npm/composer, requirements files, pyproject/Cargo/Pipfile, go.mod, Gemfile, Gradle, Maven, .NET and pubspec. Version bumps and moved entries are not listed. This works from the diff text alone, so it can miss an entry when a diff hunk starts in the middle of a dependency block.
- Limits: at most 50 files are listed across all tiers, then "…and N more". The structured data keeps counts and up to 200 files per tier. No diff content is included. Paths, package names and commands are shown as code and checked for secrets.

`review.risk_paths` (`.propr/workflow.yml`)
- It is a list of extra high-risk globs. Matching uses the same matcher as `protected_paths`, so the patterns behave the same way.
- I moved the glob-list check into a shared `validatePathGlobList` that both keys use. The `auto_merge.protected_paths` error messages are unchanged.
- It is in the runtime validator, the JSON schema (with a test that the schema and the validator accept the same files), the `propr init` scaffold and `repository-workflow.md`.

Where it's computed
- Issue runs: `createPullRequest` diffs from the task's starting commit and passes the result to `generateCompletionCommentParts`. That returns `digest` (markdown) and `reviewDigest` (structured data).
- Follow-up and `/fix` runs: the digest covers the run's own commit and is built before the push. Building it after a push that has to merge in other commits would diff the merge commit instead. The rendered section is saved with the publication checkpoint, so a restart that recovers the publication posts the same digest.
- Timeline: each digest is written once to `task_history` with `metadata.event: 'review.digest'`. A failed write is logged and never fails the run.

Other changes
- Several existing tests replace `@propr/core` with a fixed list of exports, so new direct imports would break them. The new job code (`reviewDigestLazy.ts` / `reviewDigestRun.ts`) loads core on demand instead, and any failure there just means no digest.
- I moved the file classifiers out of `prDiffFormatting.ts` into `@propr/shared` (`changedFileKinds.ts`).
- I moved two history-metadata helpers out of `prCommentPostExecution.ts` into `prCommentPostExecutionHistory.ts` to keep that file under the 400-line lint limit.

Tests: new `packages/core/test/reviewDigest.test.ts` and `test/reviewDigestPublication.test.ts` run against real temporary git repos, plus new cases in the shared and core `prTemplate` tests, `repositoryWorkflow.test.ts` and `cliInitCommand.test.ts`. As a check, removing the digest from the PR body makes the new PR-description tests fail.

Preview: the screenshot comes from real digest output for a sample commit. The Markdown was rendered locally with micromark and GitHub-like CSS in headless Chromium, not by GitHub itself.
…-ranked-digest--20261112-1026-g7s

[3461 by Claude Opus 5.5] Add a risk-ranked digest section to agent PR descriptions and completion comments
@propr-dev

propr-dev Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Epic progress: Trust the PR: risk digest, shortcut scan, review categories, acceptance criteria

1 out of 1 PRs merged ✅

██████████ 100%

Merged child PRs: #3466

3 planned issues were closed without a merge and are not counted.

✅ This epic PR has been merged into main.


This comment is updated automatically by ProPR as child PRs merge.

@propr-dev propr-dev Bot added the AI label Nov 12, 2026
@integry

integry commented Nov 12, 2026

Copy link
Copy Markdown
Owner

/merge

@propr-dev

propr-dev Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from main into 3461-epic-trust-the-prq in commit feaadfc

Conflicting Files

  • docs/docs/features/repository-workflow.md
  • packages/core/src/workflow/autoMergePolicy.ts

Resolution Summary

I resolved both conflicted files and no conflict markers are left anywhere in the repository. Core typecheck and eslint --max-warnings 0 on the edited file pass. The four relevant test files also pass: autoMergePolicy (47), repositoryWorkflow (41), autoMergeUpToDate (20) and autoMergeGateUpToDate (7). They only run with PROPR_DEMO_MODE=true; without it they fail on the GitHub-auth check before any test runs.

1. packages/core/src/workflow/autoMergePolicy.ts

What clashed: both branches rewrote the end of validateAutoMergeConfig, where the auto_merge.protected_paths globs are checked.

  • This PR turned that check into a general exported function, validatePathGlobList(paths, field, maxItems). repositoryWorkflow.ts also calls it to check the new review.risk_paths setting.
  • main moved the same check into a private validateProtectedPaths(paths) that only knows the auto_merge.protected_paths field. The rules and error messages were unchanged.

How I resolved it: I kept the PR's version.

Why: review.risk_paths validation in repositoryWorkflow.ts imports validatePathGlobList, so main's version would break it. The PR's function also does everything main's does. Called with 'auto_merge.protected_paths' and AUTO_MERGE_MAX_PROTECTED_PATHS, it produces exactly the same error messages, so main's change adds nothing that is lost. Nothing else uses validateProtectedPaths. The rest of main's work in this file (require_up_to_date, max_branch_updates_per_hour, upToDate on the decision) was outside the conflict and is still there.

2. docs/docs/features/repository-workflow.md

What clashed: both branches added new text after the "Epic queues" paragraph at the end of the auto-merge section.

  • This PR added a new top-level section, ## Review digest risk paths, which documents review.risk_paths.
  • main added a ### Up-to-date branches subsection to the auto-merge section, which documents require_up_to_date, how branch updates are taken one PR at a time, the hourly update limit, and the table of reasons.

How I resolved it: I kept both, with main's subsection first and the PR's section straight after it, followed by ## Network as before.

Why: they describe separate features and don't overlap. main's ### subsection belongs inside the auto-merge section. Putting the PR's ## section after it keeps the headings in the right order, so the subsection doesn't end up under the risk-paths heading.


🤖 Resolution Details

  • Model: Claude Opus 5.5
  • Time: 3m 8s

View Task Execution


System-triggered merge conflict resolution

Automatically resolved merge conflicts after merging target branch into PR branch.
Resolved conflicts in:
- docs/docs/features/repository-workflow.md
- packages/core/src/workflow/autoMergePolicy.ts

PR: #3476
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: CodeQL

Please investigate and fix this CI failure.

Failure evidence

packages/shared/src/changedFileKinds.ts:62 — Polynomial regular expression used on uncontrolled data
This regular expression that depends on library input may run slow on strings starting with '-test.' and with many repetitions of '-spec.'.
This regular expression that depends on library input may run slow on strings starting with '-test.' and with many repetitions of '-spec.'.

@propr-dev

propr-dev Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 1b0f89a

Summary of Changes

I fixed the slow regular expression CodeQL flagged in isTestFile (packages/shared/src/changedFileKinds.ts). The shared package typechecks and the review digest tests pass (11 of 11).

Cause: the pattern /[._-](?:test|spec)\.[^/]+$/ was tested against the whole path. At every -spec. it re-read the rest of the string to the end, so a path like -test. followed by many -spec. and ending in / took time that grew with the square of its length.

Fix: isTestFile now takes the last path segment first and checks the file-name patterns only against that:

  • /[._-](?:test|spec)\../i — a .test./.spec.-style marker followed by at least one character. This matches the same names as before.
  • /^test_.+\.py$/i — the test_*.py check had the same kind of tail, so I gave it the same treatment and anchored it to the start of the name.

The directory-based checks and the other patterns are unchanged.

Checks:

  • Same answers: I compared old and new versions on 16 sample paths, including edge cases like a trailing /, a/test_.py, x-spec.y/z and an empty string. Results are identical.
  • Speed: the old version took 113 ms on an input with 5,000 repeats. The new one took under 1 ms with 50,000 repeats.
  • Lint: I couldn't lint the file. ESLint skips it because no lint configuration covers packages/shared/src.

There's no visible change, so I didn't create a preview.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @github-advanced-security[bot]
  • Time: 3m 40s
  • Tokens: 365,625 (362,289 in / 3,336 out)
  • Cost: $0.31

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 4552640125✓

…stFile` (`packages/shared/src/changedFileKinds.ts`). The shared package typechecks and the review digest tests pass (11 of 11).

I fixed the slow regular expression CodeQL flagged in `isTestFile` (`packages/shared/src/changedFileKinds.ts`). The shared package typechecks and the review digest tests pass (11 of 11).

**Cause:** the pattern `/[._-](?:test|spec)\.[^/]+$/` was tested against the whole path. At every `-spec.` it re-read the rest of the string to the end, so a path like `-test.` followed by many `-spec.` and ending in `/` took time that grew with the square of its length.

**Fix:** `isTestFile` now takes the last path segment first and checks the file-name patterns only against that:
- `/[._-](?:test|spec)\../i` — a `.test.`/`.spec.`-style marker followed by at least one character. This matches the same names as before.
- `/^test_.+\.py$/i` — the `test_*.py` check had the same kind of tail, so I gave it the same treatment and anchored it to the start of the name.

The directory-based checks and the other patterns are unchanged.

**Checks:**
- **Same answers:** I compared old and new versions on 16 sample paths, including edge cases like a trailing `/`, `a/test_.py`, `x-spec.y/z` and an empty string. Results are identical.
- **Speed:** the old version took 113 ms on an input with 5,000 repeats. The new one took under 1 ms with 50,000 repeats.
- **Lint:** I couldn't lint the file. ESLint skips it because no lint configuration covers `packages/shared/src`.

There's no visible change, so I didn't create a preview.

PR: #3476
Comment by: @github-advanced-security[bot] (ID: 4552640125)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

ℹ️ Analyzed the follow-up request by @propr-dev[bot]

Analysis Summary

This is already fixed on the branch, so I made no changes.

CodeQL failed on commit feaadfc80. The branch's latest commit, 1b0f89a75, came after it and fixes the slow pattern in isTestFile (packages/shared/src/changedFileKinds.ts:59):

  • The flagged pattern: /[._-](?:test|spec)\.[^/]+$/ ran against the whole path. On an input that starts with -test., repeats -spec. many times and ends in /, it re-scanned to the end of the string at every -spec., so the time grew with the square of the length.
  • The fix in that commit: the file-name checks now run only on the last path segment, as /[._-](?:test|spec)\../i and /^test_.+\.py$/i. Neither can backtrack like that.

I checked the current code against CodeQL's example input: 50,000 repeats took 0.25 ms and 500,000 took about 2 ms, so the time now grows linearly. No other file changed on this branch has the same kind of regex.

The CodeQL check should pass on its next run against 1b0f89a75. I haven't seen that result; the failure you got is from the earlier commit.

No code changes were necessary based on the current state of the branch.


🤖 Analysis Details

  • Model: Claude Opus 5.5 (medium)
  • Time: 2m 55s
  • Tokens: 217,292 (215,830 in / 1,462 out)
  • Cost: $0.23

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 6828203689✓

@integry
integry marked this pull request as ready for review November 12, 2026 17:19
@integry
integry merged commit c2cab95 into main Nov 12, 2026
60 of 82 checks passed
@propr-dev

propr-dev Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

✅ Epic merged: Trust the PR: risk digest, shortcut scan, review categories, acceptance criteria

Epic PR #3476 has been merged into main.

1 out of 1 PRs merged into main through this epic PR.

All planned epic work is now merged.

Posted automatically by ProPR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants