Skip to content

Treat an unrecognized ticket-callout builtin_key as custom#2014

Closed
maebeale wants to merge 2 commits into
mainfrom
maebeale/custom-callout-error
Closed

Treat an unrecognized ticket-callout builtin_key as custom#2014
maebeale wants to merge 2 commits into
mainfrom
maebeale/custom-callout-error

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 3 Read 📖 model normalization + specs; changes validation behavior for unknown keys

What is the goal of this PR and why is this important?

Editing an event 422'd with "Registration ticket callouts builtin key is not included in the list" whenever one of its callouts carried a builtin_key no longer in BUILTIN_KEYS — a since-removed built-in (prod has 3 event_details rows). Autosave re-validates that row on edit and the inclusion check blocks the whole save, with no way to fix it from the editor (the row renders as a built-in with no delete/reset).

How did you approach the change?

normalizes :builtin_key now drops any key that isn't a current built-in (blank or removed) to nil, so the row becomes a plain custom callout — editable, deletable, valid — and heals to nil on the next save. A removed built-in has no card builder anyway, so it could never render as a real built-in. Test-first: model spec (blank + removed key → custom) and a request regression (editing a legacy-key event now saves and converts the row).

Anything else to add?

Rows on events that are never edited stay as-is until touched (harmless/inert); an optional one-off UPDATE registration_ticket_callouts SET builtin_key = NULL WHERE builtin_key NOT IN (...) heals them all at once.

maebeale and others added 2 commits July 24, 2026 15:41
A keyless (custom) callout must store NULL, not "". The inclusion
validation allows nil but not blank, and the custom/builtin scopes plus
the [event_id, builtin_key] unique index all key off NULL — so a stray
blank string fails validation and wedges the whole event save. Coerce
blank to nil before validation so all four agree.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
An event couldn't be saved once one of its callouts carried a builtin_key
no longer in BUILTIN_KEYS (a since-removed built-in like "event_details"):
editing the event re-validated that row and the inclusion check 422'd the
whole save, with no way to fix it from the editor.

Normalize any key that isn't a current built-in (blank or removed) to nil,
so the row becomes a plain custom callout — editable, deletable, and valid —
and heals to nil on the next save. A removed built-in has no card builder
anyway, so it could never render as a real built-in.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 24, 2026 19:59
@maebeale
maebeale marked this pull request as ready for review July 24, 2026 19:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale maebeale closed this Jul 25, 2026
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.

2 participants