fix: filter by text is case sensitive by paanSinghCoder · Pull Request #1472 · raystack/frontier
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
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 resumeto resume automatic reviews.@coderabbitai reviewto 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.
Comment @coderabbitai help to get the list of available commands and usage tips.
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
📒 Files selected for processing (1)
internal/store/postgres/org_billing_repository.go
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 matchingnotlikeregression case.This PR changes both
likeandnotlike, but this table only addslikecoverage. Add a sibling case assertingNOT ILIKEgeneration 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
📒 Files selected for processing (1)
internal/store/postgres/org_billing_repository_test.go
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 | 🔴 CriticalLine 421 and Line 423: Raw SQL interpolation introduces injection risk.
filter.Valueis interpolated directly into SQL viafmt.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
📒 Files selected for processing (4)
internal/api/v1beta1connect/organization_billing.gointernal/api/v1beta1connect/rql_validation.gointernal/store/postgres/org_billing_repository.goweb/sdk/admin/utils/transform-query.ts
rsbh approved these changes Mar 26, 2026
rsbh approved these changes Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters