fix: persist webhook secret on create and normalize on update

The secret field was accepted in BoardWebhookCreate but never passed
to the BoardWebhook constructor, silently dropping it. Now secret is
persisted at creation time (with empty/whitespace normalized to None)
and similarly normalized on PATCH so sending "" clears a set secret.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hugh Brown
2026-03-03 21:23:18 -07:00
committed by Abhimanyu Saharan
parent 3a00636ceb
commit ea78b41a36

View File

@@ -350,6 +350,7 @@ async def create_board_webhook(
agent_id=payload.agent_id,
description=payload.description,
enabled=payload.enabled,
secret=payload.secret or None,
)
await crud.save(session, webhook)
return _to_webhook_read(webhook)
@@ -384,6 +385,8 @@ async def update_board_webhook(
webhook_id=webhook_id,
)
updates = payload.model_dump(exclude_unset=True)
if "secret" in updates:
updates["secret"] = updates["secret"] or None
if updates:
await _validate_agent_id(
session=session,