fix(server): retain GitLab approval system notes - #9858
juliusmarminge wants to merge 2 commits into
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — The PR makes a focused production fix to GitLab approval-history pagination and reaction affordances, with targeted tests and limited runtime scope. It also adds line-level suppressions for a static-analysis diagnostic in the new test, so human review is required. No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
8b40be3 to
c1c5990
Compare
GitLab approval and withdrawal notes are discarded with all system activity, so the existing review view receives no record of either event. This is a bounded candidate for #9802, not a complete system timeline.
Keep only the exact approval and unapproval bodies generated by GitLab's note service, and only when
systemis true. Map them to the existingreviewkind withAPPROVEDorDISMISSED, preserving the note ID, author, body, and timestamp. Other system notes remain hidden. An ordinary comment containing the same words remains a comment.No new API requests, schema fields, or dependencies. The existing review kind avoids offering an edit button for GitLab-generated notes. GitLab also rejects emoji awards on system notes, so the web and desktop Summary and Timeline hide reaction controls for GitLab review rows. Ordinary GitLab comments and description reactions keep their existing behavior. GitLab's adapter emits
reviewonly for these system-derived notes. Raw note counts remain unchanged so a full page of skipped activity does not stop pagination early.Verification on main 82f64cd8:
vp test run apps/server/src/pullRequest/gitLabMergeRequestJson.test.ts apps/server/src/pullRequest/GitLabPullRequestCli.test.ts apps/server/src/pullRequest/GitLabPullRequestProvider.test.ts apps/web/src/components/pullRequest/pullRequestReactions.logic.test.ts apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts apps/web/src/components/pullRequest/pullRequestEditing.logic.test.ts --maxWorkers=2: 228 tests pass. Reaction permission cases cover GitLab system-derived reviews, ordinary notes, inline comments, other-provider reviews, and disabled or absent host capability. The GitLab review case fails when the helper uses the previous capability-only predicate.Human decision required; leave unmerged. Reusing the review kind feeds the existing comment/timeline presentation and current-review badges from #7077. Those badges use a commit-date heuristic, not GitLab's authoritative current approval state. Automatic approval resets, other system-note variants, and localized/custom bodies are not implemented here. A maintainer must decide whether this historical-note mapping is acceptable or whether approvals need a distinct presentation/current-state read.
The local evidence is decoder/CLI output, not a live GitLab account or integrated client capture. An anonymous GitLab notes request returned 401; no credentials or production state were changed. Integrated visual evidence remains pending. Do not close the broader issue from this candidate alone.
Refreshed September 5 onto main ce4712d, which fixes the Ubuntu CI mirror transport upstream. The seven changed source/test files are byte-identical to the previously reviewed candidate. All 228 focused tests, server/web typechecks and targeted lint/format pass again, with the same existing skeleton warning. Current-head CI, Bugbot, UI and Effect checks pass at c1c5990. Correctness and approvability checks skipped the unchanged rebase; the prior human-review requirement remains. There are no review threads or active change requests. The previous CI run 33936579569 exhausted its one retry on the old HTTP mirror failure; it is not counted as passing. This PR adds no workflow changes or bypasses. Human approval and integrated visual evidence remain required, so it is not merge-ready.
Prepared by GPT 6 Astra via Codex in T3 Code.
Note
Low Risk
Scoped to GitLab note decoding and UI reaction gating, with regression tests; review badges still use commit-date heuristics rather than GitLab’s live approval state.
Overview
GitLab merge request conversations previously dropped all system notes, so approvals and unapprovals never reached the review UI.
decodeNotesJsonnow keeps only exactsystem: truebodies (approved this merge request/unapproved this merge request), maps them toreviewcomments withAPPROVED/DISMISSED, and still filters other system activity. User-authored text that looks like an approval stays a normal comment;rawCountis unchanged so note pagination does not stop on a page of skipped system notes.The web layer adds
canReactPullRequestComment, which turns off emoji reactions on GitLabreviewrows (system notes cannot be awarded on GitLab). Summary and Timeline use that helper instead of the global reactions capability alone.Reviewed by Cursor Bugbot for commit c1c5990. Bugbot is set up for automated code reviews on this repo. Configure here.