Draft Notes on Added Lines Don't Render When `base_sha != start_sha`
## Problem
When the target branch (`main`) moves forward after an MR is created, `base_sha` (merge base) diverges from `start_sha` (current main HEAD). In this state:
- **Published notes** (Discussions API) on added lines (`new_line` only) **render correctly** ✅
- **Draft notes** (Draft Notes API) on added lines (`new_line` only) **do not render** on the diff ❌
This issue doesn't happen when the main has not moved forward (`base_sha == start_sha`)
## How to reproduce
This MR sets up the test case https://gitlab.com/viktomas/test-project/-/merge_requests/37
Setup:
1. Branch `tv/diff-line-test` adds `sum()` and `average()` at end of `src/utils.ts`
2. Main gets 6 new header lines, shifting all line numbers by +6
3. `diff_refs`: `base_sha=eaa82a4` ≠ `start_sha=a377257`
Test results on https://gitlab.com/viktomas/test-project/-/merge_requests/37/diffs
### Reproducer: curl Commands
Get `diff_refs` from the MR first:
```bash
curl -s -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"https://gitlab.com/api/v4/projects/viktomas%2Ftest-project/merge_requests/37" \
| jq '.diff_refs'
# {
# "base_sha": "eaa82a43a06204f6f9b6092950ceba92720773f0",
# "start_sha": "a377257a71a83665cd2e5ae5a7e42b97526b6548",
# "head_sha": "dc5ec65e783268ba590bc08245e1bd6ae3b989a6"
# }
```
**✅ Published note — renders inline on the diff:**
```bash
curl -s -X POST \
-H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"body": "This renders correctly on the added line",
"position": {
"position_type": "text",
"base_sha": "eaa82a43a06204f6f9b6092950ceba92720773f0",
"head_sha": "dc5ec65e783268ba590bc08245e1bd6ae3b989a6",
"start_sha": "a377257a71a83665cd2e5ae5a7e42b97526b6548",
"new_path": "src/utils.ts",
"old_path": "src/utils.ts",
"new_line": 48
}
}' \
"https://gitlab.com/api/v4/projects/viktomas%2Ftest-project/merge_requests/37/discussions"
```
This shows on the diff
{width=866 height=337}
**❌ Draft note — does NOT render inline (same position):**
```bash
curl -s -X POST \
-H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"note": "This is invisible on the diff despite valid line_code",
"position": {
"position_type": "text",
"base_sha": "eaa82a43a06204f6f9b6092950ceba92720773f0",
"head_sha": "dc5ec65e783268ba590bc08245e1bd6ae3b989a6",
"start_sha": "a377257a71a83665cd2e5ae5a7e42b97526b6548",
"new_path": "src/utils.ts",
"old_path": "src/utils.ts",
"new_line": 48
}
}' \
"https://gitlab.com/api/v4/projects/viktomas%2Ftest-project/merge_requests/37/draft_notes"
```
shows in the list of draft notes, but not on the diff
{width=840 height=600}
The only difference is the endpoint (`discussions` vs `draft_notes`) and field name (`body` vs `note`). The position is identical. The prerequisite is `base_sha != start_sha` (target branch moved after MR creation).
issue