Skip to content

Commit 7653d72

Browse files
Gavin Williamsclaude
andcommitted
refactor(web): remove Record<string,string> cast in gitlabPushMrReviews
Now that oldPath/newPath are always plain strings, declare position directly as DiscussionNotePosition and use a single conditional spread for the optional oldLine field. Removes the redundant `as unknown as DiscussionNotePosition` cast. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a57f68f commit 7653d72

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

packages/web/src/features/agents/review-agent/nodes/gitlabPushMrReviews.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,24 +83,22 @@ export const gitlabPushMrReviews = async (
8383
const newPath = fileDiffReview.filename !== '/dev/null' ? fileDiffReview.filename : resolvedOldPath;
8484
for (const review of fileDiffReview.reviews) {
8585
const oldLine = fileContextMap?.get(review.line_end);
86-
const position: Record<string, string> = {
86+
const position: DiscussionNotePosition = {
8787
positionType: 'text',
8888
baseSha: base_sha,
8989
headSha: head_sha,
9090
startSha: start_sha,
9191
oldPath,
9292
newPath,
9393
newLine: String(review.line_end),
94+
...(oldLine !== undefined ? { oldLine: String(oldLine) } : {}),
9495
};
95-
if (oldLine !== undefined) {
96-
position['oldLine'] = String(oldLine);
97-
}
9896
try {
9997
await gitlabClient.MergeRequestDiscussions.create(
10098
projectId,
10199
prPayload.number,
102100
review.review,
103-
{ position: position as unknown as DiscussionNotePosition },
101+
{ position },
104102
);
105103
} catch (error) {
106104
// Inline comment failed (e.g. line not in diff) — fall back to a general MR note

0 commit comments

Comments
 (0)