Skip to content

Conversation

@WcaleNieWolny
Copy link
Contributor

@WcaleNieWolny WcaleNieWolny commented Nov 18, 2025

Summary by CodeRabbit

  • New Features

    • Added /upload_link and /ok endpoints to the API.
  • Chores

    • Switched authentication and permission checks to a PostgreSQL-backed flow.
    • Improved API key controls and finer-grained permission checks, including expanded rights hierarchy and stricter app/org ownership validation.
    • Ensured DB client lifecycle is closed reliably after requests.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

Walkthrough

Replace Supabase RPC lookups with PostgreSQL/Drizzle queries and clients; add Postgres enums/tables for API keys and org users; introduce pg-backed utilities for user/app/permission resolution; extend middleware to optionally use Postgres; update file routes to use pg helpers, manage PG client lifecycle, and add two routes.

Changes

Cohort / File(s) Summary
Postgres schema
supabase/functions/_backend/utils/postgres_schema.ts
Add key_mode and user_min_right enums and new tables apikeys and org_users.
PG utilities
supabase/functions/_backend/utils/pg_files.ts
New pg/drizzle helpers: getUserIdFromApikey, getOwnerOrgByAppId, checkMinRightsPg, hasAppRightApikeyPg, getAppByAppIdPg — permission hierarchy checks, apikey scope enforcement, and logging.
Middleware enhancements
supabase/functions/_backend/utils/hono_middleware.ts
middlewareKey gains usePostgres = false; add checkKeyPg and checkKeyByIdPg; conditional Drizzle/PG client flow with lifecycle handling and error logging; map PG rows to expected shapes.
Backend routing & permissions
supabase/functions/_backend/private/files.ts
Replace Supabase RPCs with pg helpers (getUserIdFromApikey, hasAppRightApikeyPg, getAppByAppIdPg), obtain/close PG client via getPgClient/closeClient and backgroundTask, adjust middlewareKey calls for write routes, and add /upload_link and /ok routes.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Router
    participant PGService as Postgres/Drizzle
    participant PGClient as PG Client
    participant OldFlow as Supabase_RPC

    Client->>Router: Request + API Key

    alt usePostgres = false
        Router->>OldFlow: get_user_id RPC / hasAppRight / query app
        OldFlow-->>Router: user_id / permission / app
    else usePostgres = true
        Router->>PGService: getPgClient()
        PGService-->>Router: PGClient

        Router->>PGService: getUserIdFromApikey(apikey)
        PGService->>PGClient: query apikeys
        PGClient-->>PGService: apikey row
        PGService-->>Router: user_id

        Router->>PGService: hasAppRightApikeyPg(appId, right, ...)
        PGService->>PGClient: query apikeys, org_users, apps
        PGClient-->>PGService: rights result
        PGService-->>Router: permission boolean

        Router->>PGService: getAppByAppIdPg(appId)
        PGService->>PGClient: query apps
        PGClient-->>PGService: app record
        PGService-->>Router: app details

        Router->>PGService: closeClient(PGClient) [finally]
        PGService-->>Router: closed
    end

    Router-->>Client: Response (200 / 400 / 403 / 404)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay special attention to:
    • Permission hierarchy and mapping in checkMinRightsPg
    • apikey scope enforcement (limited_to_orgs, limited_to_apps) in hasAppRightApikeyPg
    • PG client acquisition/closure and backgroundTask usage across middleware and handlers
    • Consistency of mapped shapes returned from Drizzle rows vs. previous Supabase shapes
    • Error logging and handling paths (especially try/catch/finally blocks)

Poem

🐇 I hopped from RPC to rows so bright,
Drizzle traced keys in morning light,
Rights and apps in tidy view,
Finally closed the client too,
A rabbit cheers: new routes take flight.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is completely empty, missing all required sections including Summary, Test plan, and Checklist information specified in the repository template. Add a comprehensive description following the template: include a summary of changes, test plan with reproduction steps, and mark relevant checklist items. Note the scope of these changes is substantial and requires detailed documentation.
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'fix: delta updload' contains a typo ('updload' instead of 'upload') and is too vague to clearly describe the substantial changes made to the codebase. Correct the typo and provide a more specific title that describes the main change, such as 'fix: migrate file operations to PostgreSQL-based lookups' or 'fix: replace Supabase RPC with direct PostgreSQL queries'.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_delta_upload

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63ed16c and 4a39a91.

📒 Files selected for processing (1)
  • supabase/functions/_backend/utils/pg_files.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • supabase/functions/_backend/utils/pg_files.ts

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
supabase/functions/_backend/utils/hono_middleware.ts (1)

198-291: middlewareKey PG path looks solid; consider reusing the PG client for subkeys

The new usePostgres branch in middlewareKey correctly:

  • Reads the key from capgkey/authorization.
  • Uses checkKeyPg/checkKeyByIdPg for main key and subkeys.
  • Closes the pools via pgClient.end().catch(...) in finally.
  • Preserves the existing behavior for the Supabase path.

One minor optimization to consider later: reuse the same pgClient/drizzleClient for both the main key and the subkey, instead of creating a second pool for subkey lookups. That would reduce connection churn per request at the cost of slightly more plumbing.

supabase/functions/_backend/utils/pg_files.ts (2)

105-117: Clean up rightHierarchy keys and keep them in sync with enum values

The structure of rightHierarchy matches the comment and its intended ordering, but ESLint is complaining about quoted property names, and this map must stay aligned with the actual user_min_right enum values.

You can both satisfy the linter and keep the mapping explicit by removing the unnecessary quotes:

-    const rightHierarchy: Record<Database['public']['Enums']['user_min_right'], number> = {
-      'invite_read': 0,
-      'invite_upload': 1,
-      'invite_write': 2,
-      'invite_admin': 3,
-      'invite_super_admin': 3.5,
-      'read': 4,
-      'upload': 5,
-      'write': 6,
-      'admin': 7,
-      'super_admin': 8,
-    }
+    const rightHierarchy: Record<Database['public']['Enums']['user_min_right'], number> = {
+      invite_read: 0,
+      invite_upload: 1,
+      invite_write: 2,
+      invite_admin: 3,
+      invite_super_admin: 3.5,
+      read: 4,
+      upload: 5,
+      write: 6,
+      admin: 7,
+      super_admin: 8,
+    }

Combined with the enum alignment comment in postgres_schema.ts, this keeps the rights ordering consistent across DB, types, and application logic while clearing the style/quote-props warning.


295-295: Remove trailing blank line to satisfy no-multiple-empty-lines

ESLint is flagging an extra empty line at the end of this file. Trimming the trailing blank line so the file ends right after the closing brace will clear the style/no-multiple-empty-lines warning.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 474266e and 274d83a.

📒 Files selected for processing (4)
  • supabase/functions/_backend/private/files.ts (2 hunks)
  • supabase/functions/_backend/utils/hono_middleware.ts (4 hunks)
  • supabase/functions/_backend/utils/pg_files.ts (1 hunks)
  • supabase/functions/_backend/utils/postgres_schema.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
supabase/functions/_backend/utils/pg_files.ts (3)
supabase/functions/_backend/utils/pg.ts (2)
  • getDrizzleClient (146-148)
  • logPgError (151-199)
supabase/functions/_backend/utils/logging.ts (1)
  • cloudlog (3-15)
supabase/functions/_backend/utils/supabase.ts (1)
  • hasAppRight (204-217)
supabase/functions/_backend/utils/hono_middleware.ts (4)
supabase/functions/_backend/utils/pg.ts (2)
  • getDrizzleClient (146-148)
  • logPgError (151-199)
supabase/functions/_backend/utils/hono.ts (2)
  • honoFactory (49-49)
  • quickError (224-237)
supabase/functions/_backend/utils/logging.ts (1)
  • cloudlog (3-15)
supabase/functions/_backend/utils/supabase.ts (3)
  • checkKey (999-1019)
  • supabaseAdmin (74-83)
  • checkKeyById (1021-1039)
supabase/functions/_backend/private/files.ts (3)
supabase/functions/_backend/utils/pg.ts (3)
  • getPgClient (115-144)
  • getDrizzleClient (146-148)
  • closeClient (201-206)
supabase/functions/_backend/utils/pg_files.ts (3)
  • getUserIdFromApikey (12-43)
  • hasAppRightApikeyPg (178-267)
  • getAppByAppIdPg (272-294)
supabase/functions/_backend/utils/hono_middleware.ts (1)
  • middlewareKey (198-292)
🪛 ESLint
supabase/functions/_backend/utils/pg_files.ts

[error] 5-5: Imports "getDrizzleClient" are only used as type.

(ts/consistent-type-imports)

🪛 GitHub Actions: Run tests
supabase/functions/_backend/utils/pg_files.ts

[error] 5-5: ts/consistent-type-imports: Imports 'getDrizzleClient' are only used as type.


[error] 107-116: style/quote-props: Properties shouldn't be quoted as all quotes are redundant.


[error] 295-295: style/no-multiple-empty-lines: Too many blank lines at the end of file. Max of 0 allowed.

🔇 Additional comments (5)
supabase/functions/_backend/utils/postgres_schema.ts (1)

108-129: New apikeys and org_users schemas look consistent with usages

The apikeys and org_users table definitions (IDs as bigint, nullable timestamps with defaultNow(), and array fields for limited_to_orgs/limited_to_apps) match how they're consumed in pg_files.ts and hono_middleware.ts (array checks, optional dates, nullable user_right etc.). I don’t see functional issues here.

supabase/functions/_backend/private/files.ts (1)

460-471: Route wiring to PG-backed key checks looks coherent

Using middlewareKey(['all', 'write', 'upload'], true) on the upload-related routes (POST, GET for /upload, and PATCH) lines them up with the new PG-backed API key verification, while leaving /read as-is. The sequence middlewareKey → setKeyFrom* → checkWriteAppAccess → upload/getHandler is consistent.

supabase/functions/_backend/utils/hono_middleware.ts (1)

29-113: PG-based checkKey helpers mirror Supabase behavior correctly

checkKeyPg and checkKeyByIdPg replicate the existing Supabase-based checks: they filter by key/id and allowed mode, return a normalized apikeys row (ISO timestamps, array defaults), and log any PG errors via logPgError. This should be a drop-in replacement for the Supabase RPC path.

supabase/functions/_backend/utils/pg_files.ts (2)

174-267: PG rights checks and scoped API key restrictions look correct

The combination of checkMinRightsPg and hasAppRightApikeyPg is well-structured:

  • checkMinRightsPg:

    • Short-circuits on missing userId.
    • Fetches all org_users rows for the (orgId, userId) pair.
    • Applies an ordered rightHierarchy over org-wide, app-wide, and channel-specific scopes with clear logging and early return on success.
  • hasAppRightApikeyPg:

    • Resolves orgId via getOwnerOrgByAppId.
    • Enforces limited_to_orgs and limited_to_apps constraints before checking rights.
    • Delegates to checkMinRightsPg and logs the final decision.

This is a solid replacement for the previous RPC-based helpers and should behave predictably under different org/app scoping combinations.


1-6: Fix getDrizzleClient import to satisfy ts/consistent-type-imports

ESLint is right that getDrizzleClient is only used in type positions (ReturnType<typeof getDrizzleClient>), so importing it as a value is unnecessary and violates ts/consistent-type-imports.

You can avoid a value import entirely by introducing a local type alias based on a type-only import expression, then using that alias in your function signatures:

-import type { Context } from 'hono'
-import type { Database } from './supabase.types.ts'
-import { and, eq } from 'drizzle-orm'
-import { cloudlog } from './logging.ts'
-import { getDrizzleClient, logPgError } from './pg.ts'
-import * as schema from './postgres_schema.ts'
+import type { Context } from 'hono'
+import type { Database } from './supabase.types.ts'
+import { and, eq } from 'drizzle-orm'
+import { cloudlog } from './logging.ts'
+import { logPgError } from './pg.ts'
+import * as schema from './postgres_schema.ts'
+
+type DrizzleClient = ReturnType<typeof import('./pg.ts').getDrizzleClient>

Then update the parameter types:

-  drizzleClient: ReturnType<typeof getDrizzleClient>,
+  drizzleClient: DrizzleClient,

and likewise in getOwnerOrgByAppId, checkMinRightsPg, hasAppRightApikeyPg, and getAppByAppIdPg (lines 52, 81, 184, 275). This keeps type safety without pulling the function into the runtime bundle.

Comment on lines +6 to +17
export const keyModePgEnum = pgEnum('key_mode', ['read', 'write', 'all', 'upload'])
export const userMinRightPgEnum = pgEnum('user_min_right', [
'invite_read',
'invite_upload',
'invite_write',
'invite_admin',
'read',
'upload',
'write',
'admin',
'super_admin',
])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Align user_min_right enum with rights hierarchy

userMinRightPgEnum defines 9 values and omits 'invite_super_admin', while checkMinRightsPg in pg_files.ts includes invite_super_admin in its rightHierarchy. That mismatch can cause drift between the DB enum, Drizzle schema, and your rights logic.

Consider explicitly aligning them, e.g. by adding the missing value here (if it exists in the DB) so that Drizzle, Database['public']['Enums']['user_min_right'], and rightHierarchy stay in sync:

 export const userMinRightPgEnum = pgEnum('user_min_right', [
   'invite_read',
   'invite_upload',
   'invite_write',
   'invite_admin',
+  'invite_super_admin',
   'read',
   'upload',
   'write',
   'admin',
   'super_admin',
 ])

If invite_super_admin is not a real right anymore, then the alternative is to remove it from rightHierarchy and from the Supabase-generated enum type instead of adding it here.



🏁 Script executed:

#!/bin/bash
# Search for rightHierarchy in pg_files.ts
echo "=== Searching for rightHierarchy in pg_files.ts ==="
rg -n "rightHierarchy" --type=ts -A 15

# Search for userMinRightPgEnum in postgres_schema.ts
echo -e "\n=== Searching for userMinRightPgEnum definition ==="
rg -n "userMinRightPgEnum" --type=ts -B 2 -A 12

# Search for all 'invite_super_admin' references in the codebase
echo -e "\n=== Searching for 'invite_super_admin' references ==="
rg -n "invite_super_admin" --type=ts

# Check for hono_middleware.ts and any enum usage there
echo -e "\n=== Searching for rights-related logic in hono_middleware.ts ==="
rg -n "hono_middleware" --type=ts -l | head -5
fd "hono_middleware" --type=f

# Search for user rights or role hierarchy comments/definitions
echo -e "\n=== Searching for user_min_right enum in database or migration files ==="
fd "migration\|schema\|sql" --type=f | head -10

Length of output: 5437


🏁 Script executed:

#!/bin/bash
# Search for rightHierarchy in pg_files.ts
echo "=== Searching for rightHierarchy definition ==="
rg -n "rightHierarchy" --type=ts -A 15

# Search for userMinRightPgEnum in postgres_schema.ts
echo -e "\n=== Searching for userMinRightPgEnum definition ==="
rg -n "userMinRightPgEnum" --type=ts -B 2 -A 12

# Search for all 'invite_super_admin' references in the codebase
echo -e "\n=== Searching for 'invite_super_admin' references ==="
rg -n "invite_super_admin" --type=ts

# Search for user_min_right in schema files
echo -e "\n=== Searching for user_min_right references ==="
rg -n "user_min_right" --type=ts -B 2 -A 2

Length of output: 9787



🏁 Script executed:

#!/bin/bash
# Check context around line 21 in organization/members/get.ts
echo "=== Context around 'invite_super_admin' in organization/members/get.ts ==="
cat supabase/functions/_backend/public/organization/members/get.ts | head -30

# Search for any SQL or migration files that might define user_min_right enum
echo -e "\n=== Searching for SQL or Supabase schema files ==="
fd -e sql -e pgsql || echo "No SQL files found"
fd "types\|index" --type=f -path "*supabase*" | grep -E "(types|index)" | head -5

# Check if there are any type definitions auto-generated from Supabase
echo -e "\n=== Searching for Database type definitions ==="
rg -n "type Database" --type=ts | head -5
rg -n "user_min_right" --type=ts -B 1 -A 1 | grep -E "(enum|type|interface)" | head -10

Length of output: 5561


🏁 Script executed:

#!/bin/bash
# Check context around line 21 in organization/members/get.ts
echo "=== Context around 'invite_super_admin' in organization/members/get.ts ==="
cat supabase/functions/_backend/public/organization/members/get.ts | head -35

# Check if there are Supabase generated types
echo -e "\n=== Searching for Database type imports ==="
rg -n "from.*Database\|Database\['public'\]\['Enums'\]" --type=ts supabase/functions/_backend/utils/pg_files.ts | head -3

# Check for type generation files
echo -e "\n=== Checking for Supabase type generation or schema ==="
fd "database\|types" --type=f -path "*supabase*" | head -10

Length of output: 1368


Add 'invite_super_admin' to userMinRightPgEnum

The enum at postgres_schema.ts:7-17 omits 'invite_super_admin', but it is actively used in two places:

  1. rightHierarchy in pg_files.ts:111 assigns it a hierarchy level of 3.5
  2. memberSchema in organization/members/get.ts:21 includes it as a valid role enum value

This creates a type mismatch: rightHierarchy is typed as Record<Database['public']['Enums']['user_min_right'], number>, yet contains a key not defined in the enum. Apply the suggested fix:

export const userMinRightPgEnum = pgEnum('user_min_right', [
  'invite_read',
  'invite_upload',
  'invite_write',
  'invite_admin',
+ 'invite_super_admin',
  'read',
  'upload',
  'write',
  'admin',
  'super_admin',
])
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const keyModePgEnum = pgEnum('key_mode', ['read', 'write', 'all', 'upload'])
export const userMinRightPgEnum = pgEnum('user_min_right', [
'invite_read',
'invite_upload',
'invite_write',
'invite_admin',
'read',
'upload',
'write',
'admin',
'super_admin',
])
export const keyModePgEnum = pgEnum('key_mode', ['read', 'write', 'all', 'upload'])
export const userMinRightPgEnum = pgEnum('user_min_right', [
'invite_read',
'invite_upload',
'invite_write',
'invite_admin',
'invite_super_admin',
'read',
'upload',
'write',
'admin',
'super_admin',
])
🤖 Prompt for AI Agents
In supabase/functions/_backend/utils/postgres_schema.ts around lines 6 to 17,
the exported userMinRightPgEnum is missing the 'invite_super_admin' value which
causes a type mismatch with usages in rightHierarchy and memberSchema; add
'invite_super_admin' to the array of enum values in userMinRightPgEnum so the
Postgres enum and TypeScript types include that key (ensure it's placed
alongside the other invite_* entries).

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (5)
supabase/functions/_backend/utils/pg_files.ts (5)

11-42: getUserIdFromApikey wrapper looks correct; consider log payload

The PG call + null-safe handling look good and fail closed on errors. The apikeyPrefix logging for observability is useful, but double‑check that logging the first 15 chars of the key is acceptable from a secrets/PII standpoint; if not, consider hashing or truncating further.


47-64: getOwnerOrgByAppId is straightforward; optional logging for parity

The function is a thin, correct wrapper over get_user_main_org_id_by_app_id and returns null on error, which is consistent with the other helpers. For easier debugging, you might want to add a small cloudlog call (start/result) similar to getUserIdFromApikey, but that’s optional.


69-111: checkMinRightsPg logic is sound; consider guarding other IDs before hitting PG

The rights check wrapper is implemented correctly and fails closed on error. You already short‑circuit when userId is falsy; consider doing the same for obviously invalid orgId (and maybe appId/channelId if they are required in some call paths) to avoid avoidable UUID cast errors in Postgres and to keep logs cleaner:

if (!userId || !orgId) {
  cloudlog({ requestId: c.get('requestId'), message: 'checkMinRightsPg - missing userId/orgId', userId, orgId })
  return false
}

Not strictly required, but can reduce noisy PG errors.


116-153: hasAppRightApikeyPg wrapper looks good

The function mirrors the pattern of the other helpers, logs start/result, and returns false on PG errors, which is appropriate for access control. Just keep the earlier note in mind about whether logging apikeyPrefix is acceptable in your threat model.


158-180: Minor ergonomic refactor for getAppByAppIdPg

The query is correct and typed via schema.apps. You can simplify the then chaining by using array destructuring, which some find a bit clearer:

-        const app = await drizzleClient
-            .select({
-                app_id: schema.apps.app_id,
-                owner_org: schema.apps.owner_org,
-            })
-            .from(schema.apps)
-            .where(eq(schema.apps.app_id, appId))
-            .limit(1)
-            .then(data => data[0])
+        const [app] = await drizzleClient
+            .select({
+                app_id: schema.apps.app_id,
+                owner_org: schema.apps.owner_org,
+            })
+            .from(schema.apps)
+            .where(eq(schema.apps.app_id, appId))
+            .limit(1)

Behavior is the same; this is just a readability tweak.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 274d83a and 63ed16c.

📒 Files selected for processing (1)
  • supabase/functions/_backend/utils/pg_files.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: Cap-go/capgo PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-22T17:04:10.729Z
Learning: Applies to supabase/seed.sql : Update supabase/seed.sql to back new or evolved tests; keep fixtures focused on current behavior while leaving committed migrations unchanged
🧬 Code graph analysis (1)
supabase/functions/_backend/utils/pg_files.ts (2)
supabase/functions/_backend/utils/pg.ts (2)
  • getDrizzleClient (146-148)
  • logPgError (151-199)
supabase/functions/_backend/utils/logging.ts (1)
  • cloudlog (3-15)
🪛 ESLint
supabase/functions/_backend/utils/pg_files.ts

[error] 5-5: Imports "getDrizzleClient" are only used as type.

(ts/consistent-type-imports)


[error] 12-12: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 13-13: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 14-14: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 16-16: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 17-17: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 18-18: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 19-19: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 20-20: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 21-21: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 23-23: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 24-24: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 25-25: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 26-26: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 28-28: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 30-30: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 31-31: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 32-32: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 33-33: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 34-34: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 36-36: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 37-37: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 38-38: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 39-39: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 40-40: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 41-41: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 48-48: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 49-49: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 50-50: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 52-52: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 53-53: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 54-54: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 55-55: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 56-56: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 58-58: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 59-59: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 60-60: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 61-61: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 62-62: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 63-63: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 70-70: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 71-71: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 72-72: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 73-73: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 74-74: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 75-75: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 76-76: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 78-78: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 79-79: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 80-80: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 81-81: Expected indentation of 8 spaces but found 16.

(style/indent)


[error] 82-82: Expected indentation of 8 spaces but found 16.

(style/indent)


[error] 83-83: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 84-84: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 85-85: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 87-87: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 88-88: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 89-89: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 90-90: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 92-92: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 94-94: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 95-95: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 96-96: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 97-97: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 98-98: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 99-99: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 100-100: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 101-101: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 102-102: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 103-103: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 105-105: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 106-106: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 107-107: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 108-108: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 109-109: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 110-110: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 117-117: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 118-118: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 119-119: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 120-120: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 121-121: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 122-122: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 124-124: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 125-125: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 126-126: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 127-127: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 128-128: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 129-129: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 130-130: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 131-131: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 132-132: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 134-134: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 135-135: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 136-136: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 137-137: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 139-139: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 141-141: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 142-142: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 143-143: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 144-144: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 145-145: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 147-147: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 148-148: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 149-149: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 150-150: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 151-151: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 152-152: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 159-159: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 160-160: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 161-161: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 163-163: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 164-164: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 165-165: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 166-166: Expected indentation of 8 spaces but found 16.

(style/indent)


[error] 167-167: Expected indentation of 8 spaces but found 16.

(style/indent)


[error] 168-168: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 169-169: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 170-170: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 171-171: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 172-172: Expected indentation of 6 spaces but found 12.

(style/indent)


[error] 174-174: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 175-175: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 176-176: Expected indentation of 2 spaces but found 4.

(style/indent)


[error] 177-177: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 178-178: Expected indentation of 4 spaces but found 8.

(style/indent)


[error] 179-179: Expected indentation of 2 spaces but found 4.

(style/indent)

🪛 GitHub Actions: Run tests
supabase/functions/_backend/utils/pg_files.ts

[error] 1-181: ESLint: 127 problems detected in pg_files.ts (127 errors, 0 warnings). Includes issues like incorrect indentation and unexpected imports. Example: 'Imports "getDrizzleClient" are only used as type' (ts/consistent-type-imports) and numerous style/indent and style/no-multiple-empty-lines errors.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
13.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants