fix(leads): load every campaign field into the edit form, and select it - #134
Merged
Merged
Conversation
Editing a campaign left the sender name, reply-to and angle blank. They were not merely missing from the form: save() submits the whole form, so saving an edit wrote those blanks back and wiped the columns. Underneath was a worse one. The page casts its campaign rows with `as CampaignSummary`, which tells TypeScript the shape without checking that the query asked for it, and the select had never been widened past the original nine columns. Everything added since read as undefined at runtime with no compile error — so the run history could not be keyed (campaign id was undefined), the waiting_for_auth badge never appeared, and the edit form got no pitch fields. All of it compiled, and all of it was broken. save() also hardcoded autoSend false and active true. That is right for a new campaign, which should start paused-for-sending so its first drafts get read, but on an edit it switched sending off and un-paused a campaign the user had deliberately paused. It now carries the existing values through. The regression guard is a source-level test asserting the select requests every column the page and panel go on to read. Source-level checks are unusual, but the type system has been explicitly told to look away here, so nothing else would catch it. Reverting the fix fails it in eleven places. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported: sender name, reply-to and angle come up blank when editing a campaign.
They weren't just missing from the form.
save()submits the whole form state, so saving an edit wrote those blanks back and wiped the columns.The bigger one underneath
The page casts campaign rows with
as CampaignSummary— which tells TypeScript the shape without checking the query asked for it. The.select()had never been widened past its original nine columns, so everything added since #130/#132 read asundefinedat runtime with no compile error:c.idundefined → run history couldn't be keyed, so every campaign showed an empty historyauth_required_hostsundefined → thewaiting_for_authbadge never appearedpitch_mode/pitch_intro/pitch_ask/pitch_factsundefined → the edit form got no pitch fieldsAll of it compiled. All of it was broken. The run history and waiting badge shipped in #132 have never actually worked.
Third bug in the same path
save()hardcodedautoSend: false, active: true. Correct for a new campaign — it should start paused-for-sending so the first drafts get read — but on an edit it switched sending off and un-paused a campaign the user had deliberately paused. It now carries the existing values through.Regression guard
A source-level test asserting the select requests every column the page and panel go on to read. Source-level checks are unusual, but the type system has been explicitly told to look away here, so nothing else catches it.
Verified it actually bites: stashing the fix fails it in 11 places.
Checks
tsc --noEmitclean🤖 Generated with Claude Code