kite-cli icon indicating copy to clipboard operation
kite-cli copied to clipboard

`alerts modify --rhs` sends an empty `rhs_attribute` for a constant alert

Open jay-tau opened this issue 3 weeks ago • 0 comments

Summary

kite alerts modify <uuid> --rhs EXCHANGE:SYMBOL on a constant alert sends an empty rhs_attribute instead of the documented default, LastTradedPrice.

Steps to reproduce

  1. Start with a constant alert, such as the NIFTY 50 >= 27000 alert in alerts_get_one.json.
  2. Run kite --json alerts modify <uuid> --rhs NSE:INFY. Without --confirm, this prints the request as a dry run.
  3. Look at body.form.rhs_attribute.

Expected

rhs_attribute is LastTradedPrice. The help for --rhs-attribute says "Defaults to LastTradedPrice for a new instrument condition" (src/cli.rs:409).

Actual

rhs_attribute is "". Adding --confirm sends the same empty value in the PUT form.

Cause

  1. Kite returns empty strings for the instrument fields of a constant alert (alerts_get_one.json L14-L17).
  2. The kiteconnect crate types this field as Option<String> (src/alerts.rs:283), so "" arrives as Some("").
  3. The fallback is --rhs-attribute → the stored alert's rhs_attribute → "LastTradedPrice" (src/commands/alerts.rs:150-159). It stops at Some(""), so the default is never used.

Creating an alert isn't affected, and neither is modifying an alert that already compares against an instrument.

Found using the kiteconnect-mocks fixtures only. I haven't checked how the live Kite API handles an empty rhs_attribute.

Fix

https://github.com/zerodha/kite-cli/pull/1

jay-tau avatar Nov 08 '26 09:11 jay-tau