-
Notifications
You must be signed in to change notification settings - Fork 614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api): POST /comments GET /comments GET /comments/${commentId} #3383
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
2cebbe7
to
2f4b75d
Compare
2f4b75d
to
8d00d15
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Reviewed everything up to d518601 in 1 minute and 24 seconds
More details
- Looked at
1104
lines of code in11
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. web/src/pages/api/public/comments/[commentId].ts:18
- Draft comment:
prisma.comment.findUnique
should beprisma.comment.findFirst
to support multiple fields in thewhere
clause. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The use offindUnique
is appropriate ifid
andprojectId
together form a unique constraint. The comment assumes that multiple fields in thewhere
clause necessitatefindFirst
, which is not necessarily true. Without evidence thatid
andprojectId
do not form a unique constraint, the comment seems speculative.
I might be missing specific knowledge about the database schema, particularly whetherid
andprojectId
form a unique constraint. If they do not, the comment could be valid.
The comment lacks strong evidence and seems speculative without schema details. The default assumption should be that the code is correct unless proven otherwise.
Delete the comment as it is speculative and lacks strong evidence. The use offindUnique
is likely correct ifid
andprojectId
form a unique constraint.
Workflow ID: wflow_GVpWvuIHYGj6u4O8
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disclaimer: Experimental PR review
PR Summary
This pull request introduces a new API for managing comments in the Langfuse project, including endpoints for creating, retrieving, and validating comments.
- Added new API endpoints: POST /comments, GET /comments, and GET /comments/{commentId} in multiple files
- Implemented server-side tests in
web/src/__tests__/comments.servertest.ts
to ensure functionality of the new endpoints - Created
validateCommentReferenceObject.ts
to validate comment reference objects before creation - Updated
web/src/server/api/routers/comments.ts
with new query methods for fetching comments and comment counts - Added Zod schemas for comment-related API endpoints in
web/src/features/public-api/types/comments.ts
11 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on a9390b9 in 39 seconds
More details
- Looked at
108
lines of code in5
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. web/src/__tests__/comments.servertest.ts:39
- Draft comment:
The error message format in the test does not match the actual error message format. Update the expected error message to match the actual format returned by the API. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_ql0a4euFb5QGR6Pa
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 6f93ab9 in 20 seconds
More details
- Looked at
28
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. web/src/features/public-api/types/comments.ts:30
- Draft comment:
EnsureCreateCommentData
includesauthorUserId
if it's required for comment creation. This will maintain consistency across the codebase. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_y5jmqv65Qon9feBk
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on a5168fa in 20 seconds
More details
- Looked at
13
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. web/src/features/public-api/types/comments.ts:32
- Draft comment:
The use of.strict()
is redundant when using.extend()
in Zod. Consider removing.strict()
on line 32. - Reason this comment was not posted:
Confidence changes required:50%
The use of.strict()
is redundant when using.strictObject()
in Zod.
Workflow ID: wflow_GPAwNErObz45CyIV
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This pull request enhances the comment functionality in the Langfuse API by adding new endpoints and improving existing ones, with a focus on user attribution and flexible querying.
- Added optional
authorUserId
field toCreateCommentRequest
infern/apis/server/definition/comments.yml
- Updated
CreateCommentData
schema inpackages/shared/src/features/comments/types.ts
to include nullableauthorUserId
- Implemented new tests in
web/src/__tests__/comments.servertest.ts
for comment creation and retrieval with author information - Updated OpenAPI specification and Postman collection to reflect new comment endpoints and schemas
5 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This pull request continues to refine the comment functionality in the Langfuse API, focusing on user attribution and API endpoint implementation.
- Modified
CreateCommentData
schema inpackages/shared/src/features/comments/types.ts
to removeauthorUserId
field - Updated
PostCommentsV1Body
schema inweb/src/features/public-api/types/comments.ts
to include optionalauthorUserId
- Implemented validation for
GetCommentsV1Query
schema inweb/src/features/public-api/types/comments.ts
- Added
APIComment
object schema withauthorUserId
as nullable field
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 1d93369 in 26 seconds
More details
- Looked at
94
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. web/src/__tests__/comments.servertest.ts:231
- Draft comment:
Avoid hardcoding error messages in tests as they may change. Consider using regex or partial matching to verify error content. - Reason this comment was not posted:
Confidence changes required:50%
The test for invalid objectType correctly expects a 400 error, but the error message in the test is hardcoded and may not match future changes in error messages.
Workflow ID: wflow_8D9S9MIOk8CQ7CPm
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This pull request continues to refine the comment functionality in the Langfuse API, focusing on API endpoint implementation and testing.
- Added comprehensive test cases in
web/src/__tests__/comments.servertest.ts
for creating and retrieving comments - Implemented new API endpoints in
fern/apis/server/definition/comments.yml
for POST /comments, GET /comments, and GET /comments/{commentId} - Updated OpenAPI specification in
web/public/generated/api/openapi.yml
to include new comment endpoints and schemas - Added validation check in
CreateCommentRequest
to ensure referenced objects exist before creating a comment
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Incremental review on 9ab2a64 in 30 seconds
More details
- Looked at
22
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_176MGCe4utsr4Bff
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This pull request continues to enhance the comment functionality in the Langfuse API, focusing on implementation details and testing.
- Implemented POST and GET routes for comments in
web/src/pages/api/public/comments/index.ts
- Added pagination support for the GET /comments endpoint
- Included validation for comment reference objects using
validateCommentReferenceObject
function - Implemented error handling for cases like invalid object references or missing required parameters
1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This pull request continues to enhance the comment functionality in the Langfuse API, focusing on implementation details, testing, and database changes.
- Added
Comment
model andCommentObjectType
enum inpackages/shared/prisma/schema.prisma
- Implemented comprehensive tests for comment creation and retrieval in
web/src/__tests__/comments.servertest.ts
- Updated OpenAPI specification in
web/public/generated/api/openapi.yml
to include new comment endpoints - Modified ClickHouse migrations to add
event_ts
column and adjust table ordering for traces, observations, and scores
20 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This pull request introduces new API endpoints for managing comments in the Langfuse project, focusing on creation and retrieval functionality.
- Implemented POST /comments, GET /comments, and GET /comments/{commentId} endpoints in
web/src/pages/api/public/comments/index.ts
- Added pagination support for GET /comments with optional filters for objectType, objectId, and authorUserId
- Included validation for comment reference objects using
validateCommentReferenceObject
function - Updated Prisma schema in
packages/shared/prisma/schema.prisma
to include Comment model and CommentObjectType enum - Expanded test coverage in
web/src/__tests__/comments.servertest.ts
for new comment endpoints and edge cases
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
Important
Add API endpoints for creating and retrieving comments with validation and tests.
POST /comments
to create comments withCreateCommentRequest
andCreateCommentResponse
.GET /comments
to retrieve all comments with optional filters forobjectType
,objectId
,authorUserId
,page
, andlimit
.GET /comments/{commentId}
to retrieve a specific comment by ID.validateCommentReferenceObject
invalidateCommentReferenceObject.ts
to ensure comments reference valid objects.Comment
andCommentObjectType
incommons.yml
.comments.servertest.ts
to verify comment creation, retrieval, and validation logic.openapi.yml
andpostman/collection.json
to include new comment endpoints.This description was created by for 9ab2a64. It will automatically update as commits are pushed.