codeflash-internal/js/cf-api/endpoints/suggest-pr-changes.ts

963 lines
28 KiB
TypeScript
Raw Normal View History

cf-api fix (#1512) ### **PR Type** - Enhancement - Bug fix ___ ### **Description** - Update ES module import paths with explicit .js extensions. - Refactor function signatures and type annotations for TypeScript. - Wrap Express app with @awaitjs/express for async support. - Upgrade package configurations and tsconfig settings. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>6 files</summary><table> <tr> <td><strong>diff_utils.test.ts</strong><dd><code>Adjust import paths to include .js extensions.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c0991313f3fcb63fa2a553856b85d7df03e6d99cf98d19277fe689025f89ede1">+2/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>create-pr-from-diffcontents.ts</strong><dd><code>Update import paths and adjust Octokit typing.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b30d5e0c89beb70c0333a025726867aba5db7614911be3c46664bb59d1ab594a">+12/-11</a>&nbsp; </td> </tr> <tr> <td><strong>index.ts</strong><dd><code>Use @awaitjs/express wrap to create AsyncExpressApp.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+7/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>setupAction.ts</strong><dd><code>Update workflow setup action and adjust GitHub API usage.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-88c84a935a854855fb103dbf560f6ed5ea2e73e45750c97b5a3b901a5f9399a2">+5/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.d.ts</strong><dd><code>Add new type definitions for Octokit and AsyncExpressApp.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-370b1e96082f265e191b7aac76caa9feb60d32d56c36a2924725200b3d41f423">+45/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.ts</strong><dd><code>Remove obsolete types; migrate to types.d.ts.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-8d1257d2e60e56e9c02c59b85078e89ad41af60267b02842daf203da3231902f">+0/-6</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Bug fix</strong></td><td><details><summary>4 files</summary><table> <tr> <td><strong>is-github-app-installed.ts</strong><dd><code>Add ts-ignore and adjust GitHub app installation endpoint.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-4b97bd2b461108930999b4af7e47d4763ad1b9490f7352130109c39f5abf4561">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>suggest-pr-changes.ts</strong><dd><code>Refactor types, cast Octokit instance, and update parameters.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b4a862986fd70827b8dabcb3157972bd0d5d507cf9c12e5fbf56f24979d073f3">+22/-15</a>&nbsp; </td> </tr> <tr> <td><strong>check-valid-api-key.ts</strong><dd><code>Refine middleware typing with NextFunction.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c04a6087bbabce916c7547acf14c186caf7af3ec6ff68b7e49102c3fe87e453c">+9/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>track-usage.ts</strong><dd><code>Change Request type to AuthorizedUserReq in usage tracker.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-9248228a33147544ca9b58ff8b9c737b33763dd3e29717c82c38808bb7e34db3">+2/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Configuration changes</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>package.json</strong><dd><code>Upgrade dependencies and refine build/deploy scripts.</code>&nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+8/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>tsconfig.json</strong><dd><code>Modify module, strict, and lib options for NodeNext.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-3532a852c82c88daeed6b57a35cd52c4a2589c909edc756613d67e280ab9b23e">+6/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>1 files</summary><table> <tr> <td><strong>migration.sql</strong><dd><code>Add placeholder migration for rolled back changes.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-98f5513f409a695839ec0bb0ee8e77d3c858e26c30db2113a83973dc1fa46c25">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-03-12 22:30:10 +00:00
import { determineValidHunks, fileDiffsToMap, isDiffContentsWellFormed } from "../diff_utils.js"
import { userNickname } from "../auth0-mgmt.js"
import { logger } from "../utils/logger.js"
cf-api fix (#1512) ### **PR Type** - Enhancement - Bug fix ___ ### **Description** - Update ES module import paths with explicit .js extensions. - Refactor function signatures and type annotations for TypeScript. - Wrap Express app with @awaitjs/express for async support. - Upgrade package configurations and tsconfig settings. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>6 files</summary><table> <tr> <td><strong>diff_utils.test.ts</strong><dd><code>Adjust import paths to include .js extensions.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c0991313f3fcb63fa2a553856b85d7df03e6d99cf98d19277fe689025f89ede1">+2/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>create-pr-from-diffcontents.ts</strong><dd><code>Update import paths and adjust Octokit typing.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b30d5e0c89beb70c0333a025726867aba5db7614911be3c46664bb59d1ab594a">+12/-11</a>&nbsp; </td> </tr> <tr> <td><strong>index.ts</strong><dd><code>Use @awaitjs/express wrap to create AsyncExpressApp.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+7/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>setupAction.ts</strong><dd><code>Update workflow setup action and adjust GitHub API usage.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-88c84a935a854855fb103dbf560f6ed5ea2e73e45750c97b5a3b901a5f9399a2">+5/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.d.ts</strong><dd><code>Add new type definitions for Octokit and AsyncExpressApp.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-370b1e96082f265e191b7aac76caa9feb60d32d56c36a2924725200b3d41f423">+45/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.ts</strong><dd><code>Remove obsolete types; migrate to types.d.ts.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-8d1257d2e60e56e9c02c59b85078e89ad41af60267b02842daf203da3231902f">+0/-6</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Bug fix</strong></td><td><details><summary>4 files</summary><table> <tr> <td><strong>is-github-app-installed.ts</strong><dd><code>Add ts-ignore and adjust GitHub app installation endpoint.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-4b97bd2b461108930999b4af7e47d4763ad1b9490f7352130109c39f5abf4561">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>suggest-pr-changes.ts</strong><dd><code>Refactor types, cast Octokit instance, and update parameters.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b4a862986fd70827b8dabcb3157972bd0d5d507cf9c12e5fbf56f24979d073f3">+22/-15</a>&nbsp; </td> </tr> <tr> <td><strong>check-valid-api-key.ts</strong><dd><code>Refine middleware typing with NextFunction.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c04a6087bbabce916c7547acf14c186caf7af3ec6ff68b7e49102c3fe87e453c">+9/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>track-usage.ts</strong><dd><code>Change Request type to AuthorizedUserReq in usage tracker.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-9248228a33147544ca9b58ff8b9c737b33763dd3e29717c82c38808bb7e34db3">+2/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Configuration changes</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>package.json</strong><dd><code>Upgrade dependencies and refine build/deploy scripts.</code>&nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+8/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>tsconfig.json</strong><dd><code>Modify module, strict, and lib options for NodeNext.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-3532a852c82c88daeed6b57a35cd52c4a2589c909edc756613d67e280ab9b23e">+6/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>1 files</summary><table> <tr> <td><strong>migration.sql</strong><dd><code>Add placeholder migration for rolled back changes.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-98f5513f409a695839ec0bb0ee8e77d3c858e26c30db2113a83973dc1fa46c25">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-03-12 22:30:10 +00:00
import { getInstallationOctokitByOwner, isUserCollaborator } from "../github/github-utils.js"
import { githubApp } from "../github/github-app.js"
import {
buildDependentPrTitle,
buildPrCommentBody,
generateOptimizationReviewTemplate,
originalPRComment,
} from "../github/pr-changes-utils.js"
import {
createDependentPullRequest,
createNewBranchFromDiffContents,
cf-api fix (#1512) ### **PR Type** - Enhancement - Bug fix ___ ### **Description** - Update ES module import paths with explicit .js extensions. - Refactor function signatures and type annotations for TypeScript. - Wrap Express app with @awaitjs/express for async support. - Upgrade package configurations and tsconfig settings. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>6 files</summary><table> <tr> <td><strong>diff_utils.test.ts</strong><dd><code>Adjust import paths to include .js extensions.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c0991313f3fcb63fa2a553856b85d7df03e6d99cf98d19277fe689025f89ede1">+2/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>create-pr-from-diffcontents.ts</strong><dd><code>Update import paths and adjust Octokit typing.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b30d5e0c89beb70c0333a025726867aba5db7614911be3c46664bb59d1ab594a">+12/-11</a>&nbsp; </td> </tr> <tr> <td><strong>index.ts</strong><dd><code>Use @awaitjs/express wrap to create AsyncExpressApp.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+7/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>setupAction.ts</strong><dd><code>Update workflow setup action and adjust GitHub API usage.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-88c84a935a854855fb103dbf560f6ed5ea2e73e45750c97b5a3b901a5f9399a2">+5/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.d.ts</strong><dd><code>Add new type definitions for Octokit and AsyncExpressApp.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-370b1e96082f265e191b7aac76caa9feb60d32d56c36a2924725200b3d41f423">+45/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.ts</strong><dd><code>Remove obsolete types; migrate to types.d.ts.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-8d1257d2e60e56e9c02c59b85078e89ad41af60267b02842daf203da3231902f">+0/-6</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Bug fix</strong></td><td><details><summary>4 files</summary><table> <tr> <td><strong>is-github-app-installed.ts</strong><dd><code>Add ts-ignore and adjust GitHub app installation endpoint.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-4b97bd2b461108930999b4af7e47d4763ad1b9490f7352130109c39f5abf4561">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>suggest-pr-changes.ts</strong><dd><code>Refactor types, cast Octokit instance, and update parameters.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b4a862986fd70827b8dabcb3157972bd0d5d507cf9c12e5fbf56f24979d073f3">+22/-15</a>&nbsp; </td> </tr> <tr> <td><strong>check-valid-api-key.ts</strong><dd><code>Refine middleware typing with NextFunction.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c04a6087bbabce916c7547acf14c186caf7af3ec6ff68b7e49102c3fe87e453c">+9/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>track-usage.ts</strong><dd><code>Change Request type to AuthorizedUserReq in usage tracker.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-9248228a33147544ca9b58ff8b9c737b33763dd3e29717c82c38808bb7e34db3">+2/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Configuration changes</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>package.json</strong><dd><code>Upgrade dependencies and refine build/deploy scripts.</code>&nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+8/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>tsconfig.json</strong><dd><code>Modify module, strict, and lib options for NodeNext.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-3532a852c82c88daeed6b57a35cd52c4a2589c909edc756613d67e280ab9b23e">+6/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>1 files</summary><table> <tr> <td><strong>migration.sql</strong><dd><code>Add placeholder migration for rolled back changes.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-98f5513f409a695839ec0bb0ee8e77d3c858e26c30db2113a83973dc1fa46c25">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-03-12 22:30:10 +00:00
} from "../github/create-pr-from-diffcontents.js"
import { posthog } from "../analytics.js"
import type { FileDiffContent } from "@codeflash-ai/code-suggester/build/src/types.js"
import { PrismaClient } from "@prisma/client"
import { prisma } from "@codeflash-ai/common"
cf-api fix (#1512) ### **PR Type** - Enhancement - Bug fix ___ ### **Description** - Update ES module import paths with explicit .js extensions. - Refactor function signatures and type annotations for TypeScript. - Wrap Express app with @awaitjs/express for async support. - Upgrade package configurations and tsconfig settings. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>6 files</summary><table> <tr> <td><strong>diff_utils.test.ts</strong><dd><code>Adjust import paths to include .js extensions.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c0991313f3fcb63fa2a553856b85d7df03e6d99cf98d19277fe689025f89ede1">+2/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>create-pr-from-diffcontents.ts</strong><dd><code>Update import paths and adjust Octokit typing.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b30d5e0c89beb70c0333a025726867aba5db7614911be3c46664bb59d1ab594a">+12/-11</a>&nbsp; </td> </tr> <tr> <td><strong>index.ts</strong><dd><code>Use @awaitjs/express wrap to create AsyncExpressApp.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+7/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>setupAction.ts</strong><dd><code>Update workflow setup action and adjust GitHub API usage.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-88c84a935a854855fb103dbf560f6ed5ea2e73e45750c97b5a3b901a5f9399a2">+5/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.d.ts</strong><dd><code>Add new type definitions for Octokit and AsyncExpressApp.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-370b1e96082f265e191b7aac76caa9feb60d32d56c36a2924725200b3d41f423">+45/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.ts</strong><dd><code>Remove obsolete types; migrate to types.d.ts.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-8d1257d2e60e56e9c02c59b85078e89ad41af60267b02842daf203da3231902f">+0/-6</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Bug fix</strong></td><td><details><summary>4 files</summary><table> <tr> <td><strong>is-github-app-installed.ts</strong><dd><code>Add ts-ignore and adjust GitHub app installation endpoint.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-4b97bd2b461108930999b4af7e47d4763ad1b9490f7352130109c39f5abf4561">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>suggest-pr-changes.ts</strong><dd><code>Refactor types, cast Octokit instance, and update parameters.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b4a862986fd70827b8dabcb3157972bd0d5d507cf9c12e5fbf56f24979d073f3">+22/-15</a>&nbsp; </td> </tr> <tr> <td><strong>check-valid-api-key.ts</strong><dd><code>Refine middleware typing with NextFunction.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c04a6087bbabce916c7547acf14c186caf7af3ec6ff68b7e49102c3fe87e453c">+9/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>track-usage.ts</strong><dd><code>Change Request type to AuthorizedUserReq in usage tracker.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-9248228a33147544ca9b58ff8b9c737b33763dd3e29717c82c38808bb7e34db3">+2/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Configuration changes</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>package.json</strong><dd><code>Upgrade dependencies and refine build/deploy scripts.</code>&nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+8/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>tsconfig.json</strong><dd><code>Modify module, strict, and lib options for NodeNext.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-3532a852c82c88daeed6b57a35cd52c4a2589c909edc756613d67e280ab9b23e">+6/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>1 files</summary><table> <tr> <td><strong>migration.sql</strong><dd><code>Add placeholder migration for rolled back changes.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-98f5513f409a695839ec0bb0ee8e77d3c858e26c30db2113a83973dc1fa46c25">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-03-12 22:30:10 +00:00
import { sendSlackMessage } from "../github/slack_util.js"
import { Response } from "express"
import {
requestApproval,
2025-07-18 23:41:11 +00:00
requiresApprovalForRepo,
isQualityMonitoringRepo,
sendQualityMonitoringNotification,
} from "../github/optimization_approval.js"
import { registerRepositoryAndMember } from "./utils/github-repo-setup.js"
import { saveStagingReview } from "./create-staging.js"
import { AnyOctokit, AuthorizedUserReq, PullRequestDB } from "../types.js"
import { OptimizationReview } from "../OptimizationReview.js"
2026-01-19 17:33:57 +00:00
import {
missingRequiredFields,
validationFailure,
unauthorized,
githubInstallationError,
githubNotCollaborator,
optimizationRejected,
unprocessableEntity,
internalServerError,
} from "../exceptions/index.js"
// Dependencies interface for easier testing
export interface SuggestPrChangesDependencies {
prisma: PrismaClient
userNickname: typeof userNickname
getInstallationOctokitByOwner: typeof getInstallationOctokitByOwner
isUserCollaborator: typeof isUserCollaborator
2025-07-18 23:41:11 +00:00
requiresApproval: typeof requiresApprovalForRepo
requestApproval: typeof requestApproval
posthog: typeof posthog
githubApp: typeof githubApp
isDiffContentsWellFormed: typeof isDiffContentsWellFormed
fileDiffsToMap: typeof fileDiffsToMap
determineValidHunks: typeof determineValidHunks
buildDependentPrTitle: typeof buildDependentPrTitle
buildPrCommentBody: typeof buildPrCommentBody
createNewBranchFromDiffContents: typeof createNewBranchFromDiffContents
createDependentPullRequest: typeof createDependentPullRequest
sendSlackMessage: typeof sendSlackMessage
updateOptimizationEvent: typeof updateOptimizationEvent
saveStagingReview: typeof saveStagingReview
}
// Default dependencies
let dependencies: SuggestPrChangesDependencies = {
prisma,
userNickname,
getInstallationOctokitByOwner,
isUserCollaborator,
2025-07-18 23:41:11 +00:00
requiresApproval: requiresApprovalForRepo,
requestApproval,
posthog,
githubApp,
isDiffContentsWellFormed,
fileDiffsToMap,
determineValidHunks,
buildDependentPrTitle,
buildPrCommentBody,
createNewBranchFromDiffContents,
createDependentPullRequest,
sendSlackMessage,
updateOptimizationEvent,
saveStagingReview,
}
// For testing - allow dependency injection
export function setSuggestPrChangesDependencies(deps: Partial<SuggestPrChangesDependencies>) {
dependencies = { ...dependencies, ...deps }
}
export function resetSuggestPrChangesDependencies() {
dependencies = {
prisma,
userNickname,
getInstallationOctokitByOwner,
isUserCollaborator,
2025-07-18 23:41:11 +00:00
requiresApproval: requiresApprovalForRepo,
requestApproval,
posthog,
githubApp,
isDiffContentsWellFormed,
fileDiffsToMap,
determineValidHunks,
buildDependentPrTitle,
buildPrCommentBody,
createNewBranchFromDiffContents,
createDependentPullRequest,
sendSlackMessage,
updateOptimizationEvent,
saveStagingReview,
}
}
2024-12-19 19:17:18 +00:00
const slackNotificationConfig = {
"Future-House": ["aviary", "paper-qa"],
"langflow-ai": ["langflow"],
"albumentations-team": ["albumentations"],
2025-03-19 23:19:09 +00:00
"Skyvern-AI": ["skyvern"],
2025-04-15 22:25:24 +00:00
roboflow: ["inference"],
gdsfactory: ["gdsfactory"],
stackai: ["stackend"],
}
// Helper function to parse speedup values (same as create-staging.ts)
function parseSpeedupValue(value: unknown, suffix: "x" | "%"): number | null {
if (value === undefined || value === null || value === "") {
return null
}
let stringValue = String(value).trim().toLowerCase()
if (stringValue.endsWith(suffix)) {
stringValue = stringValue.slice(0, -1)
}
const parsed = parseFloat(stringValue.replace(",", ""))
return isNaN(parsed) ? null : parsed
}
// Utility function to update optimization event in the database
export async function updateOptimizationEvent(
traceId: string,
prId?: string,
prCommentFields?: any,
feat: Add Line Profiler visualization to webapp (#2268) ## Summary Adds a line-by-line performance profiler visualization to the webapp, allowing users to compare execution times between original and optimized code. ## Changes ### New Line Profiler View - **`LineProfilerView.tsx`**: Side-by-side comparison component showing: - Line-by-line execution times with heat map visualization - Syntax highlighting using `prism-react-renderer` - Collapsible function blocks - Light/dark mode support - Heat legend (cold → hot based on % time) - **`lineProfilerParser.ts`**: Parser utilities for line profiler data: - `parseLineProfilerResults()` - parses markdown table output from Python's line_profiler - `formatTime()` - converts timer units to human-readable format (ns, µs, ms, s) - `getHeatLevel()` - determines heat coloring based on % time - **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for the profiler view ### API Changes - **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR description when profiler data exists - **`github-app.ts`**: Removes line profiler data from metadata when PR is closed/merged - **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line profiler data in staging - **`staging-storage-strategy.ts`**: Interface updates for line profiler fields ### Webapp Integration - **`page.tsx`**: Added "Performance Profile" button (only visible when profiler data exists) - **`action.ts`**: Sends line profiler data when creating PR from webapp Fixes CF-1018 https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov https://github.com/HeshamHM28/my-best-repo/pull/21 linked to https://github.com/codeflash-ai/codeflash/pull/1139 --------- Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 16:36:54 +00:00
originalLineProfiler?: string,
optimizedLineProfiler?: string,
) {
if (traceId !== "") {
try {
// Check existing data first (preserve staging data)
const existing = await dependencies.prisma.optimization_events.findUnique({
where: { trace_id: traceId },
feat: Add Line Profiler visualization to webapp (#2268) ## Summary Adds a line-by-line performance profiler visualization to the webapp, allowing users to compare execution times between original and optimized code. ## Changes ### New Line Profiler View - **`LineProfilerView.tsx`**: Side-by-side comparison component showing: - Line-by-line execution times with heat map visualization - Syntax highlighting using `prism-react-renderer` - Collapsible function blocks - Light/dark mode support - Heat legend (cold → hot based on % time) - **`lineProfilerParser.ts`**: Parser utilities for line profiler data: - `parseLineProfilerResults()` - parses markdown table output from Python's line_profiler - `formatTime()` - converts timer units to human-readable format (ns, µs, ms, s) - `getHeatLevel()` - determines heat coloring based on % time - **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for the profiler view ### API Changes - **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR description when profiler data exists - **`github-app.ts`**: Removes line profiler data from metadata when PR is closed/merged - **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line profiler data in staging - **`staging-storage-strategy.ts`**: Interface updates for line profiler fields ### Webapp Integration - **`page.tsx`**: Added "Performance Profile" button (only visible when profiler data exists) - **`action.ts`**: Sends line profiler data when creating PR from webapp Fixes CF-1018 https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov https://github.com/HeshamHM28/my-best-repo/pull/21 linked to https://github.com/codeflash-ai/codeflash/pull/1139 --------- Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 16:36:54 +00:00
select: {
function_name: true,
speedup_x: true,
file_path: true,
speedup_pct: true,
metadata: true,
},
})
// Extract data from prCommentFields if provided
const updateData: any = {
...(prId ? { pr_id: String(prId) } : {}),
is_optimization_found: true,
event_type: prId ? "pr_created" : "no-pr",
}
// Only add optimization data if prCommentFields provided AND not already set
if (prCommentFields) {
if (!existing?.function_name && prCommentFields.function_name) {
updateData.function_name = prCommentFields.function_name
}
if (!existing?.file_path && prCommentFields.file_path) {
updateData.file_path = prCommentFields.file_path
}
if (existing?.speedup_x == null && prCommentFields.speedup_x) {
updateData.speedup_x = parseSpeedupValue(prCommentFields.speedup_x, "x")
}
if (existing?.speedup_pct == null && prCommentFields.speedup_pct) {
updateData.speedup_pct = parseSpeedupValue(prCommentFields.speedup_pct, "%")
}
}
feat: Add Line Profiler visualization to webapp (#2268) ## Summary Adds a line-by-line performance profiler visualization to the webapp, allowing users to compare execution times between original and optimized code. ## Changes ### New Line Profiler View - **`LineProfilerView.tsx`**: Side-by-side comparison component showing: - Line-by-line execution times with heat map visualization - Syntax highlighting using `prism-react-renderer` - Collapsible function blocks - Light/dark mode support - Heat legend (cold → hot based on % time) - **`lineProfilerParser.ts`**: Parser utilities for line profiler data: - `parseLineProfilerResults()` - parses markdown table output from Python's line_profiler - `formatTime()` - converts timer units to human-readable format (ns, µs, ms, s) - `getHeatLevel()` - determines heat coloring based on % time - **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for the profiler view ### API Changes - **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR description when profiler data exists - **`github-app.ts`**: Removes line profiler data from metadata when PR is closed/merged - **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line profiler data in staging - **`staging-storage-strategy.ts`**: Interface updates for line profiler fields ### Webapp Integration - **`page.tsx`**: Added "Performance Profile" button (only visible when profiler data exists) - **`action.ts`**: Sends line profiler data when creating PR from webapp Fixes CF-1018 https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov https://github.com/HeshamHM28/my-best-repo/pull/21 linked to https://github.com/codeflash-ai/codeflash/pull/1139 --------- Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 16:36:54 +00:00
// Add line profiler data to metadata if provided
if (originalLineProfiler || optimizedLineProfiler) {
const currentMetadata = (existing?.metadata ?? {}) as Record<string, unknown>
if (originalLineProfiler && !currentMetadata.originalLineProfiler) {
currentMetadata.originalLineProfiler = originalLineProfiler
}
if (optimizedLineProfiler && !currentMetadata.optimizedLineProfiler) {
currentMetadata.optimizedLineProfiler = optimizedLineProfiler
}
updateData.metadata = currentMetadata
}
await dependencies.prisma.optimization_events.update({
where: { trace_id: traceId },
data: updateData,
})
} catch (eventError) {
logger.error(
"Failed to update optimization event:",
{ endpoint: "/cfapi/suggest-pr-changes", operation: "update_optimization_event" },
{},
eventError as Error,
)
}
}
2024-12-19 19:17:18 +00:00
}
cf-api fix (#1512) ### **PR Type** - Enhancement - Bug fix ___ ### **Description** - Update ES module import paths with explicit .js extensions. - Refactor function signatures and type annotations for TypeScript. - Wrap Express app with @awaitjs/express for async support. - Upgrade package configurations and tsconfig settings. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>6 files</summary><table> <tr> <td><strong>diff_utils.test.ts</strong><dd><code>Adjust import paths to include .js extensions.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c0991313f3fcb63fa2a553856b85d7df03e6d99cf98d19277fe689025f89ede1">+2/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>create-pr-from-diffcontents.ts</strong><dd><code>Update import paths and adjust Octokit typing.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b30d5e0c89beb70c0333a025726867aba5db7614911be3c46664bb59d1ab594a">+12/-11</a>&nbsp; </td> </tr> <tr> <td><strong>index.ts</strong><dd><code>Use @awaitjs/express wrap to create AsyncExpressApp.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+7/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>setupAction.ts</strong><dd><code>Update workflow setup action and adjust GitHub API usage.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-88c84a935a854855fb103dbf560f6ed5ea2e73e45750c97b5a3b901a5f9399a2">+5/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.d.ts</strong><dd><code>Add new type definitions for Octokit and AsyncExpressApp.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-370b1e96082f265e191b7aac76caa9feb60d32d56c36a2924725200b3d41f423">+45/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.ts</strong><dd><code>Remove obsolete types; migrate to types.d.ts.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-8d1257d2e60e56e9c02c59b85078e89ad41af60267b02842daf203da3231902f">+0/-6</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Bug fix</strong></td><td><details><summary>4 files</summary><table> <tr> <td><strong>is-github-app-installed.ts</strong><dd><code>Add ts-ignore and adjust GitHub app installation endpoint.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-4b97bd2b461108930999b4af7e47d4763ad1b9490f7352130109c39f5abf4561">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>suggest-pr-changes.ts</strong><dd><code>Refactor types, cast Octokit instance, and update parameters.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b4a862986fd70827b8dabcb3157972bd0d5d507cf9c12e5fbf56f24979d073f3">+22/-15</a>&nbsp; </td> </tr> <tr> <td><strong>check-valid-api-key.ts</strong><dd><code>Refine middleware typing with NextFunction.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c04a6087bbabce916c7547acf14c186caf7af3ec6ff68b7e49102c3fe87e453c">+9/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>track-usage.ts</strong><dd><code>Change Request type to AuthorizedUserReq in usage tracker.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-9248228a33147544ca9b58ff8b9c737b33763dd3e29717c82c38808bb7e34db3">+2/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Configuration changes</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>package.json</strong><dd><code>Upgrade dependencies and refine build/deploy scripts.</code>&nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+8/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>tsconfig.json</strong><dd><code>Modify module, strict, and lib options for NodeNext.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-3532a852c82c88daeed6b57a35cd52c4a2589c909edc756613d67e280ab9b23e">+6/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>1 files</summary><table> <tr> <td><strong>migration.sql</strong><dd><code>Add placeholder migration for rolled back changes.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-98f5513f409a695839ec0bb0ee8e77d3c858e26c30db2113a83973dc1fa46c25">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-03-12 22:30:10 +00:00
export async function suggestPrChanges(
req: AuthorizedUserReq,
res: Response,
): Promise<Response | undefined> {
try {
const {
owner,
repo,
pullNumber,
diffContents,
prCommentFields,
existingTests,
generatedTests,
coverage_message,
2025-08-09 00:26:10 +00:00
replayTests,
concolicTests,
optimizationReview,
feat: Add Line Profiler visualization to webapp (#2268) ## Summary Adds a line-by-line performance profiler visualization to the webapp, allowing users to compare execution times between original and optimized code. ## Changes ### New Line Profiler View - **`LineProfilerView.tsx`**: Side-by-side comparison component showing: - Line-by-line execution times with heat map visualization - Syntax highlighting using `prism-react-renderer` - Collapsible function blocks - Light/dark mode support - Heat legend (cold → hot based on % time) - **`lineProfilerParser.ts`**: Parser utilities for line profiler data: - `parseLineProfilerResults()` - parses markdown table output from Python's line_profiler - `formatTime()` - converts timer units to human-readable format (ns, µs, ms, s) - `getHeatLevel()` - determines heat coloring based on % time - **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for the profiler view ### API Changes - **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR description when profiler data exists - **`github-app.ts`**: Removes line profiler data from metadata when PR is closed/merged - **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line profiler data in staging - **`staging-storage-strategy.ts`**: Interface updates for line profiler fields ### Webapp Integration - **`page.tsx`**: Added "Performance Profile" button (only visible when profiler data exists) - **`action.ts`**: Sends line profiler data when creating PR from webapp Fixes CF-1018 https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov https://github.com/HeshamHM28/my-best-repo/pull/21 linked to https://github.com/codeflash-ai/codeflash/pull/1139 --------- Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 16:36:54 +00:00
originalLineProfiler,
optimizedLineProfiler,
} = req.body
2025-01-06 22:01:20 +00:00
const userId = req.userId
const traceId = req.body.traceId || ""
logger.info(`traceId: ${traceId}`, req)
if (!repo || !owner || !pullNumber || !dependencies.isDiffContentsWellFormed(diffContents)) {
2026-01-19 17:33:57 +00:00
throw validationFailure("Missing or malformed fields: repo, owner, pullNumber, diffContents")
}
const nickname = await dependencies.userNickname(userId)
if (nickname == null) {
2026-01-19 17:33:57 +00:00
throw unauthorized("")
}
const installationOctokit = await dependencies.getInstallationOctokitByOwner(
dependencies.githubApp,
owner,
repo,
userId,
)
if (installationOctokit instanceof Error) {
2026-01-19 17:33:57 +00:00
throw githubInstallationError(installationOctokit.message)
}
const isCollaborator = await dependencies.isUserCollaborator(
installationOctokit,
owner,
repo,
nickname,
)
if (!isCollaborator) {
logger.info(`${nickname} is not a collaborator on ${owner}/${repo}`, req)
2026-01-19 17:33:57 +00:00
throw githubNotCollaborator(`${owner}/${repo}`)
}
logger.info(`${nickname} is a collaborator on ${owner}/${repo}`, req)
// TODO: Remove this background upsert logic after ensuring all old repositories have been saved.
registerRepositoryAndMember(owner, repo, nickname, userId, installationOctokit)
.then(() => {
logger.info(`Background repo and member upsert completed for ${owner}/${repo}`, req)
})
.catch(err => {
2026-01-19 17:33:57 +00:00
logger.errorWithSentry(
`Error in background upsertRepoAndCreateMember`,
2026-01-19 17:33:57 +00:00
req,
{ owner, repo, nickname, userId },
2026-01-19 17:33:57 +00:00
err as Error,
)
})
// Check if approval is required
if (traceId && dependencies.requiresApproval(owner, repo)) {
const optimization = await dependencies.prisma.optimization_features.findUnique({
where: { trace_id: traceId },
select: {
approval_required: true,
approval_status: true,
},
})
if (optimization?.approval_status === "rejected") {
2026-01-19 17:33:57 +00:00
throw optimizationRejected("This optimization request was rejected")
}
if (optimization?.approval_status === "approved") {
2026-01-19 17:33:57 +00:00
logger.info(
`Request ${traceId} was previously approved, continuing with PR suggestion`,
req,
)
const result = await triggerSuggestPrChanges(
owner,
repo,
pullNumber,
diffContents,
prCommentFields,
existingTests,
generatedTests,
coverage_message,
userId,
nickname,
installationOctokit,
2025-08-09 00:26:10 +00:00
replayTests,
concolicTests,
traceId,
optimizationReview,
res,
feat: Add Line Profiler visualization to webapp (#2268) ## Summary Adds a line-by-line performance profiler visualization to the webapp, allowing users to compare execution times between original and optimized code. ## Changes ### New Line Profiler View - **`LineProfilerView.tsx`**: Side-by-side comparison component showing: - Line-by-line execution times with heat map visualization - Syntax highlighting using `prism-react-renderer` - Collapsible function blocks - Light/dark mode support - Heat legend (cold → hot based on % time) - **`lineProfilerParser.ts`**: Parser utilities for line profiler data: - `parseLineProfilerResults()` - parses markdown table output from Python's line_profiler - `formatTime()` - converts timer units to human-readable format (ns, µs, ms, s) - `getHeatLevel()` - determines heat coloring based on % time - **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for the profiler view ### API Changes - **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR description when profiler data exists - **`github-app.ts`**: Removes line profiler data from metadata when PR is closed/merged - **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line profiler data in staging - **`staging-storage-strategy.ts`**: Interface updates for line profiler fields ### Webapp Integration - **`page.tsx`**: Added "Performance Profile" button (only visible when profiler data exists) - **`action.ts`**: Sends line profiler data when creating PR from webapp Fixes CF-1018 https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov https://github.com/HeshamHM28/my-best-repo/pull/21 linked to https://github.com/codeflash-ai/codeflash/pull/1139 --------- Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 16:36:54 +00:00
originalLineProfiler,
optimizedLineProfiler,
)
if (result && typeof result === "object" && "status" in result) {
return result
}
return res.json(result)
} else {
const requestData = {
type: "suggest-pr-changes",
owner,
repo,
pullNumber,
diffContents,
prCommentFields,
existingTests,
generatedTests,
coverage_message,
userId,
optimizationReview,
feat: Add Line Profiler visualization to webapp (#2268) ## Summary Adds a line-by-line performance profiler visualization to the webapp, allowing users to compare execution times between original and optimized code. ## Changes ### New Line Profiler View - **`LineProfilerView.tsx`**: Side-by-side comparison component showing: - Line-by-line execution times with heat map visualization - Syntax highlighting using `prism-react-renderer` - Collapsible function blocks - Light/dark mode support - Heat legend (cold → hot based on % time) - **`lineProfilerParser.ts`**: Parser utilities for line profiler data: - `parseLineProfilerResults()` - parses markdown table output from Python's line_profiler - `formatTime()` - converts timer units to human-readable format (ns, µs, ms, s) - `getHeatLevel()` - determines heat coloring based on % time - **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for the profiler view ### API Changes - **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR description when profiler data exists - **`github-app.ts`**: Removes line profiler data from metadata when PR is closed/merged - **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line profiler data in staging - **`staging-storage-strategy.ts`**: Interface updates for line profiler fields ### Webapp Integration - **`page.tsx`**: Added "Performance Profile" button (only visible when profiler data exists) - **`action.ts`**: Sends line profiler data when creating PR from webapp Fixes CF-1018 https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov https://github.com/HeshamHM28/my-best-repo/pull/21 linked to https://github.com/codeflash-ai/codeflash/pull/1139 --------- Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 16:36:54 +00:00
originalLineProfiler,
optimizedLineProfiler,
}
await dependencies.requestApproval(
traceId,
owner,
repo,
prCommentFields.function_name,
userId,
requestData,
)
return res.status(202).json({
status: "pending_approval",
message:
"This PR suggestion requires approval. You will be notified when it is processed.",
})
}
}
// No approval required, proceed with PR suggestion
const result = await triggerSuggestPrChanges(
owner,
repo,
pullNumber,
diffContents,
prCommentFields,
existingTests,
generatedTests,
coverage_message,
userId,
nickname,
installationOctokit,
2025-08-09 00:26:10 +00:00
replayTests,
concolicTests,
traceId,
optimizationReview,
res,
feat: Add Line Profiler visualization to webapp (#2268) ## Summary Adds a line-by-line performance profiler visualization to the webapp, allowing users to compare execution times between original and optimized code. ## Changes ### New Line Profiler View - **`LineProfilerView.tsx`**: Side-by-side comparison component showing: - Line-by-line execution times with heat map visualization - Syntax highlighting using `prism-react-renderer` - Collapsible function blocks - Light/dark mode support - Heat legend (cold → hot based on % time) - **`lineProfilerParser.ts`**: Parser utilities for line profiler data: - `parseLineProfilerResults()` - parses markdown table output from Python's line_profiler - `formatTime()` - converts timer units to human-readable format (ns, µs, ms, s) - `getHeatLevel()` - determines heat coloring based on % time - **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for the profiler view ### API Changes - **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR description when profiler data exists - **`github-app.ts`**: Removes line profiler data from metadata when PR is closed/merged - **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line profiler data in staging - **`staging-storage-strategy.ts`**: Interface updates for line profiler fields ### Webapp Integration - **`page.tsx`**: Added "Performance Profile" button (only visible when profiler data exists) - **`action.ts`**: Sends line profiler data when creating PR from webapp Fixes CF-1018 https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov https://github.com/HeshamHM28/my-best-repo/pull/21 linked to https://github.com/codeflash-ai/codeflash/pull/1139 --------- Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 16:36:54 +00:00
originalLineProfiler,
optimizedLineProfiler,
)
// Check if this is a quality monitoring repo and send notification
if (traceId && isQualityMonitoringRepo(owner, repo) && result && typeof result === "number") {
const requestData = {
type: "suggest-pr-changes",
owner,
repo,
pullNumber,
diffContents,
prCommentFields,
existingTests,
generatedTests,
coverage_message,
userId,
2025-10-03 19:37:34 +00:00
replayTests,
concolicTests,
optimizationReview,
feat: Add Line Profiler visualization to webapp (#2268) ## Summary Adds a line-by-line performance profiler visualization to the webapp, allowing users to compare execution times between original and optimized code. ## Changes ### New Line Profiler View - **`LineProfilerView.tsx`**: Side-by-side comparison component showing: - Line-by-line execution times with heat map visualization - Syntax highlighting using `prism-react-renderer` - Collapsible function blocks - Light/dark mode support - Heat legend (cold → hot based on % time) - **`lineProfilerParser.ts`**: Parser utilities for line profiler data: - `parseLineProfilerResults()` - parses markdown table output from Python's line_profiler - `formatTime()` - converts timer units to human-readable format (ns, µs, ms, s) - `getHeatLevel()` - determines heat coloring based on % time - **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for the profiler view ### API Changes - **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR description when profiler data exists - **`github-app.ts`**: Removes line profiler data from metadata when PR is closed/merged - **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line profiler data in staging - **`staging-storage-strategy.ts`**: Interface updates for line profiler fields ### Webapp Integration - **`page.tsx`**: Added "Performance Profile" button (only visible when profiler data exists) - **`action.ts`**: Sends line profiler data when creating PR from webapp Fixes CF-1018 https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov https://github.com/HeshamHM28/my-best-repo/pull/21 linked to https://github.com/codeflash-ai/codeflash/pull/1139 --------- Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 16:36:54 +00:00
originalLineProfiler,
optimizedLineProfiler,
}
// Send quality monitoring notification (non-blocking)
sendQualityMonitoringNotification(
traceId,
owner,
repo,
prCommentFields.function_name,
userId,
requestData,
).catch(error => {
logger.error(`Failed to send quality monitoring notification:`, req, {}, error as Error)
})
logger.info(
`Quality monitoring notification triggered for ${owner}/${repo} PR #${pullNumber}`,
req,
)
}
// Don't call res.json(result) if result is already a Response object
if (result && typeof result === "object" && "status" in result) {
return result
}
return res.json(result)
} catch (error: any) {
// Try to fallback to staging if we have a traceId
const traceId = req.body.traceId || ""
if (traceId) {
logger.info(`PR suggestion failed, falling back to staging for traceId: ${traceId}`, req)
try {
const stagingResult = await dependencies.saveStagingReview(
req.body,
req.userId,
req.organizationId,
req.subscriptionInfo,
)
if (stagingResult.status === 200) {
return res.status(200).json({
message: "PR suggestion failed, staging created as fallback",
...stagingResult.data,
})
}
// Handle non-200 staging response - return staging's actual status/error
logger.errorWithSentry(
`Staging fallback returned status ${stagingResult.status}`,
req,
{ reqBody: req.body, userId: req.userId, traceId, stagingResult },
new Error(`Staging fallback returned status ${stagingResult.status}`),
)
return res.status(stagingResult.status).json({
message: "PR suggestion failed and staging fallback also failed",
...stagingResult.data,
})
} catch (stagingError) {
logger.errorWithSentry(
`Staging fallback threw an exception`,
req,
{ reqBody: req.body, userId: req.userId, traceId },
stagingError as Error,
)
return res.status(500).json({
message: "PR suggestion failed and staging fallback threw an error",
error: stagingError instanceof Error ? stagingError.message : String(stagingError),
})
}
2026-01-19 17:33:57 +00:00
}
logger.errorWithSentry(
`Error in /cfapi/suggest-pr-changes: ${error}`,
req,
{ errorMessage: error.message },
error as Error,
)
2026-01-19 17:33:57 +00:00
dependencies.posthog.capture({
distinctId: req.userId,
event: `cfapi-suggest-pr-changes-failed-error`,
properties: { error: error.message, stack: error.stack },
})
2026-01-19 17:33:57 +00:00
throw internalServerError(`Error creating pull request: ${error.message}`)
}
}
2025-05-14 17:38:36 +00:00
export async function triggerSuggestPrChanges(
owner: string,
repo: string,
pullNumber: number,
diffContents: any,
prCommentFields: any,
existingTests: string,
generatedTests: string,
coverage_message: string,
userId: string,
nickname: string,
installationOctokit: any,
2025-08-11 22:15:43 +00:00
replayTests: string = "",
concolicTests: string = "",
traceId: string = "",
optimizationReview: string = "",
res?: Response,
feat: Add Line Profiler visualization to webapp (#2268) ## Summary Adds a line-by-line performance profiler visualization to the webapp, allowing users to compare execution times between original and optimized code. ## Changes ### New Line Profiler View - **`LineProfilerView.tsx`**: Side-by-side comparison component showing: - Line-by-line execution times with heat map visualization - Syntax highlighting using `prism-react-renderer` - Collapsible function blocks - Light/dark mode support - Heat legend (cold → hot based on % time) - **`lineProfilerParser.ts`**: Parser utilities for line profiler data: - `parseLineProfilerResults()` - parses markdown table output from Python's line_profiler - `formatTime()` - converts timer units to human-readable format (ns, µs, ms, s) - `getHeatLevel()` - determines heat coloring based on % time - **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for the profiler view ### API Changes - **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR description when profiler data exists - **`github-app.ts`**: Removes line profiler data from metadata when PR is closed/merged - **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line profiler data in staging - **`staging-storage-strategy.ts`**: Interface updates for line profiler fields ### Webapp Integration - **`page.tsx`**: Added "Performance Profile" button (only visible when profiler data exists) - **`action.ts`**: Sends line profiler data when creating PR from webapp Fixes CF-1018 https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov https://github.com/HeshamHM28/my-best-repo/pull/21 linked to https://github.com/codeflash-ai/codeflash/pull/1139 --------- Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 16:36:54 +00:00
originalLineProfiler: string = "",
optimizedLineProfiler: string = "",
): Promise<Response | number | null> {
try {
const diffContentsMap: Map<string, FileDiffContent> = dependencies.fileDiffsToMap(diffContents)
const { validHunks, invalidHunks } = await dependencies.determineValidHunks(
installationOctokit.rest,
{ owner, repo },
pullNumber,
100,
diffContentsMap,
)
2025-02-21 05:18:55 +00:00
const timestamp = new Date()
.toISOString()
.replace(/:/g, ".")
.replace(/\.\d+Z$/, "")
const newBranchName = `codeflash/optimize-pr${pullNumber}-${timestamp}`
const originalPrData = await installationOctokit.rest.pulls.get({
owner,
repo,
pull_number: pullNumber,
})
// Check if the PR is merged or closed - we can't suggest changes on merged/closed PRs
if (originalPrData.data.merged) {
logger.info(`PR #${pullNumber} is already merged, cannot suggest changes`, {
endpoint: "/cfapi/suggest-pr-changes",
operation: "pr_merged_check",
owner,
repo,
userId,
})
throw unprocessableEntity(
`Cannot suggest changes on merged PR #${pullNumber}. The PR was already merged.`,
)
}
if (originalPrData.data.state === "closed") {
logger.info(`PR #${pullNumber} is closed, cannot suggest changes`, {
endpoint: "/cfapi/suggest-pr-changes",
operation: "pr_closed_check",
owner,
repo,
userId,
})
throw unprocessableEntity(
`Cannot suggest changes on closed PR #${pullNumber}. The PR is no longer open.`,
)
}
2025-02-21 05:18:55 +00:00
const baseBranch = originalPrData.data.head.ref
2026-01-19 17:33:57 +00:00
logger.info(`Attempting to access ref for: ${owner}/${repo}, branch: ${baseBranch}`, {
endpoint: "/cfapi/suggest-pr-changes",
operation: "access_ref",
owner,
repo,
userId,
})
const commitMessage = `Optimize ${prCommentFields.function_name} \n\n${prCommentFields.optimization_explanation}`
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
let hasMultipleHunksInSameFile = false
const hasMultipleFiles = validHunks.size > 1
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
for (const [filePath, hunks] of validHunks.entries()) {
if (hunks.length > 1) {
logger.info(
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
`File ${filePath} has ${hunks.length} hunks, using dependent PR instead of review comments`,
2026-01-19 17:33:57 +00:00
{
endpoint: "/cfapi/suggest-pr-changes",
operation: "multiple_hunks",
owner,
repo,
userId,
},
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
)
hasMultipleHunksInSameFile = true
break
}
}
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
if (hasMultipleFiles) {
logger.info(
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
`Found ${validHunks.size} files with changes, using dependent PR instead of review comments`,
{ endpoint: "/cfapi/suggest-pr-changes", operation: "multiple_files", owner, repo, userId },
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
)
}
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
if (
invalidHunks.size > 0 ||
validHunks.size > 1 ||
hasMultipleFiles ||
hasMultipleHunksInSameFile
) {
logger.info(
`Creating a dependent PR because there are ${invalidHunks.size > 0 ? "invalid hunks" : "multiple valid hunks"}.`,
2026-01-19 17:33:57 +00:00
{
userId,
endpoint: "/cfapi/suggest-pr-changes",
operation: "create_dependent_pr",
owner,
repo,
},
)
logger.info(`Making a new dependent PR...`, {
userId,
endpoint: "/cfapi/suggest-pr-changes",
operation: "create_dependent_pr",
owner,
repo,
})
if (
OptimizationReview.MEDIUM === optimizationReview &&
!dependencies.requiresApproval(owner, repo) &&
traceId
) {
const result = await dependencies.saveStagingReview(
{
owner,
repo,
pullNumber,
baseBranch,
prCommentFields,
existingTests,
generatedTests,
coverage_message,
replayTests,
concolicTests,
optimizationReview,
traceId,
diffContents,
},
userId,
[FEAT] Privacy Mode (#2092) Fixes CF-690 Pull Request Checklist Description - Description of PR: Privacy Mode Feature for Pro Users This PR introduces a Privacy Mode feature that allows paid users (Pro/Enterprise) to control how their code is stored during the optimization review process. Key Changes: 1. Privacy Mode Toggle in Sidebar - Added a new toggle in the dashboard sidebar for Privacy Mode - Only available for Pro/Enterprise users (disabled with upgrade prompt for free users) - Persists user preference in database with localStorage fallback for fast UI 2. Storage Strategy Based on Privacy Setting - Privacy Mode ON: Code is stored exclusively in GitHub branches (never cached in database) - Privacy Mode OFF: Code is temporarily cached in database for faster loading, cleaned up when PR is created 3. Database Changes - Added privacy_mode boolean field to users table (default: false) - Added staging_storage_type field to track storage method 4. API Updates - cf-api now checks user's privacy mode when determining storage strategy - StagingStorageStrategyFactory considers privacy mode alongside tier eligibility - Added getUserPrivacyMode, setUserPrivacyMode, and isUserPaid functions User Experience - Free users see the toggle disabled with "Upgrade to Pro" messaging - Tooltip explains the trade-off: privacy vs. loading speed - Toggle state syncs between localStorage (for instant UI) and database (for persistence) Storage Flow User Request → Check Privacy Mode ├─ Privacy ON + Paid + Valid Repo → Git Branch Storage (GitHub only) └─ Privacy OFF or Free → Plain Text Storage (Database cache) --------- Co-authored-by: ali <mohammed18200118@gmail.com> Co-authored-by: Mohamed Ashraf <ashraf@codeflash.ai>
2026-01-07 20:23:45 +00:00
null, // organizationId - not available in this context
)
if (result.status == 200) {
const commentBody: string = originalPRComment(
prCommentFields,
traceId, //We will send trace Id instead of PRNumber
baseBranch,
optimizationReview,
)
await installationOctokit.rest.issues.createComment({
owner,
repo,
issue_number: pullNumber,
body: commentBody,
})
if (res) {
return res.status(200).json({ message: "staging created successfully" })
}
}
}
const branchCreated = await dependencies.createNewBranchFromDiffContents(
installationOctokit,
owner,
repo,
newBranchName,
baseBranch,
diffContentsMap,
commitMessage,
)
if (!branchCreated) {
throw new Error(`Failed to create branch ${newBranchName}`)
}
const newPrData = await dependencies.createDependentPullRequest(
installationOctokit,
owner,
repo,
pullNumber,
newBranchName,
baseBranch,
prCommentFields,
existingTests,
generatedTests,
coverage_message,
2025-08-09 00:26:10 +00:00
replayTests,
concolicTests,
optimizationReview,
)
logger.info(
`Created new dependent PR #${newPrData.data.number} from branch ${newPrData.data.head.ref}`,
2026-01-19 17:33:57 +00:00
{
userId,
endpoint: "/cfapi/suggest-pr-changes",
operation: "dependent_pr_created",
owner,
repo,
},
)
if (slackNotificationConfig[owner as keyof typeof slackNotificationConfig]?.includes(repo)) {
await dependencies.sendSlackMessage(
2025-01-02 19:12:30 +00:00
`new dependent PR created: ${newPrData.data.html_url} for ${owner}/${repo}`,
)
}
2024-11-14 23:58:34 +00:00
dependencies.posthog?.capture({
distinctId: userId,
event: `cfapi-suggest-pr-changes-success-dependent-pr-created`,
properties: {
owner,
repo,
newPrNumber: newPrData.data.number,
newPrBranch: newPrData.data.head.ref,
2024-06-07 19:26:05 +00:00
PRURL: newPrData.data.html_url,
},
})
if (traceId !== "") {
const pull_request_db = await dependencies.prisma.optimization_features.findUnique({
where: {
trace_id: traceId,
},
select: {
pull_request: true,
},
})
2024-07-20 05:15:57 +00:00
if (pull_request_db) {
2025-01-06 22:01:20 +00:00
if (pull_request_db.pull_request === null || pull_request_db.pull_request === undefined) {
2024-07-20 05:15:57 +00:00
pull_request_db.pull_request = {}
}
cf-api fix (#1512) ### **PR Type** - Enhancement - Bug fix ___ ### **Description** - Update ES module import paths with explicit .js extensions. - Refactor function signatures and type annotations for TypeScript. - Wrap Express app with @awaitjs/express for async support. - Upgrade package configurations and tsconfig settings. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>6 files</summary><table> <tr> <td><strong>diff_utils.test.ts</strong><dd><code>Adjust import paths to include .js extensions.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c0991313f3fcb63fa2a553856b85d7df03e6d99cf98d19277fe689025f89ede1">+2/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>create-pr-from-diffcontents.ts</strong><dd><code>Update import paths and adjust Octokit typing.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b30d5e0c89beb70c0333a025726867aba5db7614911be3c46664bb59d1ab594a">+12/-11</a>&nbsp; </td> </tr> <tr> <td><strong>index.ts</strong><dd><code>Use @awaitjs/express wrap to create AsyncExpressApp.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+7/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>setupAction.ts</strong><dd><code>Update workflow setup action and adjust GitHub API usage.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-88c84a935a854855fb103dbf560f6ed5ea2e73e45750c97b5a3b901a5f9399a2">+5/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.d.ts</strong><dd><code>Add new type definitions for Octokit and AsyncExpressApp.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-370b1e96082f265e191b7aac76caa9feb60d32d56c36a2924725200b3d41f423">+45/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>types.ts</strong><dd><code>Remove obsolete types; migrate to types.d.ts.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-8d1257d2e60e56e9c02c59b85078e89ad41af60267b02842daf203da3231902f">+0/-6</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Bug fix</strong></td><td><details><summary>4 files</summary><table> <tr> <td><strong>is-github-app-installed.ts</strong><dd><code>Add ts-ignore and adjust GitHub app installation endpoint.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-4b97bd2b461108930999b4af7e47d4763ad1b9490f7352130109c39f5abf4561">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>suggest-pr-changes.ts</strong><dd><code>Refactor types, cast Octokit instance, and update parameters.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-b4a862986fd70827b8dabcb3157972bd0d5d507cf9c12e5fbf56f24979d073f3">+22/-15</a>&nbsp; </td> </tr> <tr> <td><strong>check-valid-api-key.ts</strong><dd><code>Refine middleware typing with NextFunction.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-c04a6087bbabce916c7547acf14c186caf7af3ec6ff68b7e49102c3fe87e453c">+9/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>track-usage.ts</strong><dd><code>Change Request type to AuthorizedUserReq in usage tracker.</code></dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-9248228a33147544ca9b58ff8b9c737b33763dd3e29717c82c38808bb7e34db3">+2/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Configuration changes</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>package.json</strong><dd><code>Upgrade dependencies and refine build/deploy scripts.</code>&nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+8/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>tsconfig.json</strong><dd><code>Modify module, strict, and lib options for NodeNext.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-3532a852c82c88daeed6b57a35cd52c4a2589c909edc756613d67e280ab9b23e">+6/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>1 files</summary><table> <tr> <td><strong>migration.sql</strong><dd><code>Add placeholder migration for rolled back changes.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1512/files#diff-98f5513f409a695839ec0bb0ee8e77d3c858e26c30db2113a83973dc1fa46c25">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-03-12 22:30:10 +00:00
;(pull_request_db as PullRequestDB).pull_request.dependent_pr_url =
newPrData.data.html_url
await dependencies.prisma.optimization_features.update({
where: {
trace_id: traceId,
},
data: {
pull_request: pull_request_db.pull_request,
},
})
}
}
feat: Add Line Profiler visualization to webapp (#2268) ## Summary Adds a line-by-line performance profiler visualization to the webapp, allowing users to compare execution times between original and optimized code. ## Changes ### New Line Profiler View - **`LineProfilerView.tsx`**: Side-by-side comparison component showing: - Line-by-line execution times with heat map visualization - Syntax highlighting using `prism-react-renderer` - Collapsible function blocks - Light/dark mode support - Heat legend (cold → hot based on % time) - **`lineProfilerParser.ts`**: Parser utilities for line profiler data: - `parseLineProfilerResults()` - parses markdown table output from Python's line_profiler - `formatTime()` - converts timer units to human-readable format (ns, µs, ms, s) - `getHeatLevel()` - determines heat coloring based on % time - **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for the profiler view ### API Changes - **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR description when profiler data exists - **`github-app.ts`**: Removes line profiler data from metadata when PR is closed/merged - **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line profiler data in staging - **`staging-storage-strategy.ts`**: Interface updates for line profiler fields ### Webapp Integration - **`page.tsx`**: Added "Performance Profile" button (only visible when profiler data exists) - **`action.ts`**: Sends line profiler data when creating PR from webapp Fixes CF-1018 https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov https://github.com/HeshamHM28/my-best-repo/pull/21 linked to https://github.com/codeflash-ai/codeflash/pull/1139 --------- Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 16:36:54 +00:00
await dependencies.updateOptimizationEvent(
traceId,
newPrData.data.id,
prCommentFields,
originalLineProfiler,
optimizedLineProfiler,
)
if (res) {
res.json(newPrData.data.number)
return res
}
return newPrData.data.number
} else {
logger.info(`Creating unified review for a single valid hunk.`, {
userId,
endpoint: "/cfapi/suggest-pr-changes",
operation: "create_unified_review",
owner,
repo,
})
const prCommentBody = dependencies.buildPrCommentBody(
prCommentFields,
existingTests,
generatedTests,
coverage_message,
2025-02-21 05:18:55 +00:00
newBranchName,
2025-08-09 00:26:10 +00:00
replayTests,
concolicTests,
traceId,
{ isUnifiedReview: true, includeHeader: false, isCollapsed: true },
)
let optReviewBadge = generateOptimizationReviewTemplate(optimizationReview)
optReviewBadge &&= `\n\n${optReviewBadge}\n`
const reviewComments = []
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
let foundInvalidHunk = false
combine comment and suggestion for single hunk (#1524) Final Outcome: ![image](https://github.com/user-attachments/assets/38bd4176-28ef-4299-b634-f06044a3436d) Test: 1. Option 1 - https://github.com/codeflash-ai/my-best-repo/pull/248#pullrequestreview-2714641581 [Current] option 2- https://github.com/codeflash-ai/my-best-repo/pull/248#discussion_r2012735000 (Seems to have long data in inline suggestion) Only a 1 liner change from current one [Option 1] ![image](https://github.com/user-attachments/assets/b31bb8c9-e06c-445e-8312-c6a4b442f22b) [Option 2] ![image](https://github.com/user-attachments/assets/ae5ae72e-1e5c-49fc-9e7c-34717cae9070) closes https://linear.app/codeflash-ai/issue/CF-547/make-inline-suggestions-look-better ### **PR Type** - Enhancement ___ ### **Description** - Added logging for branch ref access - Replaced code suggester with unified review creation - Aggregated suggestions into reviewComments list - Updated review response and notification references ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>suggest-pr-changes.ts</strong><dd><code>Unified review creation with enhanced logging</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/suggest-pr-changes.ts <li>Logs branch ref access before review<br> <li> Removes old code suggester calls<br> <li> Creates review with consolidated comments<br> <li> Updates response and slack notification handling </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1524/files#diff-b4a862986fd70827b8dabcb3157972bd0d5d507cf9c12e5fbf56f24979d073f3">+26/-33</a>&nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-03-26 03:55:12 +00:00
for (const [filePath, hunks] of validHunks.entries()) {
for (const hunk of hunks) {
if (hunk.oldStart <= hunk.oldEnd) {
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
const newContent = hunk.newContent.join("\n")
const isLongDiff = newContent.length > 500
let commentBody
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
if (isLongDiff) {
commentBody =
`${prCommentBody}\n\n` +
`<details>\n` +
`<summary>Click to see suggested changes</summary>\n\n` +
`\`\`\`suggestion\n${newContent}\n\`\`\`\n` +
`</details>` +
`\n${optReviewBadge}`
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
} else {
commentBody =
`${prCommentBody}\n\n` +
`\`\`\`suggestion\n${newContent}\n\`\`\`` +
`\n${optReviewBadge}`
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
}
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
reviewComments.push({
path: filePath,
line: hunk.oldEnd,
start_line: hunk.oldStart,
side: "RIGHT",
body: commentBody,
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
})
} else {
logger.warn(
`Found invalid review range for ${filePath}: start_line (${hunk.oldStart}) must be less than or equal to line (${hunk.oldEnd}) with content ${hunk.newContent.join("\n")}`,
2026-01-19 17:33:57 +00:00
{
userId,
endpoint: "/cfapi/suggest-pr-changes",
operation: "invalid_review_range",
owner,
repo,
},
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
)
foundInvalidHunk = true
break
}
combine comment and suggestion for single hunk (#1524) Final Outcome: ![image](https://github.com/user-attachments/assets/38bd4176-28ef-4299-b634-f06044a3436d) Test: 1. Option 1 - https://github.com/codeflash-ai/my-best-repo/pull/248#pullrequestreview-2714641581 [Current] option 2- https://github.com/codeflash-ai/my-best-repo/pull/248#discussion_r2012735000 (Seems to have long data in inline suggestion) Only a 1 liner change from current one [Option 1] ![image](https://github.com/user-attachments/assets/b31bb8c9-e06c-445e-8312-c6a4b442f22b) [Option 2] ![image](https://github.com/user-attachments/assets/ae5ae72e-1e5c-49fc-9e7c-34717cae9070) closes https://linear.app/codeflash-ai/issue/CF-547/make-inline-suggestions-look-better ### **PR Type** - Enhancement ___ ### **Description** - Added logging for branch ref access - Replaced code suggester with unified review creation - Aggregated suggestions into reviewComments list - Updated review response and notification references ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>suggest-pr-changes.ts</strong><dd><code>Unified review creation with enhanced logging</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/suggest-pr-changes.ts <li>Logs branch ref access before review<br> <li> Removes old code suggester calls<br> <li> Creates review with consolidated comments<br> <li> Updates response and slack notification handling </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1524/files#diff-b4a862986fd70827b8dabcb3157972bd0d5d507cf9c12e5fbf56f24979d073f3">+26/-33</a>&nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-03-26 03:55:12 +00:00
}
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
if (foundInvalidHunk) {
break
}
}
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
if (!foundInvalidHunk && reviewComments.length > 0) {
const review = await installationOctokit.rest.pulls.createReview({
owner,
repo,
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
pull_number: pullNumber,
commit_id: originalPrData.data.head.sha,
event: "COMMENT",
comments: reviewComments,
})
logger.info(`Added review comment to PR #${pullNumber}: ${review.data.html_url}`, {
userId,
endpoint: "/cfapi/suggest-pr-changes",
operation: "review_comment_added",
owner,
repo,
})
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
if (
slackNotificationConfig[owner as keyof typeof slackNotificationConfig]?.includes(repo)
) {
await dependencies.sendSlackMessage(
`Suggestions made for ${review.data.html_url} in ${owner}/${repo}`,
)
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
}
dependencies.posthog?.capture({
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
distinctId: userId,
event: `cfapi-suggest-pr-changes-success-suggestions-made`,
properties: {
owner,
repo,
reviewId: review.data.id,
PRURL: review.data.html_url,
},
})
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
if (traceId !== "") {
const pull_request_db = await dependencies.prisma.optimization_features.findUnique({
where: {
trace_id: traceId,
},
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
select: {
pull_request: true,
},
})
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
if (pull_request_db) {
if (
pull_request_db.pull_request === null ||
pull_request_db.pull_request === undefined
) {
pull_request_db.pull_request = {}
}
;(pull_request_db as PullRequestDB).pull_request.review_suggestion_pr_url =
review.data.html_url
await dependencies.prisma.optimization_features.update({
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
where: {
trace_id: traceId,
},
data: {
pull_request: pull_request_db.pull_request,
},
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
})
}
}
feat: Add Line Profiler visualization to webapp (#2268) ## Summary Adds a line-by-line performance profiler visualization to the webapp, allowing users to compare execution times between original and optimized code. ## Changes ### New Line Profiler View - **`LineProfilerView.tsx`**: Side-by-side comparison component showing: - Line-by-line execution times with heat map visualization - Syntax highlighting using `prism-react-renderer` - Collapsible function blocks - Light/dark mode support - Heat legend (cold → hot based on % time) - **`lineProfilerParser.ts`**: Parser utilities for line profiler data: - `parseLineProfilerResults()` - parses markdown table output from Python's line_profiler - `formatTime()` - converts timer units to human-readable format (ns, µs, ms, s) - `getHeatLevel()` - determines heat coloring based on % time - **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for the profiler view ### API Changes - **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR description when profiler data exists - **`github-app.ts`**: Removes line profiler data from metadata when PR is closed/merged - **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line profiler data in staging - **`staging-storage-strategy.ts`**: Interface updates for line profiler fields ### Webapp Integration - **`page.tsx`**: Added "Performance Profile" button (only visible when profiler data exists) - **`action.ts`**: Sends line profiler data when creating PR from webapp Fixes CF-1018 https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov https://github.com/HeshamHM28/my-best-repo/pull/21 linked to https://github.com/codeflash-ai/codeflash/pull/1139 --------- Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 16:36:54 +00:00
await dependencies.updateOptimizationEvent(
traceId,
undefined,
prCommentFields,
originalLineProfiler,
optimizedLineProfiler,
)
if (res) {
res.json(review.data.id)
return res
}
return review.data.id
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
} else {
const reason = foundInvalidHunk
? "invalid line ordering in hunks"
: "no valid review comments could be created"
logger.warn(`Cannot create review due to ${reason}`, {
userId,
endpoint: "/cfapi/suggest-pr-changes",
operation: "cannot_create_review",
owner,
repo,
})
fix sentry & inline suggestions (#1546) ### **PR Type** Enhancement ___ ### **Description** - Introduce Sentry test endpoint for error capture - Integrate Sentry profiling into instrumentation - Update package dependencies for Sentry enhancements - Simplify optimization endpoints routing ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>sentry-test.ts</strong><dd><code>New Sentry test error endpoint added</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/endpoints/sentry-test.ts <li>Added a new endpoint that triggers a test error<br> <li> Captures and logs the error via Sentry </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-a1734472696f2996ba47e868f2d5bf56fa74c8010195afe7731898e6dd7325b9">+15/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Integrated Sentry test router and endpoint adjustments</code>&nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/index.ts <li>Imported and applied the new Sentry test router<br> <li> Refined optimization endpoints list </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-c3e60be1461b6e80f9181080342927fd9df095197e8784ae0ff51daaec8d71d5">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>instrument.ts</strong><dd><code>Improved Sentry instrumentation configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/instrument.ts <li>Enabled Sentry profiling integration<br> <li> Updated sampling rates and cleaned commentary </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-8f041330c6187cfe1b7aaa4598b1a8522d25226f0fe79c30ededa0c3bf95fa8a">+11/-9</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Updated package dependencies for Sentry improvements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> js/cf-api/package.json <li>Upgraded Sentry related packages to version 9<br> <li> Added OpenTelemetry packages for tracing integration </details> </td> <td><a href="https://github.com/codeflash-ai/codeflash-internal/pull/1546/files#diff-53ddfb1f8a02f1231d3d15a2e694ffe1407d2cc01d3e685de5653b67fec571c7">+5/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>
2025-04-02 01:19:57 +00:00
2026-01-19 17:33:57 +00:00
logger.error(`Cannot create review comments due to ${reason}`, {
userId,
endpoint: "/cfapi/suggest-pr-changes",
operation: "cannot_create_review",
owner,
repo,
})
throw unprocessableEntity(
`Cannot create review comments due to ${reason}. Please consider creating a dependent PR instead`,
)
}
}
} catch (error: any) {
2026-01-19 17:33:57 +00:00
// Re-throw AppExceptions to be handled by GlobalExceptionHandler
if (error && typeof error === "object" && "getHttpStatus" in error) {
throw error
}
2026-01-19 17:33:57 +00:00
logger.errorWithSentry(
`Error in triggerSuggestPrChanges: ${error}`,
{
userId,
endpoint: "/cfapi/suggest-pr-changes",
operation: "trigger_suggest_pr_changes",
owner,
repo,
},
{
errorMessage: error.message,
},
error as Error,
)
throw internalServerError(`Error creating pull request: ${error.message}`)
2025-01-06 23:25:54 +00:00
}
2025-02-21 05:18:55 +00:00
}