Skip to content

Create action that reads comments from docs#482

Open
liv-s wants to merge 2 commits into
mainfrom
doc-comments
Open

Create action that reads comments from docs#482
liv-s wants to merge 2 commits into
mainfrom
doc-comments

Conversation

@liv-s

@liv-s liv-s commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@greptile-apps

greptile-apps Bot commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR adds a new action readCommentsOnDoc to fetch comments and replies from Google Docs using the Google Drive API. The implementation includes proper schema definitions, type generation, and test coverage.

Key Changes:

  • New read-only action with appropriate OAuth scopes (drive.readonly)
  • Supports pagination via pageSize and nextPageToken
  • Returns comment metadata including author info, timestamps, and quoted content
  • Properly integrated into the action mapper registry

Critical Issue:

  • The implementation maps API response fields incorrectly - uses c.commentId and r.replyId instead of c.id and r.id, causing all IDs to be undefined in the output

Confidence Score: 1/5

  • This PR has a critical bug that will cause the feature to malfunction in production
  • The incorrect field mapping (c.commentId instead of c.id) means all comment and reply IDs will be undefined, breaking any functionality that depends on these IDs
  • readCommentsOnDoc.ts requires immediate fixes to the field mapping logic

Important Files Changed

Filename Overview
src/actions/providers/google-oauth/readCommentsOnDoc.ts New action to read Google Doc comments - critical bug: uses wrong field names (commentId/replyId instead of id) causing all IDs to be undefined

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +40 to +41
res.data.comments?.map((c: any) => ({
commentId: c.commentId,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Google Drive API returns id not commentId. This will cause all comment IDs to be undefined.

Suggested change
res.data.comments?.map((c: any) => ({
commentId: c.commentId,
res.data.comments?.map((c: any) => ({
commentId: c.id,
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/actions/providers/google-oauth/readCommentsOnDoc.ts
Line: 40:41

Comment:
Google Drive API returns `id` not `commentId`. This will cause all comment IDs to be undefined.

```suggestion
      res.data.comments?.map((c: any) => ({
        commentId: c.id,
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? is this true?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're correct. The Google Drive API returns id not commentId. Both line 40 and line 55 need to be fixed:

Suggested change
res.data.comments?.map((c: any) => ({
commentId: c.commentId,
commentId: c.id,
content: c.content,
createdTime: c.createdTime,
modifiedTime: c.modifiedTime,
resolved: c.resolved,
author: c.author
? {
displayName: c.author.displayName,
emailAddress: c.author.emailAddress,
me: c.author.me,
}
: undefined,
quotedFileContent: c.quotedFileContent,
replies:
c.replies?.map((r: any) => ({
replyId: r.id,

The API response uses id for both comments and replies, but your schema correctly expects commentId and replyId in the output.

quotedFileContent: c.quotedFileContent,
replies:
c.replies?.map((r: any) => ({
replyId: r.replyId,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Google Drive API returns id not replyId for replies.

Suggested change
replyId: r.replyId,
replyId: r.id,
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/actions/providers/google-oauth/readCommentsOnDoc.ts
Line: 56:56

Comment:
Google Drive API returns `id` not `replyId` for replies.

```suggestion
            replyId: r.id,
```

How can I resolve this? If you propose a fix, please make it concise.

nextPageToken: res.data.nextPageToken,
};
} catch (error) {
console.error("Error reading comments on Google Doc", error);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error object may contain sensitive information and should be handled carefully. Consider logging only non-sensitive error details.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/actions/providers/google-oauth/readCommentsOnDoc.ts
Line: 76:76

Comment:
Error object may contain sensitive information and should be handled carefully. Consider logging only non-sensitive error details.

How can I resolve this? If you propose a fix, please make it concise.

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