Skip to content

Require NCode Review's approval where its approver app can write - #462

Merged
polewskm merged 11 commits into
mainfrom
claude/charming-cray-q7vja4
Nov 21, 2026
Merged

polewskm merged 11 commits into
mainfrom
claude/charming-cray-q7vja4

Conversation

@polewskm

@polewskm polewskm commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

#460's test showed two things. GitHub counts an approval toward a required approval when the reviewer can write to the repository, even when the token that submitted it can only write pull requests. And while "Allow GitHub Actions to create and approve pull requests" is on, any writer's pull request can approve itself.

  • tools/Set-RepositoryBaseline.ps1 requires one approval, of the last push, wherever NCode Review's approver is set up, with one writer too. Set up means code-review.yml passes approve: true and approver-private-key, and the code-review environment holds NCODE_REVIEW_APPROVER_PRIVATE_KEY. With the input but no secret, it names the fix and requires no approval for it.
  • Every repository gets a read-only workflow token and Actions that can't approve pull requests, raise-baseline.yml or not. -OrganizationPolicy sets the organization's defaults the same way (Set NCodeGroup's Actions defaults to a read-only token that can't approve pull requests #461).
  • raise-baseline.yml pushes baseline-<version> and opens an issue whose link opens the pull request, with Closes #<issue> filled in. A rerun reuses the branch and its issue. A pull request a person opens starts CI and NCode Review's review, so the workflow needs no setting and no gh workflow run ci.yml.
  • The template's code-review.yml pins NCode Review v1.5.0 (a4cdf65) and passes the approver's key in the review job. .template/Update-Project.ps1 tells an existing project whose code-review.yml lacks either.
  • ADR-0036 amends 0022, 0034 and, where a project has it, 0150; it is left out of GitLab projects, as 0034 is. The README, the generated prompts and the v0.111.0 changelog section are updated.

Tests: Test-RepositoryBaseline, the full Test-Template, Test-UpdateNotes, Test-UpdateExitCode, Test-UpdateBaseline, Test-DecisionIndex, Test-ChangelogHeadings, Test-FileHeaders and Test-ScriptAnalyzer pass locally.

Release: v0.111.0

Closes #460
Closes #461
Closes #463
Refs #459
Refs NCodeGroup/code-review#232

🤖 Generated with Claude Code

https://claude.ai/code/session_01MSU4AUtW1RFhu9v7qShrEZ

@ncode-review ncode-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 NCode Review at dd02d76: 6 new findings on the changed lines.

Not on a changed line:

  • 🟠 F2 Should fix: Does the update notice tell existing projects about the approver key? template/.template/Update-Project.ps1:98. code-review.yml is owned by the project, so an update never adds approver-private-key. Update-Project.ps1's NCode Review notice still checks only for the v1.4.0 pin and approve: true, and says nothing about the approver input or Enable-CodeReview.ps1 -ApproverPrivateKeyPath. Fix: Check whether the notice covers this elsewhere. If it doesn't, extend the notice and the script's .DESCRIPTION to name the approver input and secret, and add a test case for the new text.
  • 🟡 F5 Nit: publish.yml's header still says raise-baseline opens the pull request template/.github/workflows/publish.yml:12. The header says the baseline job calls raise-baseline.yml, "which opens the pull request". The workflow now pushes a branch and opens an issue with a link instead. Fix: Reword it to say the workflow pushes the branch and opens an issue whose link opens the pull request. ADR-0150's body can stay as written, since ADR-0036 amends it.

Comment thread tools/Set-RepositoryBaseline.ps1 Resolved
Comment thread tools/Set-RepositoryBaseline.ps1 Resolved
@ncode-review

ncode-review Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Superseded by the review at 0f87196.

…projects about the approver, and correct the texts that still say it opens the pull request

Copy link
Copy Markdown
Collaborator Author

Autopilot: Fixed in 0f87196, for the two findings that aren't on a changed line:

  • F2 (update notice): Get-CodeReviewNote in template/.template/Update-Project.ps1 names a code-review.yml that pins NCode Review before v1.5.0, or that passes approve: true without approver-private-key. Its message tells the maintainer to pass the input, to store the approver's key with tools/Enable-CodeReview.ps1 -ApproverPrivateKeyPath, and to run the baseline again. The script's .DESCRIPTION, tests/Test-UpdateNotes.ps1 (two new cases) and the changelog entry match.
  • F5 (publish.yml): the header says raise-baseline.yml pushes the branch and opens an issue whose link opens its pull request.

Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

/review


Generated by Claude Code

@ncode-review

ncode-review Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Superseded by the review at c01d813.

Copy link
Copy Markdown
Collaborator Author

Autopilot: The Test the template failure at dd02d76 is this pull request's. All 15 failures are GitLab renders, with the check "every template decision record a Markdown file cites is one the project has": ADR-0036 cites ADR-0034, which GitLab projects don't get. ADR-0036 decides GitHub rulesets, so the next push leaves it out of GitLab projects in copier.yml's GitHub-only list, as 0034 and 0035 are. Its index row was already in the git_host == 'github' block. The full tests/Test-Template.ps1 passes locally with that change.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

/review


Generated by Claude Code

@ncode-review

ncode-review Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Superseded by the review at f2431f4.

Copy link
Copy Markdown
Collaborator Author

/review


Generated by Claude Code

@ncode-review

ncode-review Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Superseded by the review at a7013f9.

Copy link
Copy Markdown
Collaborator Author

/review


Generated by Claude Code

@ncode-review

ncode-review Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

🤖 Review complete

Verdict: ✅ Approve — Re-review of what changed since the last review at f2431f4: 1 hunk in 1 file, by correctness only. Earlier findings: F1 fixed, F3 fixed, F4 fixed, F6 fixed, F7 fixed, F8 fixed. No further findings above nits.

1 reviewer run — 0 findings (run details)

Reviewer Model Findings Top
correctness sonnet-5-5 0 🟢

Trial: findings are posted as review threads and in the check run. $0.05 on Amazon Bedrock, 13s, at a7013f9. (how to interact)

📋 Outcomes

Merged at a7013f9: 5 fixed, 1 dismissed, 0 acknowledged, 0 ignored.

Finding Reviewer Severity Outcome
F1 architecture, correctness 🟠 Should fix ✅ fixed
F3 tests 🟡 Nit ✅ fixed
F4 tests 🟡 Nit 👎 dismissed
F6 rule-check 🟡 Nit ✅ fixed
F7 hygiene 🟡 Nit ✅ fixed
F8 hygiene 🟡 Nit ✅ fixed

@polewskm polewskm self-assigned this Nov 21, 2026
@polewskm
polewskm marked this pull request as ready for review November 21, 2026 16:55
@polewskm
polewskm merged commit fd50a4b into main Nov 21, 2026
69 checks passed

This branch was previously deployed

1 inactive deployment
code-review — a7013f94 Deployed Nov 21, 2026 by polewskm via review #1255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant