Webhook tables have no alembic migration — runtime failure in deployed environments #43

Closed
opened 2026-08-14 03:28:22 +00:00 by Mark · 1 comment
Owner

models.py defines Webhook (tablename "webhooks") and WebhookDelivery ("webhook_deliveries"), but alembic versions stop at 0010_add_idle_suspend_enabled.py — no migration adds these tables. entrypoint.sh only runs alembic upgrade head; no create_all exists in production code (only tests/conftest.py).

Reproduction:

  1. Deploy services/api with an empty database.
  2. Run alembic upgrade head (what entrypoint.sh does).
  3. Call POST /webhooks or any webhook route.

Expected: webhooks and webhook_deliveries tables exist after migration; webhook CRUD succeeds (per commit ceb6591c1a's feature).
Actual: tables are absent; first webhook CRUD/delivery attempt fails with "no such table" at runtime.

Kanban card: t_223849fd (probe finding 2, follow-up to closed Mark/devforge#17).

models.py defines Webhook (__tablename__ "webhooks") and WebhookDelivery ("webhook_deliveries"), but alembic versions stop at 0010_add_idle_suspend_enabled.py — no migration adds these tables. entrypoint.sh only runs `alembic upgrade head`; no create_all exists in production code (only tests/conftest.py). Reproduction: 1. Deploy services/api with an empty database. 2. Run `alembic upgrade head` (what entrypoint.sh does). 3. Call POST /webhooks or any webhook route. Expected: webhooks and webhook_deliveries tables exist after migration; webhook CRUD succeeds (per commit ceb6591c1a's feature). Actual: tables are absent; first webhook CRUD/delivery attempt fails with "no such table" at runtime. Kanban card: t_223849fd (probe finding 2, follow-up to closed Mark/devforge#17).
Author
Owner

Closure: deliverable verified on origin/main; verify gate failed on repo-structural pre-existing issues, not the fix.

Deliverable landed

  • 2aeae61 feat(api): add webhooks tables migration and lifecycle dispatch tests (#44) — adds services/api/alembic/versions/0011_add_webhooks_tables.py (webhooks + webhook_deliveries) + tests/test_webhooks.py
  • 7db1598 fix(deploy): add missing API runtime deps and shorten 0009 revision id — shortens the 33-char 0009 revision id (breaks fresh deploys with StringDataRightTruncation on VARCHAR(32) version_num), adds cryptography/filelock deps
  • Both on origin/main; chain is linear 0001→0011

Reproduction verified (fresh empty DB, what entrypoint.sh does)

  • Created fresh Postgres DB, ran alembic upgrade head inside the API container: full chain 0001→0011 applied cleanly
  • Tables present: webhooks, webhook_deliveries; alembic_version = 0011_add_webhooks_tables
  • webhooks columns match the Webhook model (url, secret, events, is_active, max_retries, created_at, updated_at)
  • Deployed DB already at 0011 with both tables
  • 12 webhook tests pass; full pytest suite passes; ruff clean on the new file

Why the kilo-gsd verify gate blocked (3 bugfix retries exhausted)

  1. alembic check fails on pre-existing model drift in unrelated tables (users/snapshots/shares/git_credentials/settings — none webhook-related)
  2. SQLite-based introspection fails in pre-existing migration 0007_add_user_tokens.py (NotImplementedError: No support for ALTER of constraints in SQLite dialect) — this repo migration chain is Postgres-only; the plan verify commands wrongly used SQLite

Neither failure is caused by the webhook migration. The issue reproduction (fresh deploy + alembic upgrade head + webhook CRUD) now succeeds.

**Closure: deliverable verified on origin/main; verify gate failed on repo-structural pre-existing issues, not the fix.** ## Deliverable landed - `2aeae61` feat(api): add webhooks tables migration and lifecycle dispatch tests (#44) — adds `services/api/alembic/versions/0011_add_webhooks_tables.py` (webhooks + webhook_deliveries) + `tests/test_webhooks.py` - `7db1598` fix(deploy): add missing API runtime deps and shorten 0009 revision id — shortens the 33-char 0009 revision id (breaks fresh deploys with StringDataRightTruncation on VARCHAR(32) version_num), adds cryptography/filelock deps - Both on origin/main; chain is linear 0001→0011 ## Reproduction verified (fresh empty DB, what entrypoint.sh does) - Created fresh Postgres DB, ran `alembic upgrade head` inside the API container: full chain 0001→0011 applied cleanly - Tables present: `webhooks`, `webhook_deliveries`; alembic_version = `0011_add_webhooks_tables` - webhooks columns match the Webhook model (url, secret, events, is_active, max_retries, created_at, updated_at) - Deployed DB already at 0011 with both tables - 12 webhook tests pass; full pytest suite passes; ruff clean on the new file ## Why the kilo-gsd verify gate blocked (3 bugfix retries exhausted) 1. `alembic check` fails on **pre-existing model drift** in unrelated tables (users/snapshots/shares/git_credentials/settings — none webhook-related) 2. SQLite-based introspection fails in pre-existing migration `0007_add_user_tokens.py` (`NotImplementedError: No support for ALTER of constraints in SQLite dialect`) — this repo migration chain is Postgres-only; the plan verify commands wrongly used SQLite Neither failure is caused by the webhook migration. The issue reproduction (fresh deploy + `alembic upgrade head` + webhook CRUD) now succeeds.
Mark closed this issue 2026-08-14 06:03:52 +00:00
Sign in to join this conversation.
No description provided.