Conversation
…ilter error pages
Summary of ChangesHello @l1ttps, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request primarily focuses on enhancing the application's statistical capabilities by introducing a 'services' count, which is now integrated into the backend data models, API responses, and the frontend dashboard. Alongside this new feature, significant refactoring was performed on the vulnerabilities API to streamline parameter handling. Minor UI adjustments and code cleanup, including a directory rename, contribute to overall system improvement. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request successfully introduces the 'services' count to the workspace statistics across the application. The changes include backend updates to the statistics entity, DTOs, and service logic, as well as frontend updates to display the new metric on the dashboard. The refactoring of technology counts to use the latest HTTP response is a good improvement for accuracy. I have provided some feedback regarding the efficiency of the database queries in the statistics service and suggested some simplifications.
| .innerJoin( | ||
| 'assetService.httpResponses', | ||
| 'latest_http', | ||
| 'latest_http.id = (SELECT hr.id FROM http_responses hr WHERE hr."assetServiceId" = assetService.id ORDER BY hr."createdAt" DESC LIMIT 1)', |
There was a problem hiding this comment.
Using a correlated subquery in a join condition can lead to significant performance degradation as the subquery is executed for every row in the AssetService table. For large datasets, consider using a more efficient approach such as joining with a subquery that uses DISTINCT ON (PostgreSQL specific) or window functions to identify the latest IDs first.
| .leftJoin('target.workspaceTargets', 'wt') | ||
| .where('wt.workspaceId IN (:...workspaceIds)', { workspaceIds }); | ||
| .where('wt.workspaceId IN (:...workspaceIds)', { workspaceIds }) | ||
| .andWhere('"assetService"."isErrorPage" = false'); |
There was a problem hiding this comment.
It is recommended to use TypeORM property names instead of raw SQL strings with quotes for column names in andWhere clauses. This ensures that the query remains correct even if the naming strategy (e.g., snake_case vs camelCase) changes in the future. Also, consider using innerJoin instead of leftJoin for the related tables since you are filtering by workspaceId in the where clause.
| .andWhere('"assetService"."isErrorPage" = false'); | |
| .andWhere('assetService.isErrorPage = false'); |
No description provided.