Chore/k8s updates dec3 #2505

Merged
mfreeman451 merged 5 commits from refs/pull/2505/head into main 2025-12-04 05:46:54 +00:00
mfreeman451 commented 2025-12-04 04:17:31 +00:00 (Migrated from github.com)
Owner

Imported from GitHub pull request.

Original GitHub pull request: #2055
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2055
Original created: 2025-12-04T04:17:31Z
Original updated: 2025-12-04T05:49:44Z
Original head: carverauto/serviceradar:chore/k8s_updates_dec3
Original base: main
Original merged: 2025-12-04T05:46:54Z by @mfreeman451

User description

IMPORTANT: Please sign the Developer Certificate of Origin

Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include
a DCO sign-off statement indicating the DCO acceptance in one commit message. Here
is an example DCO Signed-off-by line in a commit message:

Signed-off-by: J. Doe <j.doe@domain.com>

Describe your changes

Code checklist before requesting a review

  • I have signed the DCO?
  • The build completes without errors?
  • All tests are passing when running make test?

PR Type

Enhancement, Other


Description

  • Update Next.js, React, and related dependencies to latest versions

    • Next.js 16.0.1 → 16.0.7
    • React 19.2.0 → 19.2.1
    • React-DOM 19.2.0 → 19.2.1
  • Add database sequence privileges migration for AGE graph support

  • Configure CNPG runtime parameters with search_path setting

  • Increase SPIRE memory resource limits (256Mi → 512Mi)

  • Update application image tag to latest commit


Diagram Walkthrough

flowchart LR
  A["Dependency Updates"] --> B["Next.js 16.0.7<br/>React 19.2.1"]
  C["Database Migration"] --> D["Sequence Privileges<br/>for AGE Graphs"]
  E["Configuration Changes"] --> F["CNPG Runtime Params<br/>Memory Limits"]
  B --> G["Updated BUILD.bazel<br/>MODULE.bazel<br/>package.json"]
  D --> H["New SQL Migration<br/>00000000000017"]
  F --> I["Helm Config Updates<br/>values.yaml"]

File Walkthrough

Relevant files
Dependencies
BUILD.bazel
Update npm package versions and hashes                                     

web/BUILD.bazel

  • Updated npm package references for Next.js (16.0.1 → 16.0.7)
  • Updated React and React-DOM package hashes (19.2.0 → 19.2.1)
  • Updated dependent package hashes (lucide-react, react-query, recharts,
    use-debounce)
  • Updated next-runtime-env package hash
+10/-10 
MODULE.bazel
Update Bazel module dependencies and repositories               

MODULE.bazel

  • Updated npm package repository references to match new versions
  • Added new dependencies: @types/d3-hierarchy, @types/dagre,
    d3-hierarchy, dagre
  • Reorganized use_repo declarations for consistency
  • Updated package hashes for React, Next.js, and related libraries
+14/-14 
package.json
Synchronize package.json with dependency updates                 

web/package.json

  • Updated react-dom from 19.2.0 to 19.2.1
  • Updated eslint-config-next from 16.0.1 to 16.0.7
  • Maintains Next.js 16.0.7 and React 19.2.1 versions
+2/-2     
Configuration changes
serviceradar-config.yaml
Add CNPG runtime parameters configuration                               

helm/serviceradar/files/serviceradar-config.yaml

  • Added cnpgRuntime variable initialization from values
  • Added runtime_params section with search_path configuration
  • Configures PostgreSQL search_path for schema resolution
+4/-0     
values.yaml
Update image tag, CNPG params, and resource limits             

helm/serviceradar/values.yaml

  • Updated appTag to new commit hash (sha-a85eb7e...)
  • Added cnpg.runtimeParams.search_path configuration
  • Increased SPIRE memory limits from 256Mi to 512Mi
  • Increased SPIRE memory requests from 128Mi to 256Mi
+5/-3     
Database migration
00000000000017_age_sequence_privileges.up.sql
Add database sequence privileges for AGE graphs                   

pkg/db/cnpg/migrations/00000000000017_age_sequence_privileges.up.sql

  • New migration to grant sequence privileges to serviceradar role
  • Grants USAGE, SELECT, UPDATE on all existing sequences in serviceradar
    schema
  • Sets default privileges for future sequences
  • Includes error handling for missing role
+26/-0   

Imported from GitHub pull request. Original GitHub pull request: #2055 Original author: @mfreeman451 Original URL: https://github.com/carverauto/serviceradar/pull/2055 Original created: 2025-12-04T04:17:31Z Original updated: 2025-12-04T05:49:44Z Original head: carverauto/serviceradar:chore/k8s_updates_dec3 Original base: main Original merged: 2025-12-04T05:46:54Z by @mfreeman451 --- ### **User description** ## IMPORTANT: Please sign the Developer Certificate of Origin Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include a [DCO sign-off statement]( https://developercertificate.org/) indicating the DCO acceptance in one commit message. Here is an example DCO Signed-off-by line in a commit message: ``` Signed-off-by: J. Doe <j.doe@domain.com> ``` ## Describe your changes ## Issue ticket number and link ## Code checklist before requesting a review - [ ] I have signed the DCO? - [ ] The build completes without errors? - [ ] All tests are passing when running make test? ___ ### **PR Type** Enhancement, Other ___ ### **Description** - Update Next.js, React, and related dependencies to latest versions - Next.js 16.0.1 → 16.0.7 - React 19.2.0 → 19.2.1 - React-DOM 19.2.0 → 19.2.1 - Add database sequence privileges migration for AGE graph support - Configure CNPG runtime parameters with search_path setting - Increase SPIRE memory resource limits (256Mi → 512Mi) - Update application image tag to latest commit ___ ### Diagram Walkthrough ```mermaid flowchart LR A["Dependency Updates"] --> B["Next.js 16.0.7<br/>React 19.2.1"] C["Database Migration"] --> D["Sequence Privileges<br/>for AGE Graphs"] E["Configuration Changes"] --> F["CNPG Runtime Params<br/>Memory Limits"] B --> G["Updated BUILD.bazel<br/>MODULE.bazel<br/>package.json"] D --> H["New SQL Migration<br/>00000000000017"] F --> I["Helm Config Updates<br/>values.yaml"] ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>BUILD.bazel</strong><dd><code>Update npm package versions and hashes</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> web/BUILD.bazel <ul><li>Updated npm package references for Next.js (16.0.1 → 16.0.7)<br> <li> Updated React and React-DOM package hashes (19.2.0 → 19.2.1)<br> <li> Updated dependent package hashes (lucide-react, react-query, recharts, <br>use-debounce)<br> <li> Updated next-runtime-env package hash</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/2055/files#diff-1d59088f07bd1569a5a928ec3d13f6a85f7277c23483e5b7fa05a12d5fcaa394">+10/-10</a>&nbsp; </td> </tr> <tr> <td> <details> <summary><strong>MODULE.bazel</strong><dd><code>Update Bazel module dependencies and repositories</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> MODULE.bazel <ul><li>Updated npm package repository references to match new versions<br> <li> Added new dependencies: @types/d3-hierarchy, @types/dagre, <br>d3-hierarchy, dagre<br> <li> Reorganized use_repo declarations for consistency<br> <li> Updated package hashes for React, Next.js, and related libraries</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/2055/files#diff-6136fc12446089c3db7360e923203dd114b6a1466252e71667c6791c20fe6bdc">+14/-14</a>&nbsp; </td> </tr> <tr> <td> <details> <summary><strong>package.json</strong><dd><code>Synchronize package.json with dependency updates</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> web/package.json <ul><li>Updated react-dom from 19.2.0 to 19.2.1<br> <li> Updated eslint-config-next from 16.0.1 to 16.0.7<br> <li> Maintains Next.js 16.0.7 and React 19.2.1 versions</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/2055/files#diff-b861012a5dd72b8a9f3281b7cf09f5a779c98569d040b1bbc1db50f1b15e7cce">+2/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Configuration changes</strong></td><td><table> <tr> <td> <details> <summary><strong>serviceradar-config.yaml</strong><dd><code>Add CNPG runtime parameters configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> helm/serviceradar/files/serviceradar-config.yaml <ul><li>Added cnpgRuntime variable initialization from values<br> <li> Added runtime_params section with search_path configuration<br> <li> Configures PostgreSQL search_path for schema resolution</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/2055/files#diff-b8c8d2484103b11c396bc60d290c81df63c30a0f81103eceb5852a17e1d2b5e3">+4/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>values.yaml</strong><dd><code>Update image tag, CNPG params, and resource limits</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> helm/serviceradar/values.yaml <ul><li>Updated appTag to new commit hash (sha-a85eb7e...)<br> <li> Added cnpg.runtimeParams.search_path configuration<br> <li> Increased SPIRE memory limits from 256Mi to 512Mi<br> <li> Increased SPIRE memory requests from 128Mi to 256Mi</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/2055/files#diff-d4449c7cb70362554b274f81eae5a4b81a8e81df494282e383d1b7ea3871c452">+5/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Database migration</strong></td><td><table> <tr> <td> <details> <summary><strong>00000000000017_age_sequence_privileges.up.sql</strong><dd><code>Add database sequence privileges for AGE graphs</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> pkg/db/cnpg/migrations/00000000000017_age_sequence_privileges.up.sql <ul><li>New migration to grant sequence privileges to serviceradar role<br> <li> Grants USAGE, SELECT, UPDATE on all existing sequences in serviceradar <br>schema<br> <li> Sets default privileges for future sequences<br> <li> Includes error handling for missing role</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/2055/files#diff-a6399d049923761c1a0078fd71704b21a8a15702e7ff86cf7c7306fbd61eefa6">+26/-0</a>&nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> </details> ___
qodo-code-review[bot] commented 2025-12-04 04:18:08 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2055#issuecomment-3610017414
Original created: 2025-12-04T04:18:08Z

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
No audit logs: The migration grants sequence privileges but introduces no logging of this critical
permission change event.

Referred Code
-- Ensure the application role can advance AGE graph sequences.
-- Grants usage/select/update on all sequences in the serviceradar schema and
-- sets defaults for future sequences.
DO $$
DECLARE
    seq record;
BEGIN
    IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'serviceradar') THEN
        RAISE NOTICE 'Role serviceradar not found; skipping sequence grants';
        RETURN;
    END IF;

    FOR seq IN
        SELECT schemaname, sequencename
        FROM pg_sequences
        WHERE schemaname = 'serviceradar'
    LOOP
        EXECUTE format(
            'GRANT USAGE, SELECT, UPDATE ON SEQUENCE %I.%I TO serviceradar',
            seq.schemaname, seq.sequencename
        );


 ... (clipped 5 lines)

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Limited error handling: The DO block performs grants without exception handling or rollback strategy, which may
leave partial state if an error occurs.

Referred Code
DO $$
DECLARE
    seq record;
BEGIN
    IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'serviceradar') THEN
        RAISE NOTICE 'Role serviceradar not found; skipping sequence grants';
        RETURN;
    END IF;

    FOR seq IN
        SELECT schemaname, sequencename
        FROM pg_sequences
        WHERE schemaname = 'serviceradar'
    LOOP
        EXECUTE format(
            'GRANT USAGE, SELECT, UPDATE ON SEQUENCE %I.%I TO serviceradar',
            seq.schemaname, seq.sequencename
        );
    END LOOP;

    ALTER DEFAULT PRIVILEGES IN SCHEMA serviceradar


 ... (clipped 2 lines)

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
- Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment. Original author: @qodo-code-review[bot] Original URL: https://github.com/carverauto/serviceradar/pull/2055#issuecomment-3610017414 Original created: 2025-12-04T04:18:08Z --- ## PR Compliance Guide 🔍 <!-- https://github.com/carverauto/serviceradar/commit/fb17aad5b6d6b9a859769361edce47e32ce77072 --> Below is a summary of compliance checks for this PR:<br> <table><tbody><tr><td colspan='2'><strong>Security Compliance</strong></td></tr> <tr><td>🟢</td><td><details><summary><strong>No security concerns identified</strong></summary> No security vulnerabilities detected by AI analysis. Human verification advised for critical code. </details></td></tr> <tr><td colspan='2'><strong>Ticket Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary>🎫 <strong>No ticket provided </strong></summary> - [ ] Create ticket/issue <!-- /create_ticket --create_ticket=true --> </details></td></tr> <tr><td colspan='2'><strong>Codebase Duplication Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary><strong>Codebase context is not defined </strong></summary> Follow the <a href='https://qodo-merge-docs.qodo.ai/core-abilities/rag_context_enrichment/'>guide</a> to enable codebase context checks. </details></td></tr> <tr><td colspan='2'><strong>Custom Compliance</strong></td></tr> <tr><td rowspan=4>🟢</td><td> <details><summary><strong>Generic: Meaningful Naming and Self-Documenting Code</strong></summary><br> **Objective:** Ensure all identifiers clearly express their purpose and intent, making code <br>self-documenting<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Secure Error Handling</strong></summary><br> **Objective:** To prevent the leakage of sensitive system information through error messages while <br>providing sufficient detail for internal debugging.<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Secure Logging Practices</strong></summary><br> **Objective:** To ensure logs are useful for debugging and auditing without exposing sensitive <br>information like PII, PHI, or cardholder data.<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Security-First Input Validation and Data Handling</strong></summary><br> **Objective:** Ensure all data inputs are validated, sanitized, and handled securely to prevent <br>vulnerabilities<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td rowspan=2>⚪</td> <td><details> <summary><strong>Generic: Comprehensive Audit Trails</strong></summary><br> **Objective:** To create a detailed and reliable record of critical system actions for security analysis <br>and compliance.<br> **Status:** <br><a href='https://github.com/carverauto/serviceradar/pull/2055/files#diff-a6399d049923761c1a0078fd71704b21a8a15702e7ff86cf7c7306fbd61eefa6R1-R26'><strong>No audit logs</strong></a>: The migration grants sequence privileges but introduces no logging of this critical <br>permission change event.<br> <details open><summary>Referred Code</summary> ```sql -- Ensure the application role can advance AGE graph sequences. -- Grants usage/select/update on all sequences in the serviceradar schema and -- sets defaults for future sequences. DO $$ DECLARE seq record; BEGIN IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'serviceradar') THEN RAISE NOTICE 'Role serviceradar not found; skipping sequence grants'; RETURN; END IF; FOR seq IN SELECT schemaname, sequencename FROM pg_sequences WHERE schemaname = 'serviceradar' LOOP EXECUTE format( 'GRANT USAGE, SELECT, UPDATE ON SEQUENCE %I.%I TO serviceradar', seq.schemaname, seq.sequencename ); ... (clipped 5 lines) ``` </details> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td><details> <summary><strong>Generic: Robust Error Handling and Edge Case Management</strong></summary><br> **Objective:** Ensure comprehensive error handling that provides meaningful context and graceful <br>degradation<br> **Status:** <br><a href='https://github.com/carverauto/serviceradar/pull/2055/files#diff-a6399d049923761c1a0078fd71704b21a8a15702e7ff86cf7c7306fbd61eefa6R4-R26'><strong>Limited error handling</strong></a>: The DO block performs grants without exception handling or rollback strategy, which may <br>leave partial state if an error occurs.<br> <details open><summary>Referred Code</summary> ```sql DO $$ DECLARE seq record; BEGIN IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'serviceradar') THEN RAISE NOTICE 'Role serviceradar not found; skipping sequence grants'; RETURN; END IF; FOR seq IN SELECT schemaname, sequencename FROM pg_sequences WHERE schemaname = 'serviceradar' LOOP EXECUTE format( 'GRANT USAGE, SELECT, UPDATE ON SEQUENCE %I.%I TO serviceradar', seq.schemaname, seq.sequencename ); END LOOP; ALTER DEFAULT PRIVILEGES IN SCHEMA serviceradar ... (clipped 2 lines) ``` </details> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td align="center" colspan="2"> - [ ] Update <!-- /compliance --update_compliance=true --> </td></tr></tbody></table> <details><summary>Compliance status legend</summary> 🟢 - Fully Compliant<br> 🟡 - Partial Compliant<br> 🔴 - Not Compliant<br> ⚪ - Requires Further Human Verification<br> 🏷️ - Compliance label<br> </details>
qodo-code-review[bot] commented 2025-12-04 04:19:04 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2055#issuecomment-3610019808
Original created: 2025-12-04T04:19:04Z

PR Code Suggestions

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Resolve duplicate dependency versions

Consolidate the two different major versions of zod (v3 and v4) to a single
version to avoid potential runtime errors and type mismatches.

web/pnpm-lock.yaml [3064-3068]

 ...
 zod@3.25.28:
   resolution: {integrity: sha512-/nt/67WYKnr5by3YS7LroZJbtcCBurDKKPBPWWzaxvVCGuG/NOsiKkrjoOhI8mJ+SQUXEbUzeB3S+6XDUEEj7Q==}
-
-zod@4.1.13:
-  resolution: {integrity: sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig==}
 ...

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies that two major versions of zod are present in the lockfile, which can cause critical runtime issues and type mismatches, and provides a correct solution.

High
Fix incorrect PostgreSQL search path

Remove the quotes and escaping around $user in the search_path configuration to
ensure it correctly resolves to the current session user's schema.

helm/serviceradar/values.yaml [105-106]

 runtimeParams:
-  search_path: "public,ag_catalog,\\\"$user\\\""
+  search_path: "public,ag_catalog,$user"
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a critical bug in the PostgreSQL search_path configuration that would cause runtime failures by treating $user as a literal schema name instead of a special placeholder.

High
General
Improve database migration performance

Replace the loop that grants privileges to each sequence individually with a
single GRANT ... ON ALL SEQUENCES IN SCHEMA ... statement for better performance
and simplicity.

pkg/db/cnpg/migrations/00000000000017_age_sequence_privileges.up.sql [13-22]

-FOR seq IN
-    SELECT schemaname, sequencename
-    FROM pg_sequences
-    WHERE schemaname = 'serviceradar'
-LOOP
-    EXECUTE format(
-        'GRANT USAGE, SELECT, UPDATE ON SEQUENCE %I.%I TO serviceradar',
-        seq.schemaname, seq.sequencename
-    );
-END LOOP;
+GRANT USAGE, SELECT, UPDATE ON ALL SEQUENCES IN SCHEMA serviceradar TO serviceradar;
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly proposes a more efficient and readable way to grant privileges on all sequences using a single SQL statement, replacing a less efficient loop.

Low
  • Update
Imported GitHub PR comment. Original author: @qodo-code-review[bot] Original URL: https://github.com/carverauto/serviceradar/pull/2055#issuecomment-3610019808 Original created: 2025-12-04T04:19:04Z --- ## PR Code Suggestions ✨ <!-- fb17aad --> Explore these optional code suggestions: <table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=2>Possible issue</td> <td> <details><summary>Resolve duplicate dependency versions</summary> ___ **Consolidate the two different major versions of <code>zod</code> (v3 and v4) to a single <br>version to avoid potential runtime errors and type mismatches.** [web/pnpm-lock.yaml [3064-3068]](https://github.com/carverauto/serviceradar/pull/2055/files#diff-f11bfba22b3604b3a7b52e44e10f4eae265b030b5682714833ba689eda12a27bR3064-R3068) ```diff ... zod@3.25.28: resolution: {integrity: sha512-/nt/67WYKnr5by3YS7LroZJbtcCBurDKKPBPWWzaxvVCGuG/NOsiKkrjoOhI8mJ+SQUXEbUzeB3S+6XDUEEj7Q==} - -zod@4.1.13: - resolution: {integrity: sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig==} ... ``` `[To ensure code accuracy, apply this suggestion manually]` <details><summary>Suggestion importance[1-10]: 9</summary> __ Why: The suggestion correctly identifies that two major versions of `zod` are present in the lockfile, which can cause critical runtime issues and type mismatches, and provides a correct solution. </details></details></td><td align=center>High </td></tr><tr><td> <details><summary>Fix incorrect PostgreSQL search path</summary> ___ **Remove the quotes and escaping around <code>$user</code> in the <code>search_path</code> configuration to <br>ensure it correctly resolves to the current session user's schema.** [helm/serviceradar/values.yaml [105-106]](https://github.com/carverauto/serviceradar/pull/2055/files#diff-d4449c7cb70362554b274f81eae5a4b81a8e81df494282e383d1b7ea3871c452R105-R106) ```diff runtimeParams: - search_path: "public,ag_catalog,\\\"$user\\\"" + search_path: "public,ag_catalog,$user" ``` - [ ] **Apply / Chat** <!-- /improve --apply_suggestion=1 --> <details><summary>Suggestion importance[1-10]: 9</summary> __ Why: The suggestion correctly identifies a critical bug in the PostgreSQL `search_path` configuration that would cause runtime failures by treating `$user` as a literal schema name instead of a special placeholder. </details></details></td><td align=center>High </td></tr><tr><td rowspan=1>General</td> <td> <details><summary>Improve database migration performance</summary> ___ **Replace the loop that grants privileges to each sequence individually with a <br>single <code>GRANT ... ON ALL SEQUENCES IN SCHEMA ...</code> statement for better performance <br>and simplicity.** [pkg/db/cnpg/migrations/00000000000017_age_sequence_privileges.up.sql [13-22]](https://github.com/carverauto/serviceradar/pull/2055/files#diff-a6399d049923761c1a0078fd71704b21a8a15702e7ff86cf7c7306fbd61eefa6R13-R22) ```diff -FOR seq IN - SELECT schemaname, sequencename - FROM pg_sequences - WHERE schemaname = 'serviceradar' -LOOP - EXECUTE format( - 'GRANT USAGE, SELECT, UPDATE ON SEQUENCE %I.%I TO serviceradar', - seq.schemaname, seq.sequencename - ); -END LOOP; +GRANT USAGE, SELECT, UPDATE ON ALL SEQUENCES IN SCHEMA serviceradar TO serviceradar; ``` - [ ] **Apply / Chat** <!-- /improve --apply_suggestion=2 --> <details><summary>Suggestion importance[1-10]: 6</summary> __ Why: The suggestion correctly proposes a more efficient and readable way to grant privileges on all sequences using a single SQL statement, replacing a less efficient loop. </details></details></td><td align=center>Low </td></tr> <tr><td align="center" colspan="2"> - [ ] Update <!-- /improve_multi --more_suggestions=true --> </td><td></td></tr></tbody></table>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carverauto/serviceradar!2505
No description provided.