fix: prevent alert update from wiping subjects#296
Conversation
buildCommonTokenTransferData unconditionally set data.subjects = subjects ?? [], causing the update path (applyDefaults: false) to overwrite existing subjects with an empty array via shallow merge. Now subjects is only set when the user explicitly passes --subject, matching the pattern used by counterparties. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pr-reviewer Summary✅ No issues found The code review completed successfully with no findings. Review effort: 1/5 (Trivial) SummaryThis is a clean, minimal bug fix that prevents alert updates from inadvertently wiping a user's existing Root cause: Fix: The one-line change to The accompanying test accurately simulates the update flow (calling Token usage: 68 input, 2,739 output, 125,028 cache read, 16,147 cache write |
Summary
common-token-transferalert with any flag (e.g.--usd-min 5000) wiped existingsubjects, causing API rejection: "Common Token Transfer Alert must specify subject or tokens"buildCommonTokenTransferDataunconditionally setdata.subjects = subjects ?? [](line 170), so when--subjectwasn't passed, subjects defaulted to[]. On the update path (applyDefaults: false), this empty array overwrote existing subjects via shallow merge at line 568.if (subjects) data.subjects = subjects;— matching the pattern already used bycounterpartieson line 173. The create path still works becauseTYPE_DEFAULTSsuppliessubjects: []viaapplyDefaults.Test plan
should not wipe subjects when updating common-token-transfer without --subject🤖 Generated with Claude Code