Skip to content

fix(engine): approve once the findings that held approval back are settled - #70

Merged
TorstenDittmann merged 3 commits into
mainfrom
claude/project-thread-9xknwx
Nov 27, 2026
Merged

TorstenDittmann merged 3 commits into
mainfrom
claude/project-thread-9xknwx

Conversation

@TorstenDittmann

Copy link
Copy Markdown
Contributor

Requested by Torsten · project thread

What happened

On appwrite-labs/infrastructure#1157 the review left one finding, a minor bug, so it commented instead of approving. A reply showed the finding was intended, and Hansi dismissed it and rebuilt the summary. But the rebuilt summary still said 💬 Commented, still carried "Not approving while a bug finding is open: Held drafts stop being retried after two days", and the check run stayed at neutral Tier A.

refreshSummaryAfterSettlement carried the review's verdict over on purpose ("a conversation is not a review of the code, so it never approves"). It also copied the withheld-approval note back from the old body as it was, and nothing updated the check run. A full re-review already lets a reply dismiss a finding and then approve, so a settlement in the thread now does the same.

The fix

  • runReview returns approvesWhenSettled: true when only open findings held approval back. That means the whole diff was seen, the author may be approved, and reviews.approve is on. The review job writes it into the summary as a hidden approves-when-settled marker, and rebuilds (settlement, merge-only) carry it over.
  • Once a finding settles in its thread, refreshSummaryAfterSettlement:
    • works out the verdict again from the findings still open (decideVerdict), using the base branch config;
    • approves the reviewed head (summary, an APPROVE review and a new Hansi check run with success) when the marker is there and nothing open holds approval back;
    • writes the "open bug finding" note again from what is still open, so a dismissed finding's title is no longer shown;
    • posts a check run for the new tier and conclusion whenever either one changed.
  • It does not approve while a review is running (the status block is present), when the head has moved since the review (checked before the summary write and again before approving), or when the summary has no marker: a partial diff, an outside contributor, or a summary written before this change.
  • CHECK_NAME and checkConclusions moved to shared.ts so the summary code can use them without importing review-job.

Tests

  • chat-job.test.ts replays #1157's case. Dismissing the finding approves the reviewed head, removes the note and the finding, grades S and posts a success check run. Without the marker, only the summary and the check run's tier are refreshed. After a push, nothing is approved.
  • core.test.ts: approvesWhenSettled for a trusted author, an outside contributor, a truncated diff, and a review held back by a minor bug.
  • summary.test.ts: the marker survives a rebuild.

bun run lint, bun run check and bun run test (494 pass) are green.

Not in this PR

  • Appwrite's PATCH /reviews/:reviewId/tier only takes the tier, so after a settlement approval the Console still shows the review's original verdict.
  • #1157's existing summary has no marker, so it needs a re-review (or a new push) to get the approval.

Generated by Claude Code

…ttled

A reply that dismissed or resolved a finding rebuilt the summary, but kept
the review's verdict and its "Not approving while a bug finding is open"
note, and left the check run on the old tier. A pull request whose only
open finding was talked away stayed at "Commented" until the next push.

The review now marks its summary when only open findings kept it from
approving: the whole diff was seen, the author may be approved and
reviews.approve is on. Settling the last such finding in its thread then
approves the reviewed head, drops the note, and posts a check run with the
new tier and conclusion. It never approves while a review is running, over
a newer head, or from a summary without the mark (a partial diff, an outside
contributor, or one written before this change).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3M7tu37atmEwQALkjzmjx
Co-authored-by: Torsten Dittmann <1759475+TorstenDittmann@users.noreply.github.com>
@TorstenDittmann TorstenDittmann self-assigned this Nov 27, 2026
@appwrite

appwrite Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Code review

Commit Status Tier Verdict Details
e631b59 Reviewed Reviewed 🟢 S · Ready to merge ✅ Approved View review

The earlier truncation and in-flight approval concerns are addressed by leaving capped results unchanged and requiring a marker written after GitHub accepts settlement approval.

The pull request records when open findings alone withheld approval and preserves that eligibility as findings are settled. Settlement rebuilds recalculate the summary, grade, verdict, change-request state, and check run, and can approve the reviewed head when eligible. The newest changes add a marker for approvals confirmed by GitHub and make capped finding lists leave the existing standing untouched.

Latest changes: The newest commits add a marker that is written only after GitHub accepts a settlement approval, use it instead of inferring approval from summary text, and stop settlement refreshes when the findings list reaches its cap; tests cover these cases.

Walkthrough (11)
File Change
packages/engine/src/chat-job.test.ts Covers settlement approvals and guards for failed approval posts, capped findings, unmarked summaries, and moved heads.
packages/engine/src/chat-job.ts Refreshes the summary standing when a finding is settled in a conversation.
packages/engine/src/core.test.ts Tests when a completed review can become eligible for approval after findings settle.
packages/engine/src/format.test.ts Tests reading verdict information from the summary's head row.
packages/engine/src/format.ts Adds hidden markers for approval eligibility and approvals confirmed after settlement.
packages/engine/src/review-job.ts Writes the approval-eligibility marker and uses shared check-run constants.
packages/engine/src/review.ts Returns whether open findings alone prevented approval.
packages/engine/src/shared.ts Centralizes the check-run name and verdict conclusions.
packages/engine/src/summary.test.ts Tests preserving settlement eligibility across summary rebuilds.
packages/engine/src/summary.ts Rebuilds standing after settlement, confirms approval state with explicit markers, and fails closed on capped findings.
packages/engine/src/verdict.ts Defines the prefix used to refresh open-defect approval notes.
Fixed since the last review (2)
  • Keep change requests when findings are truncated · packages/engine/src/summary.ts:128
  • Do not infer a posted approval from an in-flight summary · packages/engine/src/summary.ts:139

Reviewed the commits since c5d1d79

Tip

Comment @appwrite review to re-run, or mention @appwrite with a question.

@appwrite appwrite 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.

🔵 Tier A · See the inline comments. Summary

Comment thread packages/engine/src/summary.ts Resolved
Comment thread packages/engine/src/summary.ts Resolved
Comment thread packages/engine/src/summary.ts Resolved
…whole list

- A settlement that already approved shows it in the summary, which a later
  settlement now reads, so it neither approves again nor reverts the
  summary to the stored "Commented" verdict.
- The approval is submitted before the summary is written, and a refused
  one leaves the summary on the settled verdict.
- A findings list cut at its limit may leave open findings out, so it
  never approves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3M7tu37atmEwQALkjzmjx
Co-authored-by: Torsten Dittmann <1759475+TorstenDittmann@users.noreply.github.com>

@appwrite appwrite 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.

🔵 Tier A · See the inline comments. Summary

Comment thread packages/engine/src/summary.ts Resolved
Comment thread packages/engine/src/summary.ts Resolved
…ist alone

- A settlement that GitHub took an approval from writes its own hidden
  mark. Later settlements read that instead of the summary's verdict
  column, which a review job writes before its own GitHub review is posted.
- A findings list at its limit may leave open blockers out, so the
  settlement no longer rebuilds the grade, the summary or the change
  request from it, not only the approval.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3M7tu37atmEwQALkjzmjx
Co-authored-by: Torsten Dittmann <1759475+TorstenDittmann@users.noreply.github.com>

@appwrite appwrite 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.

🟢 Tier S · Looks good to merge. Summary

@TorstenDittmann
TorstenDittmann merged commit 936f9a8 into main Nov 27, 2026
5 checks passed
@TorstenDittmann
TorstenDittmann deleted the claude/project-thread-9xknwx branch November 27, 2026 13:19
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.

2 participants