Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(gitlab): submit review comments on context lines #6348

Mergedtarik02(GitHub profile, opens in a new tab)merged 9 commits intomain fromrefs/pull/6348/headmerged by juliusmarminge View on GitHub

What Changed

Review comments now retain host-facing diff coordinates for added, deleted, and unchanged context lines.

GitLab submissions include both old_line and new_line for context lines. GitHub and Bitbucket continue receiving their provider-specific line and side coordinates.

Why

T3 Code previously stored only one line number and side. GitLab requires both old and new line numbers when commenting on an unchanged context line, so submitting those reviews failed.

UI Changes

Before:

https://github.com/user-attachments/assets/d244ab31-e581-481f-ab6a-a13d45b59da9

After:

https://github.com/user-attachments/assets/8490f7cf-3b8b-454b-ad5f-15f661fa0cc1

Testing

  • Typechecks passed for contracts, server, and web
  • Focused lint passed
  • 262 relevant existing tests passed
  • The full review flow was verified against a GitLab fixture before and after the fix

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after evidence for the behavior change
  • I included videos for the interaction change

Built with GPT-5.6 Sol via the Codex harness in T3 Code.


Note

Medium Risk Breaking contract change: clients still sending line/side on review drafts will fail validation; diff line-index logic is more complex and affects where comments anchor across hosts.

Overview Fixes GitLab review submission on unchanged (context) diff lines by replacing the single line + side on PullRequestReviewCommentDraft with a PullRequestReviewPosition union (added, deleted, context with optional split-diff side).

Each host adapter maps that shape to its API: GitLab sends old_line / new_line (both for context), GitHub and Bitbucket keep their existing line/side or from/to inline fields via small helper functions.

The web diff UI resolves a line selection through resolveDiffReviewPosition (including expanded context between hunks), stores position on pending/draft comments, and ReviewCommentContext can carry an optional selection for restoring ranges.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0f554d6749e66e0266b4104aeb084137470cd6a6. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix review comment positioning on context lines for GitHub, GitLab, and Bitbucket

  • Replaces the flat line/side fields on PullRequestReviewCommentDraft with a structured PullRequestReviewPosition union (added, deleted, or context) in pullRequest.ts.
  • Adds per-provider helpers (gitHubReviewPosition, gitLabReviewPositionLines, bitbucketReviewPosition) that translate the new position type into each API's expected wire format, correctly populating both sides for unchanged context lines.
  • Introduces resolveDiffReviewPosition in reviewCommentContext.ts to derive a typed position from a viewer line selection, with support for expanded context lines between hunks.
  • Updates the web UI in PullRequestCodeTab.tsx to store and display comments using the resolved position rather than raw line/side values.
  • Risk: PullRequestReviewCommentDraft no longer accepts line/side; any client sending the old shape will fail schema validation.
Macroscope summarized 0f554d6.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: ff4afb83-1e53-4bc5-be47-9a503a5e4d98

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. 💡 Codex Review

      Here are some automated review suggestions for this pull request.

      Reviewed commit: 23d6f869d5

      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review".

      If Codex has suggestions, it will comment; otherwise it will react with 👍.

      Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR modifies review comment submission behavior across multiple git providers with a new position schema. An unresolved comment identifies potential silent failures when commenting on expanded context lines, and the scope of changes (new types, three API integrations, frontend position resolution) warrants human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Codex Review: Didn't find any major issues. Can't wait for the next one!

      Reviewed commit: df3aa24676

      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review".

      If Codex has suggestions, it will comment; otherwise it will react with 👍.

      Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    6. Codex Review: Didn't find any major issues. Can't wait for the next one!

      Reviewed commit: df3aa24676

      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review".

      If Codex has suggestions, it will comment; otherwise it will react with 👍.

      Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    7. Codex Review: Didn't find any major issues. Can't wait for the next one!

      Reviewed commit: 578f803b43

      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review".

      If Codex has suggestions, it will comment; otherwise it will react with 👍.

      Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    8. 💡 Codex Review

      Here are some automated review suggestions for this pull request.

      Reviewed commit: a36043ac99

      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review".

      If Codex has suggestions, it will comment; otherwise it will react with 👍.

      Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    9. 💡 Codex Review

      Here are some automated review suggestions for this pull request.

      Reviewed commit: 38e1a892a8

      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review".

      If Codex has suggestions, it will comment; otherwise it will react with 👍.

      Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    10. Codex Review: Didn't find any major issues. Nice work!

      Reviewed commit: eef128ec24

      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review".

      If Codex has suggestions, it will comment; otherwise it will react with 👍.

      Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    11. @codex address that feedback

    12. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 7d846acdfdc2f4f74edd59b3f628f2318418f7e4. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -370,0 +522,21 @@
      522+ const line = buildDiffReviewLines(fileDiff, !fileDiff.isPartial, {
      523+ startIndex: lineIndex,
      524+ endIndex: lineIndex,
      525+ })[0];
      526+ if (line === undefined) return null;
      527+
      528+ switch (line.change) {
      529+ case "add":
      530+ return line.newLineNumber === null ? null : { kind: "added", newLine: line.newLineNumber };
      531+ case "delete":
      532+ return line.oldLineNumber === null ? null : { kind: "deleted", oldLine: line.oldLineNumber };
      533+ case "context":
      534+ return line.oldLineNumber === null || line.newLineNumber === null
      535+ ? null
      536+ : {
      537+ kind: "context",
      538+ oldLine: line.oldLineNumber,
      539+ newLine: line.newLineNumber,
      540+ side: side === "deletions" ? "left" : "right",
      541+ };
      542+ }

      Expanded context comments fail silently

      Medium Severity

      resolveDiffReviewPosition only maps expanded inter-hunk lines when !fileDiff.isPartial, but typical PR patches are partial. beginComment then bails on null, so selecting an expanded unchanged line does nothing. Inter-hunk coordinates are available from hunk headers alone, so this gating blocks the expanded-context path this change aimed to support, and regresses hosts that previously accepted a single line and side.

      Additional Locations (2)
      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 7d846acdfdc2f4f74edd59b3f628f2318418f7e4. Configure [here](https://www.cursor.com/dashboard/bugbot).

      This is handled by Pierre’s controlled hydration path. VirtualizedFileDiff hydrates a clone, then CodeView.recomputeLayout() copies it back into the original item with Object.assign(item.item.fileDiff, fileDiff). That sets isPartial to false before expanded rows can be selected. beginComment finds that same mutated fileDiff object, so resolveDiffReviewPosition includes the expanded context.

    13. juliusmarminge merged thisd94fbda

    14. juliusmarminge closed this

Sign in to join this conversation.