fix: add client-side validation for alert type-specific required fields#299
fix: add client-side validation for alert type-specific required fields#299
Conversation
…min/max The shallow merge in the update handler replaced entire range objects (e.g. inflow_1h, usdValue), so updating only --inflow-1h-min would drop the existing max to null. Now all nested plain objects (ranges, inclusion, exclusion) are deep-merged, and null sub-keys from buildRange are preserved from the existing value. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…alerts Before this change, users creating/updating alerts without required type-specific fields would get raw API error messages. Now the CLI validates before sending to the API: - sm-token-flows: requires at least one inflow/outflow/netflow threshold - common-token-transfer: requires at least one --subject or --token - smart-contract-call: requires at least one --caller, --contract, or --signature-hash Also fixes deep-merge of range fields during updates so that providing only --min doesn't overwrite an existing --max with null. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pr-reviewer Summary📝 2 findings Review completed. Please address the findings below. Findings by Severity
Review effort: 3/5 (Moderate) SummaryThis PR adds meaningful client-side validation for type-specific required fields in alerts (thresholds for File-by-file findings
|
Summary
validateAlertData()that checks type-specific required fields before sending to the API, giving users clear error messages instead of raw API errors:--subjector--token--caller,--contract, or--signature-hashcreateandupdate(on the final merged data)--mindoesn't overwrite existing--maxwith nullTest plan
nansen alerts create --name Test --type sm-token-flows --chains ethereum --telegram 123→ should show clear validation errornansen alerts create --name Test --type smart-contract-call --chains ethereum --telegram 123 --signature-hash 0xa9059cbb→ should succeed🤖 Generated with Claude Code