Skip to content

fix(triggers): repair broken name filter in ListTriggers (EN-1218) - #181

Closed
flemzord wants to merge 1 commit into
mainfrom
fix/triggers-name-filter-sql
Closed

fix(triggers): repair broken name filter in ListTriggers (EN-1218)#181
flemzord wants to merge 1 commit into
mainfrom
fix/triggers-name-filter-sql

Conversation

@flemzord

Copy link
Copy Markdown
Member

Problem (C4)

ListTriggers built its name filter as:

query.Where("Name ILIKE '%?%';", paramsQuery.Options.Name)

bun substitutes the ? placeholder even inside the string literal, so this renders as Name ILIKE '%'foo'%'; — the value is spliced inside the quotes and the stray ; lands in the middle of the WHERE clause (it is ANDed with deleted_at is null). Every GET /triggers?name=... request (v1 & v2) returned a 500.

Fix

query.Where("name ILIKE ?", "%"+paramsQuery.Options.Name+"%")

Proper parameterized predicate, wildcards on the argument.

Test

Adds TestListTriggersNameFilter (integration) covering substring match, case-insensitive match, no-match, and the unfiltered case — none existed before.

Part of the deep-review remediation series. Severity: CRITICAL.

The name filter used Where("Name ILIKE '%?%';", name): bun substitutes
the ? placeholder even inside the string literal, producing invalid SQL
(the value is quoted inside the literal and the stray ; lands mid-WHERE).
Any GET /triggers?name=... request therefore returned a 500.

Use a proper parameterized predicate with the wildcards on the argument,
and add an integration test covering substring/case-insensitive matching.
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@flemzord, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 55 minutes and 18 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 99a1e41c-55fe-4d7f-baee-27257982586b

📥 Commits

Reviewing files that changed from the base of the PR and between 271bf8d and 790c084.

📒 Files selected for processing (2)
  • internal/triggers/manager.go
  • internal/triggers/manager_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/triggers-name-filter-sql

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.

@flemzord

flemzord commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

Tracked in Jira: EN-1218 (Epic EN-1217).

@flemzord flemzord changed the title fix(triggers): repair broken name filter in ListTriggers fix(triggers): repair broken name filter in ListTriggers (EN-1218) Jun 11, 2026
@flemzord

flemzord commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

Superseded by #199, which consolidates this change with the related reliability and safety fixes on top of the current main branch.

@flemzord flemzord closed this Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant