Skip to content

fix(backend): match GitLab topics case-insensitively#1393

Open
DivyamTalwar wants to merge 4 commits into
sourcebot-dev:mainfrom
DivyamTalwar:divyam/fix-gitlab-topic-case
Open

fix(backend): match GitLab topics case-insensitively#1393
DivyamTalwar wants to merge 4 commits into
sourcebot-dev:mainfrom
DivyamTalwar:divyam/fix-gitlab-topic-case

Conversation

@DivyamTalwar

@DivyamTalwar DivyamTalwar commented Jun 29, 2026

Copy link
Copy Markdown

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

shouldExcludeProject normalized 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.ts
  • node .yarn/releases/yarn-4.7.0.cjs workspace @sourcebot/backend build

Risk

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

  • Bug Fixes
    • GitLab topic include/exclude filters now match project topics in a case-insensitive way, fixing mismatches caused by mixed-case topic values.
    • Projects with topics such as “Backend” or “Deprecated” are evaluated consistently against configured include/exclude topic rules.

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
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 600dd7c2-bca6-4ffa-9ea5-8f1251e14919

📥 Commits

Reviewing files that changed from the base of the PR and between b71969d and 49a4c9e.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • packages/backend/src/gitlab.test.ts
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Walkthrough

shouldExcludeProject now lowercases GitLab project topics before matching include and exclude topic filters. Tests and the changelog were updated to reflect case-insensitive topic matching.

Changes

GitLab topic case-insensitive filtering

Layer / File(s) Summary
shouldExcludeProject topic normalization
packages/backend/src/gitlab.ts
project.topics values are lowercased before micromatch runs for both include.topics and exclude.topics.
case-insensitive behavior tests and changelog
packages/backend/src/gitlab.test.ts, CHANGELOG.md
The GitLab tests assert case-insensitive include and exclude topic matching, and the changelog adds the mixed-case topic fix entry.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: brendan-kellam

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: making GitLab topic matching case-insensitive.
Linked Issues check ✅ Passed The PR normalizes project topics before include/exclude matching and adds regression coverage for mixed-case and glob topic filters, meeting #1388.
Out of Scope Changes check ✅ Passed The changes stay focused on GitLab topic filtering, tests, and changelog notes with no obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 82b5c1f and 583d8df.

📒 Files selected for processing (2)
  • packages/backend/src/gitlab.test.ts
  • packages/backend/src/gitlab.ts

Comment thread packages/backend/src/gitlab.test.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
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.

GitLab topic filters are case-sensitive on project topics

1 participant