Skip to content

fix(coolify-webhook): surface deprecation prompt in Settings UI#64

Merged
finedesignz merged 1 commit into
mainfrom
fix/coolify-webhook-deprecation-banner
May 26, 2026
Merged

fix(coolify-webhook): surface deprecation prompt in Settings UI#64
finedesignz merged 1 commit into
mainfrom
fix/coolify-webhook-deprecation-banner

Conversation

@finedesignz
Copy link
Copy Markdown
Owner

Summary

  • The hub logs [coolify-webhook] DEPRECATED legacy HMAC route hit ... per legacy-route hit, but the user never saw it — so users on the pre-URL-token format kept hitting the legacy route silently.
  • Adds users.coolify_webhook_legacy_hit_at (nullable TIMESTAMPTZ). The legacy route stamps it on successful HMAC auth; rotateUserCoolifyWebhookSecret clears it (rotating IS the migration).
  • GET /api/account/coolify-webhook-secret now returns legacy_in_use: boolean + legacy_hit_at: string | null. Settings → Coolify Webhook renders an amber callout above the Rotate URL button when legacy_in_use is true. After a successful rotate, the banner clears optimistically client-side.
  • Legacy route still functions — this is a nudge, not a break. Banner self-clears after the next rotate.

Files

  • hub/src/db/schema.sql — idempotent ALTER TABLE users ADD COLUMN IF NOT EXISTS coolify_webhook_legacy_hit_at TIMESTAMPTZ (plain ALTER, no DO block — sidesteps the known migrate.ts parser bug).
  • hub/src/db/dal.tsmarkUserCoolifyWebhookLegacyHit, getUserCoolifyWebhookStatus now returns { configured, legacy_in_use, legacy_hit_at }, rotateUserCoolifyWebhookSecret also clears coolify_webhook_legacy_hit_at in the same UPDATE.
  • hub/src/api/coolify-webhook.ts — legacy route calls markUserCoolifyWebhookLegacyHit after HMAC verifies (fire-and-forget, never blocks the webhook).
  • hub/src/api/account.ts — secret status endpoint surfaces legacy_in_use + legacy_hit_at.
  • web/src/components/SettingsPage.tsx — amber callout above the Rotate URL button when legacy_in_use; clears state on rotate success.
  • hub/test/coolify-webhook.test.ts — asserts markUserCoolifyWebhookLegacyHit IS called on valid legacy HMAC and IS NOT called on bad signature.
  • docs/coolify-webhook-migration.md — documents the new legacy_in_use field + the in-UI banner contract.

Test plan

  • cd hub && bun test test/coolify-webhook.test.ts — passes (added 1 new test, 19 pass / 7 skip).
  • cd hub && bun test — 283 pass / 5 fail; the 5 failures (insertRunV2 started_at safety, insertDeploymentRun started_at safety) pre-exist on origin/main and are unrelated.
  • cd web && bun run build — clean tsc + vite build.
  • After deploy: user with legacy hook fires it → banner appears → rotate → banner gone → new URL works.

🤖 Generated with Claude Code

The legacy HMAC route logs a deprecation warning per hit but never surfaced
to the user — so users who hit it kept hitting it. Now:

- Track legacy-route hits via new nullable column users.coolify_webhook_legacy_hit_at.
- Set it from the legacy route on successful HMAC auth (fire-and-forget).
- Clear it in rotateUserCoolifyWebhookSecret — rotating to the new URL-token
  format migrates the user.
- Expose legacy_in_use + legacy_hit_at on GET /api/account/coolify-webhook-secret.
- Amber banner above the Rotate URL button in Settings → Coolify Webhook
  telling the user to re-rotate to migrate; banner clears optimistically
  after successful rotate.

Legacy route still works — this is a nudge, not a break.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@finedesignz finedesignz merged commit 53d3d74 into main May 26, 2026
1 check passed
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.

1 participant