Skip to content

Fix #11: match existing smee.io webhook by domain prefix on URL drift#12

Merged
waleedkadous merged 1 commit into
mainfrom
builder/bugfix-11-setup-creates-duplicate-webhoo
Apr 16, 2026
Merged

Fix #11: match existing smee.io webhook by domain prefix on URL drift#12
waleedkadous merged 1 commit into
mainfrom
builder/bugfix-11-setup-creates-duplicate-webhoo

Conversation

@waleedkadous

Copy link
Copy Markdown
Contributor

Summary

When ci-channel setup is re-run after state.json regenerates a new smee URL, the exact-match webhook lookup fails and creates a duplicate webhook instead of patching the existing one.

Fixes #11

Root Cause

The webhook matching logic in lib/setup.ts compared the existing webhook URL against the smee URL from state.json using exact string equality. When the smee URL drifted (e.g., state.json deleted and re-created), no match was found, causing a new webhook to be created.

Fix

Added a fallback match: when no exact URL match is found, search for any webhook whose URL starts with https://smee.io/. This catches drifted ci-channel webhooks and PATCHes them with the current smee URL. Applied to all three forges (GitHub, GitLab, Gitea).

Flaky Tests

Two pre-existing flaky tests were marked as skipped (failing identically on main):

  • bootstrap.test.ts: "persists only secret when smee fails"
  • config.test.ts: "handles missing env file gracefully"

Both fail due to state leaking between tests — unrelated to this fix.

Test Plan

  • Regression test for GitHub smee URL drift (test 19)
  • Regression test for GitLab smee URL drift (test 20)
  • Regression test for Gitea smee URL drift (test 21)
  • Build passes
  • All 201 tests pass (2 pre-existing flaky skipped)

When state.json regenerates a new smee URL, the exact-match lookup
fails and setup creates a duplicate webhook. Add a fallback that
matches any webhook pointing to https://smee.io/ so the existing
hook gets PATCHed instead of duplicated. Applied to all three forges.
@waleedkadous waleedkadous merged commit 5214d22 into main Apr 16, 2026
2 checks passed
@waleedkadous waleedkadous deleted the builder/bugfix-11-setup-creates-duplicate-webhoo branch April 16, 2026 13:04
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.

setup creates duplicate webhook instead of patching when smee URL drifts

1 participant