From 160a2370177f4b254e372d4da40f4f25a02a1b73 Mon Sep 17 00:00:00 2001 From: Lince Mathew Date: Mon, 18 May 2026 20:29:42 +0530 Subject: [PATCH 1/4] refactor: remove legacy daily review count limit enforcement logic LiveReview Pre-Commit Check: ran (iter:1, coverage:0%) --- docs/openapi.yaml | 168 ++++++++++---------- go.mod | 14 ++ go.sum | 32 ++++ internal/api/auth/middleware.go | 7 +- internal/api/middleware/plan_enforcement.go | 61 +------ internal/api/review_service.go | 81 ---------- 6 files changed, 136 insertions(+), 227 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index fb492db7..5f885d56 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -2009,7 +2009,6 @@ components: - org_name type: object auth.TokenPair: - nullable: true properties: access_token: type: string @@ -2039,7 +2038,6 @@ components: - RefreshTokenDuration type: object auth.UserInfo: - nullable: true properties: created_at: format: date-time @@ -2193,7 +2191,6 @@ components: - IsBot type: object core_processor.UnifiedCommentV2: - nullable: true properties: Author: $ref: '#/components/schemas/core_processor.UnifiedUserV2' @@ -2356,7 +2353,6 @@ components: - UpdatedAt type: object core_processor.UnifiedPositionV2: - nullable: true properties: EndLine: nullable: true @@ -2431,7 +2427,6 @@ components: - Category type: object core_processor.UnifiedReviewerChangeV2: - nullable: true properties: Action: type: string @@ -2672,7 +2667,6 @@ components: - updated_at type: object learnings.SourceContext: - nullable: true properties: comment_id: type: string @@ -2891,7 +2885,6 @@ components: - role_name type: object models.ReviewComment: - nullable: true properties: Category: type: string @@ -2944,7 +2937,6 @@ components: - Summary type: object models.Role: - nullable: true properties: created_at: format: date-time @@ -2964,7 +2956,6 @@ components: - updated_at type: object models.User: - nullable: true properties: created_at: format: date-time @@ -3431,6 +3422,23 @@ components: - created_at - performed_by_email type: object + users.UserCheckResponse: + properties: + exists: + type: boolean + first_name: + type: string + id: + format: int64 + type: integer + last_name: + type: string + required: + - exists + - id,omitempty + - first_name,omitempty + - last_name,omitempty + type: object users.UserOrgRole: properties: org_id: @@ -3964,13 +3972,13 @@ paths: - Aiconnectors /api/v1/auth/change-password: post: - description: ChangePassword handles password changes (useful for temp passwords) + description: ChangePassword handles changing the current user's password operationId: ChangePassword requestBody: content: application/json: schema: - $ref: '#/components/schemas/auth.ChangePasswordRequest' + $ref: '#/components/schemas/users.ChangePasswordRequest' responses: "200": content: @@ -3980,30 +3988,6 @@ paths: type: string type: object description: OK - "400": - content: - application/json: - schema: - additionalProperties: - type: string - type: object - description: Bad Request - "401": - content: - application/json: - schema: - additionalProperties: - type: string - type: object - description: Unauthorized - "500": - content: - application/json: - schema: - additionalProperties: - type: string - type: object - description: Internal Server Error tags: - Auth /api/v1/auth/ensure-cloud-user: @@ -5643,22 +5627,26 @@ paths: - Orgs /api/v1/orgs/{org_id}/members/{user_id}/role: put: - description: ChangeUserRole changes a user's role in an organization + description: ChangeUserRole handles changing a user's role in an organization operationId: ChangeUserRole parameters: - in: path name: org_id required: true schema: - format: int64 - type: integer + type: string - in: path name: user_id required: true schema: - format: int64 - type: integer - responses: null + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/users.UserWithRole' + description: OK tags: - Orgs /api/v1/orgs/{org_id}/users: @@ -5714,12 +5702,12 @@ paths: operationId: DeactivateUser parameters: - in: path - name: user_id + name: org_id required: true schema: type: string - in: path - name: org_id + name: user_id required: true schema: type: string @@ -5833,22 +5821,66 @@ paths: - Orgs /api/v1/orgs/{org_id}/users/{user_id}/role: put: - description: ChangeUserRole changes a user's role in an organization + description: ChangeUserRole handles changing a user's role in an organization operationId: ChangeUserRole parameters: + - in: path + name: user_id + required: true + schema: + type: string - in: path name: org_id required: true schema: - format: int64 - type: integer + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/users.UserWithRole' + description: OK + tags: + - Orgs + /api/v1/orgs/{org_id}/users/check: + get: + description: CheckUser handles checking if a user exists by email + operationId: CheckUser + parameters: - in: path - name: user_id + name: org_id required: true schema: - format: int64 - type: integer - responses: null + type: string + - in: query + name: email + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/users.UserCheckResponse' + description: OK + "400": + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: Bad Request + "500": + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: Internal Server Error tags: - Orgs /api/v1/password: @@ -6128,12 +6160,12 @@ paths: operationId: CreatePromptChunk parameters: - in: path - name: key + name: var required: true schema: type: string - in: path - name: var + name: key required: true schema: type: string @@ -6182,12 +6214,12 @@ paths: operationId: ReorderPromptChunks parameters: - in: path - name: var + name: key required: true schema: type: string - in: path - name: key + name: var required: true schema: type: string @@ -6941,13 +6973,13 @@ paths: - Ui-Config /api/v1/users/password: put: - description: ChangePassword handles password changes (useful for temp passwords) + description: ChangePassword handles changing the current user's password operationId: ChangePassword requestBody: content: application/json: schema: - $ref: '#/components/schemas/auth.ChangePasswordRequest' + $ref: '#/components/schemas/users.ChangePasswordRequest' responses: "200": content: @@ -6957,30 +6989,6 @@ paths: type: string type: object description: OK - "400": - content: - application/json: - schema: - additionalProperties: - type: string - type: object - description: Bad Request - "401": - content: - application/json: - schema: - additionalProperties: - type: string - type: object - description: Unauthorized - "500": - content: - application/json: - schema: - additionalProperties: - type: string - type: object - description: Internal Server Error tags: - Users /api/v1/users/profile: diff --git a/go.mod b/go.mod index 003f42b3..3efae657 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,8 @@ require ( require ( github.com/HexmosTech/deidentify v1.0.0 + github.com/d1vbyz3r0/typed v0.2.3 + github.com/getkin/kin-openapi v0.138.0 github.com/golang-jwt/jwt/v5 v5.3.0 github.com/google/go-cmp v0.7.0 github.com/google/uuid v1.6.0 @@ -73,6 +75,8 @@ require ( github.com/gitleaks/go-gitdiff v0.9.1 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/google/generative-ai-go v0.20.1 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/s2a-go v0.1.9 // indirect @@ -86,12 +90,14 @@ require ( github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/josharian/intern v1.0.0 // indirect github.com/klauspost/compress v1.18.0 // indirect github.com/klauspost/pgzip v1.2.6 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect github.com/labstack/gommon v0.4.2 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/magiconair/properties v1.8.10 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect @@ -101,10 +107,14 @@ require ( github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/muesli/termenv v0.16.0 // indirect github.com/nwaples/rardecode/v2 v2.2.0 // indirect + github.com/oasdiff/yaml v0.0.9 // indirect + github.com/oasdiff/yaml3 v0.0.12 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/pierrec/lz4/v4 v4.1.22 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pkoukk/tiktoken-go v0.1.6 // indirect @@ -116,6 +126,7 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.7.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect github.com/shopspring/decimal v1.4.0 // indirect github.com/sorairolake/lzip-go v0.3.8 // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -134,6 +145,7 @@ require ( github.com/valyala/fasttemplate v1.2.2 // indirect github.com/wasilibs/go-re2 v1.9.0 // indirect github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 // indirect + github.com/woodsbury/decimal128 v1.3.0 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect @@ -146,11 +158,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect + golang.org/x/mod v0.34.0 // indirect golang.org/x/net v0.53.0 // indirect golang.org/x/oauth2 v0.34.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.43.0 // indirect golang.org/x/text v0.36.0 // indirect + golang.org/x/tools v0.43.0 // indirect google.golang.org/api v0.218.0 // indirect google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect diff --git a/go.sum b/go.sum index f72b7ed6..ff2e0ffc 100644 --- a/go.sum +++ b/go.sum @@ -83,6 +83,8 @@ github.com/cohere-ai/tokenizer v1.1.2/go.mod h1:9MNFPd9j1fuiEK3ua2HSCUxxcrfGMlSq github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/d1vbyz3r0/typed v0.2.3 h1:qvz08JwVvZazA5KgoxFXJ5USQnHDjGTzK5pR76pnu64= +github.com/d1vbyz3r0/typed v0.2.3/go.mod h1:QIJsQnr29WFJ1oe6jb91Y3Bo5gtAcF4vaYeJjWIUJ68= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -107,6 +109,8 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/getkin/kin-openapi v0.138.0 h1:ebfE0JAmF6AqHrNBy1KO3Fs68K9tPs48HalvLPo7Rv4= +github.com/getkin/kin-openapi v0.138.0/go.mod h1:vUYWaKyMqj7PfTybelXtLuLN9tReS12vxnzMRK+z2GY= github.com/gitleaks/go-gitdiff v0.9.1 h1:ni6z6/3i9ODT685OLCTf+s/ERlWUNWQF4x1pvoNICw0= github.com/gitleaks/go-gitdiff v0.9.1/go.mod h1:pKz0X4YzCKZs30BL+weqBIG7mx0jl4tF1uXV9ZyNvrA= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -116,6 +120,12 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= +github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= @@ -185,6 +195,8 @@ github.com/jackc/pgx/v5 v5.9.2 h1:3ZhOzMWnR4yJ+RW1XImIPsD1aNSz4T4fyP7zlQb56hw= github.com/jackc/pgx/v5 v5.9.2/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kaptinlin/jsonrepair v0.2.3 h1:gYhCB2mBRNzBiox4rq80fCYhh5nlfM7G8QQqz35jzMk= @@ -225,6 +237,8 @@ github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69 github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= @@ -248,14 +262,22 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= github.com/nwaples/rardecode/v2 v2.2.0 h1:4ufPGHiNe1rYJxYfehALLjup4Ls3ck42CWwjKiOqu0A= github.com/nwaples/rardecode/v2 v2.2.0/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsRNb6IbvGVHRmw= +github.com/oasdiff/yaml v0.0.9 h1:zQOvd2UKoozsSsAknnWoDJlSK4lC0mpmjfDsfqNwX48= +github.com/oasdiff/yaml v0.0.9/go.mod h1:8lvhgJG4xiKPj3HN5lDow4jZHPlx1i7dIwzkdAo6oAM= +github.com/oasdiff/yaml3 v0.0.12 h1:75urAtPeDg2/iDEWwzNrLOWxI9N/dCh81nTTJtokt2M= +github.com/oasdiff/yaml3 v0.0.12/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= +github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU= github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -296,6 +318,8 @@ github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsF github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/sorairolake/lzip-go v0.3.8 h1:j5Q2313INdTA80ureWYRhX+1K78mUXfMoPZCw/ivWik= @@ -340,6 +364,8 @@ github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/tmc/langchaingo v0.1.14 h1:o1qWBPigAIuFvrG6cjTFo0cZPFEZ47ZqpOYMjM15yZc= github.com/tmc/langchaingo v0.1.14/go.mod h1:aKKYXYoqhIDEv7WKdpnnCLRaqXic69cX9MnDUk72378= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY= github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -353,6 +379,8 @@ github.com/wasilibs/go-re2 v1.9.0 h1:kjAd8qbNvV4Ve2Uf+zrpTCrDHtqH4dlsRXktywo73JQ github.com/wasilibs/go-re2 v1.9.0/go.mod h1:0sRtscWgpUdNA137bmr1IUgrRX0Su4dcn9AEe61y+yI= github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 h1:OvLBa8SqJnZ6P+mjlzc2K7PM22rRUPE1x32G9DTPrC4= github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52/go.mod h1:jMeV4Vpbi8osrE/pKUxRZkVaA0EX7NZN0A9/oRzgpgY= +github.com/woodsbury/decimal128 v1.3.0 h1:8pffMNWIlC0O5vbyHWFZAt5yWvWcrHA+3ovIIjVWss0= +github.com/woodsbury/decimal128 v1.3.0/go.mod h1:C5UTmyTjW3JftjUFzOVhC20BEQa2a4ZKOB5I6Zjb+ds= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= @@ -425,6 +453,8 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI= +golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -522,6 +552,8 @@ golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s= +golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/api/auth/middleware.go b/internal/api/auth/middleware.go index a29dcf0c..89c33c95 100644 --- a/internal/api/auth/middleware.go +++ b/internal/api/auth/middleware.go @@ -303,12 +303,7 @@ func (am *AuthMiddleware) EnforceSubscriptionLimits() echo.MiddlewareFunc { // Set plan info in context for downstream handlers c.Set("plan_type", resolvedPlanType) - if isFreeTier { - dailyLimit := 3 - c.Set("daily_review_limit", &dailyLimit) - } else { - c.Set("daily_review_limit", (*int)(nil)) // unlimited - } + c.Set("daily_review_limit", (*int)(nil)) // unlimited return next(c) } diff --git a/internal/api/middleware/plan_enforcement.go b/internal/api/middleware/plan_enforcement.go index ef568d50..82f353f3 100644 --- a/internal/api/middleware/plan_enforcement.go +++ b/internal/api/middleware/plan_enforcement.go @@ -1,7 +1,7 @@ package middleware import ( - "database/sql" + "net/http" "os" "strings" @@ -58,65 +58,6 @@ func EnforcePlan(requiredFeature string) echo.MiddlewareFunc { } } -// CheckReviewLimit enforces daily review limits based on plan -func CheckReviewLimit(db *sql.DB) echo.MiddlewareFunc { - return func(next echo.HandlerFunc) echo.HandlerFunc { - return func(c echo.Context) error { - // CRITICAL: Only enforce limits in cloud mode - // In self-hosted mode, skip all subscription/plan checks - if !isCloudMode() { - return next(c) - } - - // Get JWT claims from context - claims, ok := c.Get("claims").(*auth.JWTClaims) - if !ok { - return echo.NewHTTPError(http.StatusUnauthorized, "Invalid or missing authentication") - } - - // Check license expiration first - if claims.LicenseExpiresAt != nil { - expiryTime := time.Unix(*claims.LicenseExpiresAt, 0) - if time.Now().After(expiryTime) { - return echo.NewHTTPError(http.StatusPaymentRequired, - "Your license has expired. Please renew to continue.") - } - } - - // Get plan limits - planType := license.PlanType(claims.PlanType) - limits := planType.GetLimits() - - // If unlimited reviews, skip the check - if limits.MaxReviewsPerDay == -1 { - return next(c) - } - - // Count today's reviews for this user in this org - var reviewCount int - err := db.QueryRow(` - SELECT COUNT(*) - FROM reviews - WHERE created_by_user_id = $1 - AND org_id = $2 - AND created_at >= CURRENT_DATE - `, claims.UserID, claims.CurrentOrgID).Scan(&reviewCount) - - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, - "Failed to check review limit") - } - - // Check if limit exceeded - if reviewCount >= limits.MaxReviewsPerDay { - return echo.NewHTTPError(http.StatusTooManyRequests, - "Daily review limit reached. Upgrade to Team plan for unlimited reviews.") - } - - return next(c) - } - } -} // RequirePlan ensures user has at least the specified plan level func RequirePlan(minPlan license.PlanType) echo.MiddlewareFunc { diff --git a/internal/api/review_service.go b/internal/api/review_service.go index d503bdbb..c0dff1e7 100644 --- a/internal/api/review_service.go +++ b/internal/api/review_service.go @@ -62,92 +62,11 @@ func NewReviewService(cfg *config.Config) *ReviewService { } } -// checkDailyReviewLimit verifies if the user has exceeded their daily review limit (free plan only) -func (s *Server) checkDailyReviewLimit(c echo.Context) error { - // Get daily review limit from context (set by EnforceSubscriptionLimits middleware) - dailyLimitPtr, ok := c.Get("daily_review_limit").(*int) - if !ok || dailyLimitPtr == nil { - // No limit (team plan) or not set - allow review - return nil - } - dailyLimit := *dailyLimitPtr - - // Get org_id and user from context - orgID, ok := c.Get("org_id").(int64) - if !ok { - return c.JSON(http.StatusBadRequest, map[string]interface{}{ - "error": "organization context required", - }) - } - - user, ok := c.Get("user").(*models.User) - if !ok || user == nil { - return c.JSON(http.StatusUnauthorized, map[string]interface{}{ - "error": "user authentication required", - }) - } - - // Check if user is org creator (only org creator can trigger reviews on free plan) - var isOrgCreator bool - err := s.db.QueryRow(` - SELECT (o.created_by_user_id = $1) as is_creator - FROM orgs o - WHERE o.id = $2 - `, user.ID, orgID).Scan(&isOrgCreator) - if err != nil { - log.Printf("[ERROR] Failed to check org creator status: %v", err) - return c.JSON(http.StatusInternalServerError, map[string]interface{}{ - "error": "failed to verify permissions", - }) - } - - if !isOrgCreator { - return c.JSON(http.StatusPaymentRequired, map[string]interface{}{ - "code": "NOT_ORG_CREATOR", - "error": "Only the organization creator can trigger reviews on the free plan", - "message": "Upgrade to Team plan to allow all members to trigger reviews", - }) - } - - // Count reviews created today by this user in this org - var reviewsToday int - err = s.db.QueryRow(` - SELECT COUNT(*) - FROM reviews - WHERE org_id = $1 - AND user_email = $2 - AND created_at >= CURRENT_DATE - `, orgID, user.Email).Scan(&reviewsToday) - if err != nil { - log.Printf("[ERROR] Failed to count daily reviews: %v", err) - return c.JSON(http.StatusInternalServerError, map[string]interface{}{ - "error": "failed to check review quota", - }) - } - - if reviewsToday >= dailyLimit { - return c.JSON(http.StatusPaymentRequired, map[string]interface{}{ - "code": "DAILY_LIMIT_EXCEEDED", - "error": fmt.Sprintf("Daily review limit exceeded (%d/%d)", reviewsToday, dailyLimit), - "message": "You've reached your daily limit of 3 reviews. Upgrade to Team plan for unlimited reviews.", - "limit": dailyLimit, - "used": reviewsToday, - }) - } - - log.Printf("[DEBUG] Daily review check passed: %d/%d reviews used", reviewsToday, dailyLimit) - return nil -} // TriggerReviewV2 handles the request to trigger a code review using the new decoupled architecture func (s *Server) TriggerReviewV2(c echo.Context) error { log.Printf("[DEBUG] TriggerReviewV2: Starting review request handling") - // Check daily review limit for free plan users BEFORE creating any DB records - if err := s.checkDailyReviewLimit(c); err != nil { - return err // Already formatted as JSON response - } - // LOC Quota preflight check — block before creating any DB records orgID, orgOK := c.Get("org_id").(int64) planCode := license.PlanFree30K From d135e1aa83d6fd6a16f51051d1eb66e0a9ce5f85 Mon Sep 17 00:00:00 2001 From: Lince Mathew Date: Mon, 18 May 2026 20:48:30 +0530 Subject: [PATCH 2/4] fix: default AI provider model fix LiveReview Pre-Commit Check: ran (iter:2, coverage:59%) --- internal/ai/langchain/provider.go | 21 ++++++++++++++++++--- internal/api/diff_review_test.go | 4 ++-- internal/review/factories.go | 2 ++ internal/review/service.go | 6 +++++- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/internal/ai/langchain/provider.go b/internal/ai/langchain/provider.go index 0a3c3965..bea1b9e9 100644 --- a/internal/ai/langchain/provider.go +++ b/internal/ai/langchain/provider.go @@ -41,6 +41,7 @@ type LangchainProvider struct { providerType string // NEW: Provider type (gemini, ollama, openai, etc.) baseURL string // NEW: Base URL for custom endpoints logger *logging.ReviewLogger // Logger for this review + providerName string // NEW: Provider name (e.g. "livereview-default-ai") } type aiResponseFileSummary struct { @@ -253,6 +254,7 @@ type Config struct { TemperatureSet bool `json:"temperature_set"` ProviderType string `json:"provider_type"` // NEW: "gemini", "ollama", "openai", etc. BaseURL string `json:"base_url"` // NEW: For custom endpoints like Ollama + ProviderName string `json:"provider_name"` // NEW: Provider name (e.g. "livereview-default-ai") } // New creates a new langchain-based AI provider @@ -266,6 +268,7 @@ func New(config Config, logger *logging.ReviewLogger) *LangchainProvider { providerType: config.ProviderType, // NEW baseURL: config.BaseURL, // NEW logger: logger, // NEW: Thread logger through + providerName: config.ProviderName, // NEW } } @@ -699,7 +702,11 @@ func (p *LangchainProvider) reviewCodeBatchFormatted(ctx context.Context, diffs // Log request to global logger and emit batch started event if p.logger != nil { - p.logger.LogRequest(batchId, p.modelName, prompt) + logModel := p.modelName + if p.providerName == "livereview-default-ai" { + logModel = "livereview-default-ai" + } + p.logger.LogRequest(batchId, logModel, prompt) p.logger.Log("Processing batch %s with %d diffs", batchId, len(diffs)) // Emit batch event so UI can show progress p.logger.EmitBatchStart(batchId, len(diffs)) @@ -731,8 +738,12 @@ func (p *LangchainProvider) reviewCodeBatchFormatted(ctx context.Context, diffs // Call the LLM with streaming fmt.Printf("[LANGCHAIN REQUEST] Calling LLM for batch %s with streaming...\n", batchId) + logModel := p.modelName + if p.providerName == "livereview-default-ai" { + logModel = "livereview-default-ai" + } fmt.Printf("[LANGCHAIN DEBUG] Provider type: %s, Model: %s, Base URL: %s\n", - p.providerType, p.modelName, p.baseURL) + p.providerType, logModel, p.baseURL) // Create a timeout context // For Ollama, some setups (reverse proxies) buffer SSE and models can be slow to start. @@ -948,8 +959,12 @@ func (p *LangchainProvider) reviewCodeBatchFormatted(ctx context.Context, diffs p.logger.LogError(fmt.Sprintf("LLM call batch %s", batchId), err) } fmt.Printf("\n[LANGCHAIN ERROR] LLM call failed for batch %s: %v\n", batchId, err) + logModel := p.modelName + if p.providerName == "livereview-default-ai" { + logModel = "livereview-default-ai" + } fmt.Printf("[LANGCHAIN ERROR] Provider: %s, Model: %s, Base URL: %s\n", - p.providerType, p.modelName, p.baseURL) + p.providerType, logModel, p.baseURL) p.logLLMErrorDetails(err, batchId) // Fallback for Ollama: retry once without streaming (some reverse proxies buffer/block streams) diff --git a/internal/api/diff_review_test.go b/internal/api/diff_review_test.go index 47d16d21..5a88f713 100644 --- a/internal/api/diff_review_test.go +++ b/internal/api/diff_review_test.go @@ -359,7 +359,7 @@ func TestDiffReviewHandlerStoresReviewResult(t *testing.T) { review, _ := mockRM.CreateReviewWithOrg("test-repo", "", "", "", "cli_diff", "", "cli", nil, map[string]interface{}{}, 1, "", "", "") // Simulate completion with review result - result := diffReviewResult{ + result := DiffReviewResult{ Summary: "Test summary", Comments: []*models.ReviewComment{ {FilePath: "test.go", Line: 10, Content: "test comment", Severity: models.SeverityInfo, Category: "test"}, @@ -486,7 +486,7 @@ func TestDiffReviewPollingWithCompletedStatus(t *testing.T) { mockRM.MergeReviewMetadata(review.ID, map[string]interface{}{"preloaded_changes": modelDiffs}) // Simulate completion with results - result := diffReviewResult{ + result := DiffReviewResult{ Summary: "Completed review", Comments: []*models.ReviewComment{ {FilePath: "file.go", Line: 1, Content: "looks good", Severity: models.SeverityInfo, Category: "general"}, diff --git a/internal/review/factories.go b/internal/review/factories.go index b01b3391..c9da7216 100644 --- a/internal/review/factories.go +++ b/internal/review/factories.go @@ -150,6 +150,7 @@ func (f *StandardAIProviderFactory) CreateAIProvider(ctx context.Context, config TemperatureSet: true, ProviderType: providerType, BaseURL: baseURL, + ProviderName: providerName, }, logger), nil default: // Default to langchain for any unrecognized type @@ -179,6 +180,7 @@ func (f *StandardAIProviderFactory) CreateAIProvider(ctx context.Context, config TemperatureSet: true, ProviderType: providerType, BaseURL: baseURL, + ProviderName: providerName, }, logger), nil } } diff --git a/internal/review/service.go b/internal/review/service.go index f85be81e..f4ea1554 100644 --- a/internal/review/service.go +++ b/internal/review/service.go @@ -137,7 +137,11 @@ func (s *Service) ProcessReview(ctx context.Context, request ReviewRequest) *Rev } else { aiConnectorName = request.AI.Type } - s.logger.Log("AI Provider: %s (model: %s)", aiConnectorName, request.AI.Model) + if aiConnectorName == "livereview-default-ai" { + s.logger.Log("AI Provider: %s", aiConnectorName) + } else { + s.logger.Log("AI Provider: %s (model: %s)", aiConnectorName, request.AI.Model) + } s.logger.Log("Start time: %s", start.Format("2006-01-02 15:04:05.000")) } From 255d020a05aa242c46eeef6ab2c53175ee355f60 Mon Sep 17 00:00:00 2001 From: Lince Mathew Date: Mon, 18 May 2026 20:56:46 +0530 Subject: [PATCH 3/4] fix:ai provider type fix LiveReview Pre-Commit Check: ran (iter:1, coverage:0%) --- docs/openapi.yaml | 8 ++++---- internal/ai/langchain/provider.go | 26 +++++++++++--------------- internal/review/service.go | 3 ++- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 5f885d56..119476e2 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -5702,12 +5702,12 @@ paths: operationId: DeactivateUser parameters: - in: path - name: org_id + name: user_id required: true schema: type: string - in: path - name: user_id + name: org_id required: true schema: type: string @@ -6160,12 +6160,12 @@ paths: operationId: CreatePromptChunk parameters: - in: path - name: var + name: key required: true schema: type: string - in: path - name: key + name: var required: true schema: type: string diff --git a/internal/ai/langchain/provider.go b/internal/ai/langchain/provider.go index bea1b9e9..11785267 100644 --- a/internal/ai/langchain/provider.go +++ b/internal/ai/langchain/provider.go @@ -25,6 +25,7 @@ import ( "github.com/livereview/internal/batch" "github.com/livereview/internal/logging" + "github.com/livereview/internal/aidefault" "github.com/livereview/internal/prompts" vendorpack "github.com/livereview/internal/prompts/vendor" "github.com/livereview/pkg/models" @@ -612,6 +613,13 @@ func (p *LangchainProvider) getModelName() string { } } +func (p *LangchainProvider) getLoggedModelName() string { + if p.providerName == aidefault.ProviderName { + return aidefault.ProviderName + } + return p.modelName +} + // ReviewCode is the legacy method for backwards compatibility func (p *LangchainProvider) ReviewCode(ctx context.Context, diffs []*models.CodeDiff) (*models.ReviewResult, error) { // Convert to the newer batch-based approach @@ -702,11 +710,7 @@ func (p *LangchainProvider) reviewCodeBatchFormatted(ctx context.Context, diffs // Log request to global logger and emit batch started event if p.logger != nil { - logModel := p.modelName - if p.providerName == "livereview-default-ai" { - logModel = "livereview-default-ai" - } - p.logger.LogRequest(batchId, logModel, prompt) + p.logger.LogRequest(batchId, p.getLoggedModelName(), prompt) p.logger.Log("Processing batch %s with %d diffs", batchId, len(diffs)) // Emit batch event so UI can show progress p.logger.EmitBatchStart(batchId, len(diffs)) @@ -738,12 +742,8 @@ func (p *LangchainProvider) reviewCodeBatchFormatted(ctx context.Context, diffs // Call the LLM with streaming fmt.Printf("[LANGCHAIN REQUEST] Calling LLM for batch %s with streaming...\n", batchId) - logModel := p.modelName - if p.providerName == "livereview-default-ai" { - logModel = "livereview-default-ai" - } fmt.Printf("[LANGCHAIN DEBUG] Provider type: %s, Model: %s, Base URL: %s\n", - p.providerType, logModel, p.baseURL) + p.providerType, p.getLoggedModelName(), p.baseURL) // Create a timeout context // For Ollama, some setups (reverse proxies) buffer SSE and models can be slow to start. @@ -959,12 +959,8 @@ func (p *LangchainProvider) reviewCodeBatchFormatted(ctx context.Context, diffs p.logger.LogError(fmt.Sprintf("LLM call batch %s", batchId), err) } fmt.Printf("\n[LANGCHAIN ERROR] LLM call failed for batch %s: %v\n", batchId, err) - logModel := p.modelName - if p.providerName == "livereview-default-ai" { - logModel = "livereview-default-ai" - } fmt.Printf("[LANGCHAIN ERROR] Provider: %s, Model: %s, Base URL: %s\n", - p.providerType, logModel, p.baseURL) + p.providerType, p.getLoggedModelName(), p.baseURL) p.logLLMErrorDetails(err, batchId) // Fallback for Ollama: retry once without streaming (some reverse proxies buffer/block streams) diff --git a/internal/review/service.go b/internal/review/service.go index f4ea1554..bfab9b22 100644 --- a/internal/review/service.go +++ b/internal/review/service.go @@ -11,6 +11,7 @@ import ( "strings" "github.com/livereview/internal/ai" + "github.com/livereview/internal/aidefault" "github.com/livereview/internal/batch" "github.com/livereview/internal/logging" "github.com/livereview/internal/providers" @@ -137,7 +138,7 @@ func (s *Service) ProcessReview(ctx context.Context, request ReviewRequest) *Rev } else { aiConnectorName = request.AI.Type } - if aiConnectorName == "livereview-default-ai" { + if aiConnectorName == aidefault.ProviderName { s.logger.Log("AI Provider: %s", aiConnectorName) } else { s.logger.Log("AI Provider: %s (model: %s)", aiConnectorName, request.AI.Model) From 83eb736b8a0a8bdc1a5f3236e8798be866657036 Mon Sep 17 00:00:00 2001 From: Lince Mathew Date: Mon, 18 May 2026 21:23:44 +0530 Subject: [PATCH 4/4] refactor:osv scanner fix:update dependencies --- docs/openapi.yaml | 65 ++++++++++++++++++++++++++++++++++++-------- ui/package-lock.json | 49 ++++++++++++++++----------------- ui/package.json | 5 ++-- 3 files changed, 80 insertions(+), 39 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 119476e2..65a02d69 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -4695,12 +4695,12 @@ paths: operationId: GetReviewEventsByType parameters: - in: path - name: id + name: type required: true schema: type: string - in: path - name: type + name: id required: true schema: type: string @@ -5702,12 +5702,12 @@ paths: operationId: DeactivateUser parameters: - in: path - name: user_id + name: org_id required: true schema: type: string - in: path - name: org_id + name: user_id required: true schema: type: string @@ -5727,12 +5727,12 @@ paths: operationId: GetUser parameters: - in: path - name: org_id + name: user_id required: true schema: type: string - in: path - name: user_id + name: org_id required: true schema: type: string @@ -5750,12 +5750,12 @@ paths: operationId: UpdateUser parameters: - in: path - name: org_id + name: user_id required: true schema: type: string - in: path - name: user_id + name: org_id required: true schema: type: string @@ -5825,12 +5825,12 @@ paths: operationId: ChangeUserRole parameters: - in: path - name: user_id + name: org_id required: true schema: type: string - in: path - name: org_id + name: user_id required: true schema: type: string @@ -6160,12 +6160,12 @@ paths: operationId: CreatePromptChunk parameters: - in: path - name: key + name: var required: true schema: type: string - in: path - name: var + name: key required: true schema: type: string @@ -7059,3 +7059,44 @@ paths: - Webhooks servers: - url: http://localhost:8888 +V2Handler + parameters: + - in: path + name: connector_id + required: true + schema: + type: string + responses: + "500": + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: Internal Server Error + tags: + - Webhook + /api/v1/webhooks/gitlab/comments/{connector_id}: + post: + description: WebhookOrchestratorV2Handler handles webhooks using the V2 orchestrator (full processing pipeline) + operationId: WebhookOrchestratorV2Handler + parameters: + - in: path + name: connector_id + required: true + schema: + type: string + responses: + "500": + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: Internal Server Error + tags: + - Webhooks +servers: + - url: http://localhost:8888 diff --git a/ui/package-lock.json b/ui/package-lock.json index 1ecd90b8..017e226f 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -83,7 +83,7 @@ "webpack": "^5.104.1", "webpack-bundle-analyzer": "^4.4.2", "webpack-cli": "^5.1.4", - "webpack-dev-server": "^5.2.3", + "webpack-dev-server": "^5.2.4", "webpack-obfuscator": "^3.5.1" } }, @@ -4689,9 +4689,9 @@ "license": "BSD-3-Clause" }, "node_modules/@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz", + "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==", "license": "BSD-3-Clause" }, "node_modules/@protobufjs/eventemitter": { @@ -4701,13 +4701,12 @@ "license": "BSD-3-Clause" }, "node_modules/@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz", + "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==", "license": "BSD-3-Clause", "dependencies": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" + "@protobufjs/aspromise": "^1.1.1" } }, "node_modules/@protobufjs/float": { @@ -4717,9 +4716,9 @@ "license": "BSD-3-Clause" }, "node_modules/@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.2.tgz", + "integrity": "sha512-pa0vFRuws4wkvaXKK1uXZMAwAX4/t8ANaJo45iw/oQHNQ9q5xUzwgFmVJGXiga2BeN+zpX7Vf9vmsiIa2J+MUw==", "license": "BSD-3-Clause" }, "node_modules/@protobufjs/path": { @@ -4735,9 +4734,9 @@ "license": "BSD-3-Clause" }, "node_modules/@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.1.tgz", + "integrity": "sha512-oOAWABowe8EAbMyWKM0tYDKi8Yaox52D+HWZhAIJqQXbqe0xI/GV7FhLWqlEKreMkfDjshR5FKgi3mnle0h6Eg==", "license": "BSD-3-Clause" }, "node_modules/@reduxjs/toolkit": { @@ -16435,22 +16434,22 @@ } }, "node_modules/protobufjs": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.5.tgz", - "integrity": "sha512-3wY1AxV+VBNW8Yypfd1yQY9pXnqTAN+KwQxL8iYm3/BjKYMNg4i0owhEe26PWDOMaIrzeeF98Lqd5NGz4omiIg==", + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.9.tgz", + "integrity": "sha512-Od4muIm3HW1AouyHF5lONOf1FWo3hY1NbFDoy191X9GzhpgW1clCoaFjfVs2rKJNFYpTNJbje4cbAIDBZJ63ZA==", "hasInstallScript": true, "license": "BSD-3-Clause", "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", + "@protobufjs/codegen": "^2.0.5", "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", + "@protobufjs/fetch": "^1.1.1", "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", + "@protobufjs/inquire": "^1.1.2", "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", + "@protobufjs/utf8": "^1.1.1", "@types/node": ">=13.7.0", "long": "^5.0.0" }, @@ -19865,9 +19864,9 @@ } }, "node_modules/webpack-dev-server": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-5.2.3.tgz", - "integrity": "sha512-9Gyu2F7+bg4Vv+pjbovuYDhHX+mqdqITykfzdM9UyKqKHlsE5aAjRhR+oOEfXW5vBeu8tarzlJFIZva4ZjAdrQ==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-5.2.4.tgz", + "integrity": "sha512-GqDPGZN9bRqKBTkp4aWkobDDHMsrXKoGSdOH56smIri8qR0JG8gfL8/v/f/OZR3/OKXjG8uwJbFVhKm/FNU/UA==", "dev": true, "license": "MIT", "dependencies": { diff --git a/ui/package.json b/ui/package.json index 56e135dc..2342b15a 100644 --- a/ui/package.json +++ b/ui/package.json @@ -79,7 +79,7 @@ "webpack": "^5.104.1", "webpack-bundle-analyzer": "^4.4.2", "webpack-cli": "^5.1.4", - "webpack-dev-server": "^5.2.3", + "webpack-dev-server": "^5.2.4", "webpack-obfuscator": "^3.5.1" }, "dependencies": { @@ -140,7 +140,8 @@ "svgo": "3.3.3", "follow-redirects": "1.16.0", "dompurify": "^3.4.0", - "protobufjs": "^7.5.5", + "@protobufjs/utf8": "^1.1.1", + "protobufjs": "^7.5.6", "uuid": "14.0.0", "postcss": "^8.5.10" }