fix(backend): match GitLab topics case-insensitively#1393
Conversation
Normalize GitLab project topics before include/exclude matching so mixed-case GitLab topics obey the lowercased filter patterns.\n\nConstraint: GitLab connection configs already normalize configured topic filters to lowercase.\nRejected: Preserve project-side case sensitivity | it makes mixed-case GitLab topics fail otherwise matching filters.\nConfidence: high\nScope-risk: narrow\nDirective: Keep GitLab topic include and exclude matching symmetric.\nTested: node .yarn/releases/yarn-4.7.0.cjs workspace @sourcebot/backend test src/gitlab.test.ts; node .yarn/releases/yarn-4.7.0.cjs workspace @sourcebot/backend build\nNot-tested: Live GitLab API sync against mixed-case project topics
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
Walkthrough
ChangesGitLab topic case-insensitive filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Document the GitLab topic case-insensitive matching fix in the Unreleased changelog after the PR number was assigned.\n\nConstraint: Sourcebot requires every PR to include a changelog entry with the PR link.\nConfidence: high\nScope-risk: narrow\nDirective: Keep changelog entries as follow-up commits once PR numbers exist.\nTested: not run; changelog-only change\nNot-tested: Runtime behavior
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/backend/src/gitlab.test.ts`:
- Around line 144-166: The existing `shouldExcludeProject` tests cover
case-insensitive exact topic matches, but they do not verify glob patterns; add
a regression test alongside the current `shouldExcludeProject` cases that uses a
mixed-case topic and a lowercase glob in `include.topics` (for example, a
project topic like `Core-API` matched by `core-*`) and assert the project is not
excluded. Keep the new test in the same `gitlab.test.ts` suite so the
case-insensitive glob behavior of `shouldExcludeProject` is explicitly covered.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5e824e3e-b757-445a-b7df-d5c8117613e0
📒 Files selected for processing (2)
packages/backend/src/gitlab.test.tspackages/backend/src/gitlab.ts
Add a regression for mixed-case GitLab project topics matching lowercase include-topic glob filters.\n\nConstraint: CodeRabbit requested explicit glob coverage for the new case-insensitive topic matching behavior.\nConfidence: high\nScope-risk: narrow\nDirective: Keep topic filter behavior covered for exact and glob patterns.\nTested: node .yarn/releases/yarn-4.7.0.cjs workspace @sourcebot/backend test src/gitlab.test.ts; node .yarn/releases/yarn-4.7.0.cjs workspace @sourcebot/backend build\nNot-tested: Live GitLab API sync against mixed-case project topics
…ic-case # Conflicts: # CHANGELOG.md
Fixes #1388
Problem
GitLab topic filters lowercased configured topics but compared them against project topics without normalizing the project side, so mixed-case GitLab topics could miss matching include/exclude filters.
Root cause
shouldExcludeProjectnormalized config topics only.Solution
Normalize project topics before both include and exclude matching, keeping the comparison symmetric and case-insensitive.
Tests
node .yarn/releases/yarn-4.7.0.cjs workspace @sourcebot/backend test src/gitlab.test.tsnode .yarn/releases/yarn-4.7.0.cjs workspace @sourcebot/backend buildRisk
Low to moderate. This intentionally changes mixed-case GitLab topic filtering so matching is case-insensitive for both include and exclude rules.
Summary by CodeRabbit