Skip to content

fix(GitLab): Linked issue tag isn't updated when webhook uses the work_items URL#7305

Merged
emyller merged 2 commits into
mainfrom
fix/gitlab-webhook-url-variants
Apr 21, 2026
Merged

fix(GitLab): Linked issue tag isn't updated when webhook uses the work_items URL#7305
emyller merged 2 commits into
mainfrom
fix/gitlab-webhook-url-variants

Conversation

@khvn26
Copy link
Copy Markdown
Member

@khvn26 khvn26 commented Apr 21, 2026

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Follow-up to #7301.

GitLab delivers issue webhooks with the modern /-/work_items/<iid> URL in object_attributes.url even when the feature was linked via the legacy /-/issues/<iid> path — and the reverse can happen too. apply_tag_for_event matched on the exact stored URL string, so the receiver 200'd but the tag never flipped.

Match by both URL variants when routing an issue event to its linked feature. Non-issue URLs (MRs) pass through unchanged.

The smoke test on #7301 most likely missed this because it ran against one of our long-standing gitlab.com projects, which still emit the legacy /-/issues/ URL in webhook payloads. Newer projects emit the /-/work_items/ form, which is what surfaced the mismatch once I ran the receiver against a freshly-created project.

How did you test this code?

Parametrised integration test covers both directions (issueswork_items and the reverse).

End-to-end smoke against a real gitlab.com project via ngrok:

  • Linked a feature to https://gitlab.com/khvn26/test-project/-/issues/1.
  • Closed the issue on gitlab.com → webhook delivered with /-/work_items/1 → tag flipped to Issue Closed.
  • Reopened → tag flipped back to Issue Open.
  • Regression sweep on MR events (draft → open → merged): all tags flipped as expected.

GitLab delivers issue webhooks with ``/-/work_items/<iid>`` URLs even when the
feature was linked via the legacy ``/-/issues/<iid>`` form, and vice versa.
``apply_tag_for_event`` did an exact string match, so the receiver 200'd but
the tag never flipped.

Match by both URL variants when routing an issue event to its linked feature.

beep boop
@khvn26 khvn26 requested review from a team as code owners April 21, 2026 22:21
@khvn26 khvn26 requested review from Zaimwa9 and removed request for a team April 21, 2026 22:21
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 21, 2026

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Apr 21, 2026 10:34pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ignored Ignored Preview Apr 21, 2026 10:34pm
flagsmith-frontend-staging Ignored Ignored Preview Apr 21, 2026 10:34pm

Request Review

@github-actions github-actions Bot added api Issue related to the REST API docs Documentation updates fix and removed docs Documentation updates labels Apr 21, 2026
@khvn26 khvn26 changed the title fix(GitLab): linked issue tag isn't updated when webhook uses the work_items URL fix(GitLab): Linked issue tag isn't updated when webhook uses the work_items URL Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-7305 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-7305 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-7305 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-7305 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7305 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7305 Finished ✅ Results

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.39%. Comparing base (2a91d0c) to head (0ab3698).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7305   +/-   ##
=======================================
  Coverage   98.39%   98.39%           
=======================================
  Files        1377     1377           
  Lines       51729    51744   +15     
=======================================
+ Hits        50898    50913   +15     
  Misses        831      831           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  43.7 seconds
commit  70ec294
info  🔄 Run: #16234 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  34.9 seconds
commit  70ec294
info  🔄 Run: #16234 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  28.8 seconds
commit  70ec294
info  🔄 Run: #16234 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  51.2 seconds
commit  70ec294
info  🔄 Run: #16234 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  24.6 seconds
commit  0ab3698
info  🔄 Run: #16235 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  50.9 seconds
commit  0ab3698
info  🔄 Run: #16235 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  54.1 seconds
commit  0ab3698
info  🔄 Run: #16235 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 3 seconds
commit  0ab3698
info  🔄 Run: #16235 (attempt 1)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Visual Regression

16 screenshots compared. See report for details.
View full report

emyller
emyller previously approved these changes Apr 21, 2026
Response to review: lives better next to the other `map_*` helpers than inside
`services.py`. Also drops a redundant `@pytest.mark.django_db()` from the
parametrised test — the fixtures it uses already pull in `db`.

beep boop
@github-actions github-actions Bot added docs Documentation updates fix and removed fix docs Documentation updates labels Apr 21, 2026
@khvn26 khvn26 requested a review from emyller April 21, 2026 22:36
@emyller emyller merged commit 885f807 into main Apr 21, 2026
33 of 36 checks passed
@emyller emyller deleted the fix/gitlab-webhook-url-variants branch April 21, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants