Skip to content

feat(advisor): make PR review comments easier to scan#5584

Open
cv wants to merge 4 commits into
mainfrom
cvillela/pr-advisor-comment-scan
Open

feat(advisor): make PR review comments easier to scan#5584
cv wants to merge 4 commits into
mainfrom
cvillela/pr-advisor-comment-scan

Conversation

@cv

@cv cv commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR restructures the PR Review Advisor sticky comment so humans and agents can identify merge posture, next actions, finding IDs, and verification criteria more quickly. It keeps required findings visible while moving lower-priority details into scannable sections.

Changes

  • Add stable visible IDs for advisor findings (PRA-*) and test follow-ups (PRA-T*).
  • Render a top-level action checklist and findings index table before detailed findings.
  • Keep required findings expanded with normalized fields, including verification and done-when criteria.
  • Preserve collapsible warning, suggestion, simplification, and test-follow-up sections.
  • Update PR advisor rendering tests for the new structure and escaping behavior.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Git hooks passed during commit and push, or npx prek run --from-ref main --to-ref HEAD passes
  • Targeted tests pass for changed behavior
  • Full npm test passes (broad runtime changes only)
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • New Features
    • Redesigned PR review advisor sticky comments with clearer organization, including “Primary next action”, updated “Open items” summary, a “Findings index” table, and more structured findings/test follow-ups using stable reference IDs.
  • Bug Fixes
    • Improved rendering safety for dynamic content with stronger Markdown/HTML escaping, preserving checklist/table structure for edge-case paths and special characters; updated filename formatting for parentheses.
  • Tests
    • Updated comment expectations and added checks for correct ordering, required checklist formats, “since last review” wording, and escaping/injection resistance.

@cv cv self-assigned this Jun 22, 2026
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f73e5326-30b9-4e40-8156-210ec4067d65

📥 Commits

Reviewing files that changed from the base of the PR and between 851001c and 87c9d0a.

📒 Files selected for processing (2)
  • test/pr-review-advisor.test.ts
  • tools/pr-review-advisor/comment.mts
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/pr-review-advisor.test.ts
  • tools/pr-review-advisor/comment.mts

📝 Walkthrough

Walkthrough

comment.mts is refactored to introduce FindingRecord and TestingFollowupRecord types that attach synthetic PRA-#/PRA-T# IDs to each rendered item. buildComment and all rendering helpers are rewritten to use these records, computing severity counts and assembling new comment sections (headline, posture, action checklist, findings index, structured details). Tests are updated to match the new output format, including escaping validation for hostile file paths.

Changes

PR Review Advisor: Record-Based Comment Rendering

Layer / File(s) Summary
Record types for findings and testing follow-ups
tools/pr-review-advisor/comment.mts
Defines FindingRecord and TestingFollowupRecord types that attach synthetic PRA-# and PRA-T# IDs to each item rendered in the comment.
buildComment orchestration and severity counting
tools/pr-review-advisor/comment.mts
Refactors buildComment to derive findingRecords and testingFollowups from the result, compute blocker/warning/suggestion counts from record severities, and assemble sections via record-based helpers. Introduces reviewHeadline and reviewPosture mapping functions. Adds compactCount utility for "Open items" formatting.
New record-based section renderers
tools/pr-review-advisor/comment.mts
Implements primaryNextAction (embeds first blocker/follow-up with record IDs), buildSecondarySummary (top item and since-last-review titles), topFindingTitle, renderActionChecklist, renderFindingsIndex, and renderFindingsDetails grouped by severity.
Details section renderers and finding formatting
tools/pr-review-advisor/comment.mts
Refactors renderSimplificationDetails and renderTestingFollowupsDetails to accept record arrays and use record IDs. Rewrites formatFinding to format a FindingRecord with updated bullet structure (location, category, problem/impact, recommendation, expected follow-up, verification, missing regression test, done-when, evidence). Implements doneWhenForFinding with severity-tailored text and updates location formatting helpers for table-safe escaping.
Test assertions updated to record-based output
test/pr-review-advisor.test.ts
Aligns sticky-comment assertions to the new structure with PRA-1/PRA-T1 ID prefixes, revised bullet labels, "Action checklist" heading, and bolded "Open items" metric line with counts. Adds new test for checklist ordering (warning findings must precede test follow-ups). Updates test-followup rendering with stricter HTML/mention/code/link escaping. Adds hostile-file-locations test asserting that pipes, newlines, and backticks in file paths are safely escaped within checklist and table rows without breaking structure. Updates parentheses escaping expectations in filenames.

Sequence Diagram

sequenceDiagram
  participant buildComment
  participant findingRecords
  participant testingFollowups
  participant sections

  buildComment->>findingRecords: derive from result with PRA-# IDs
  buildComment->>testingFollowups: derive from result with PRA-T# IDs
  buildComment->>sections: reviewHeadline(recommendation)
  buildComment->>sections: reviewPosture(recommendation)
  buildComment->>sections: primaryNextAction(records)
  buildComment->>sections: compactCount(blocker/warning/suggestion counts)
  buildComment->>sections: renderFindingsIndex(findingRecords)
  buildComment->>sections: renderFindingsDetails(findingRecords)
  buildComment->>sections: renderTestingFollowupsDetails(testingFollowups)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#5567: Shares direct modifications to buildComment, renderFindingsDetails, renderTestingFollowupsDetails, and formatFinding output expectations in the same two files, with this PR adding the record-based PRA-# ID layer on top.
  • NVIDIA/NemoClaw#5572: Extends the finding schema with impact, verificationHint, and missingRegressionTest fields and metadata-driven comment headers in the same comment-generation code paths this PR refactors.
  • NVIDIA/NemoClaw#5575: Adds simplification finding data and dedicated "Simplification opportunities" rendering that this PR directly integrates into the new finding record and ID-based rendering model.

Suggested labels

documentation

Poem

🐇 With records and IDs, the findings align,
Each PRA-# now marks the design,
Checklist and index in structured grace,
Primary actions direct the review's race.
Bold counts and details—a comment so fine! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(advisor): make PR review comments easier to scan' directly and clearly summarizes the main objective of the PR, which is restructuring the PR Review Advisor sticky comment to improve readability and scanning efficiency.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cvillela/pr-advisor-comment-scan

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-code-quality

github-code-quality Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in the branch is 96%. Coverage data for the branch is not yet available.

Show a code coverage summary of the most covered files.
File 87c9d0a +/-
nemoclaw/src/se...cret-scanner.ts 100%
nemoclaw/src/commands/slash.ts 100%
nemoclaw/src/li...bprocess-env.ts 100%
nemoclaw/src/bl...eprint/state.ts 98%
nemoclaw/src/onboard/config.ts 98%
nemoclaw/src/bl...int/snapshot.ts 97%
nemoclaw/src/bl...print/runner.ts 95%
nemoclaw/src/co...ration-state.ts 94%
nemoclaw/src/bl...ate-networks.ts 94%
nemoclaw/src/index.ts 94%

TypeScript / code-coverage/cli

The overall coverage in the branch is 46%. Coverage data for the branch is not yet available.

Show a code coverage summary of the most covered files.
File 87c9d0a +/-
src/lib/state/o...oard-session.ts 91%
src/lib/inference/local.ts 76%
src/lib/sandbox/config.ts 72%
src/lib/actions...dbox/rebuild.ts 67%
src/lib/onboard/preflight.ts 64%
src/lib/actions...licy-channel.ts 56%
src/lib/state/sandbox.ts 55%
src/lib/policy/index.ts 49%
src/lib/onboard...er-gpu-patch.ts 44%
src/lib/onboard.ts 18%

Updated June 22, 2026 04:17 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: None
Optional E2E: None

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • None. No NemoClaw E2E jobs are needed. The PR only changes CI PR Review Advisor comment rendering and its unit tests; it cannot affect real assistant user flows, installer/onboarding, sandbox lifecycle, credentials, security boundaries of the product runtime, network policy, inference routing, or deployment behavior.

Optional E2E

  • None.

New E2E recommendations

  • None.

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Recommendation

Required Vitest E2E scenarios: None
Optional Vitest E2E scenarios: None

Workflow run

Full Vitest E2E advisor summary

Vitest E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required Vitest E2E scenarios

  • None. Changed files are limited to the PR review advisor implementation and its unit tests, outside test/e2e-scenario/ and the Vitest scenario workflow; they cannot affect Vitest scenario behavior.

Optional Vitest E2E scenarios

  • None.

Relevant changed files

  • None.

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor

Review posture: No blocking advisor findings
Action expectation: Address required items before merge. Resolve or explicitly justify warnings. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up.
Findings: 0 required fixes, 0 items to resolve/justify, 0 in-scope improvements
Since last review: 1 prior item resolved, 0 still apply, 0 new items found

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each finding. A human maintainer must make the final merge decision.

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.

1 participant