Skip to content

fix: filter by text is case sensitive#1472

Open
paanSinghCoder wants to merge 12 commits intomainfrom
fix/operator-case-sensitive
Open

fix: filter by text is case sensitive#1472
paanSinghCoder wants to merge 12 commits intomainfrom
fix/operator-case-sensitive

Conversation

@paanSinghCoder
Copy link
Copy Markdown
Contributor

@paanSinghCoder paanSinghCoder commented Mar 23, 2026

Summary

Make organization like filters case-insensitive in Admin SearchOrganizations backend query handling.

Related PR - raystack/salt#83

Changes
Updated frontier/internal/store/postgres/org_billing_repository.go

  • like now uses ILIKE
  • notlike now uses NOT ILIKE

Added regression coverage in frontier/internal/store/postgres/org_billing_repository_test.go to assert title like generates ILIKE.

Why
Filtering organizations by title from /organizations returned different results for different casing (e.g. fah vs Fah). This aligns filter behavior with expected case-insensitive search.

Technical Details

Test Plan

  • Manual testing completed
  • Build and type checking passes

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Mar 27, 2026 9:13am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This pull request introduces case-insensitive string filtering through new ilike and notilike operators. The backend PostgreSQL repository adds these operators to filter processing with SQL ILIKE / NOT ILIKE comparisons, while the frontend removes special-case remapping logic that previously converted ilike to like.

Changes

Cohort / File(s) Summary
Backend filter operators
internal/store/postgres/org_billing_repository.go
Added ilike and notilike operator constants and extended processStringDataType to handle case-insensitive SQL comparisons with TEXT column casting.
Frontend filter handling
web/sdk/admin/utils/transform-query.ts
Removed conditional operator remapping logic that converted ilike to like based on filter value type; operator now passes through directly from filter definition.
Dependency management
go.mod
Updated github.com/raystack/salt from v0.6.2 to v0.6.3.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes


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.

@coveralls
Copy link
Copy Markdown

coveralls commented Mar 23, 2026

Pull Request Test Coverage Report for Build 23639219172

Details

  • 0 of 4 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.005%) to 41.623%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/store/postgres/org_billing_repository.go 0 4 0.0%
Totals Coverage Status
Change from base Build 23638322581: -0.005%
Covered Lines: 15014
Relevant Lines: 36071

💛 - Coveralls

Copy link
Copy Markdown
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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1c9eba0b-c172-4ae4-8f52-3ee982080f31

📥 Commits

Reviewing files that changed from the base of the PR and between fec853b and 1d62277.

📒 Files selected for processing (1)
  • internal/store/postgres/org_billing_repository.go

Copy link
Copy Markdown
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: 1

🧹 Nitpick comments (1)
internal/store/postgres/org_billing_repository_test.go (1)

110-126: Add a matching notlike regression case.

This PR changes both like and notlike, but this table only adds like coverage. Add a sibling case asserting NOT ILIKE generation to prevent one-sided regressions.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0acc1813-2df9-42bf-9dcb-84163a7884f8

📥 Commits

Reviewing files that changed from the base of the PR and between 1d62277 and aa8160b.

📒 Files selected for processing (1)
  • internal/store/postgres/org_billing_repository_test.go

@paanSinghCoder paanSinghCoder requested a review from rsbh March 25, 2026 09:46
Copy link
Copy Markdown
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: 1

♻️ Duplicate comments (1)
internal/store/postgres/org_billing_repository.go (1)

420-423: ⚠️ Potential issue | 🔴 Critical

Line 421 and Line 423: Raw SQL interpolation introduces injection risk.

filter.Value is interpolated directly into SQL via fmt.Sprintf, so crafted input can break out of the predicate. Please switch to parameterized goqu expressions (same fix should be applied to all LIKE/ILIKE branches).

🔧 Proposed fix
-	case OPERATOR_ILIKE:
-		query = query.Where(goqu.L(fmt.Sprintf(`"%s"::TEXT ILIKE '%s'`, filter.Name, filter.Value.(string))))
-	case OPERATOR_NOT_ILIKE:
-		query = query.Where(goqu.L(fmt.Sprintf(`"%s"::TEXT NOT ILIKE '%s'`, filter.Name, filter.Value.(string))))
+	case OPERATOR_ILIKE:
+		query = query.Where(goqu.Cast(goqu.I(filter.Name), "TEXT").ILike(filter.Value.(string)))
+	case OPERATOR_NOT_ILIKE:
+		query = query.Where(goqu.Cast(goqu.I(filter.Name), "TEXT").NotILike(filter.Value.(string)))
#!/bin/bash
set -euo pipefail

echo "=== Interpolated LIKE/ILIKE patterns in org_billing_repository.go ==="
rg -nP 'fmt\.Sprintf\(`"%s"::TEXT (NOT )?I?LIKE '\''%s'\''' internal/store/postgres/org_billing_repository.go || true

echo
echo "=== Parameterized/cast expressions present ==="
rg -nP 'goqu\.Cast\(goqu\.I\(filter\.Name\), "TEXT"\)\.(I|NotI|L|NotL)ike\(' internal/store/postgres/org_billing_repository.go || true

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c9ef6627-0bd0-4bfb-b4fa-290566c6fc63

📥 Commits

Reviewing files that changed from the base of the PR and between dfb0d4d and 5dc687a.

📒 Files selected for processing (4)
  • internal/api/v1beta1connect/organization_billing.go
  • internal/api/v1beta1connect/rql_validation.go
  • internal/store/postgres/org_billing_repository.go
  • web/sdk/admin/utils/transform-query.ts

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