fix(GitLab): Linked issue tag isn't updated when webhook uses the work_items URL#7305
Conversation
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
There was a problem hiding this comment.
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
work_items URL
Docker builds report
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
|
Visual Regression16 screenshots compared. See report for details. |
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
docs/if required so people know about the feature.Changes
Follow-up to #7301.
GitLab delivers issue webhooks with the modern
/-/work_items/<iid>URL inobject_attributes.urleven when the feature was linked via the legacy/-/issues/<iid>path — and the reverse can happen too.apply_tag_for_eventmatched 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 (
issues→work_itemsand the reverse).End-to-end smoke against a real gitlab.com project via ngrok:
https://gitlab.com/khvn26/test-project/-/issues/1./-/work_items/1→ tag flipped toIssue Closed.Issue Open.