[hero_planner_server] currency_rate delete can corrupt data — oschema CurrencyRate omits the rowid #25
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_planner#25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
currency_rate_listoutput (oschemaCurrencyRate) does not expose the row id/sid, butcurrency_rate_deleterequires the rowid (parse_sid-> i64; the lib deletesWHERE id = ?). There is no delete-by-code path.So a client cannot reliably delete a specific rate: the web remap synthesizes an
idfrom the list index, which can target the wrong / nonexistent row -> potential deletion of the wrong currency rate (data-corruption risk). This worked pre-migration when the old API returned the id.Fix: expose the rowid (or a stable sid) in the
CurrencyRateoschema output, or add a delete-by-code method.Fixed on
developmentin7976504— addedid: i64(SQLite rowid) to theCurrencyRatetype in the.oschemaand populated it in thecurrency_rate_list/currency_rate_upsertimpls (the lib model already carried the rowid; it was being dropped at the RPC boundary, so the client had no stable id to delete by).currency_rate_deletenow targets the correct row.Verified round-trip on the live daemon: upsert (returns real
id) → list (rows carry thatid) → delete byid→ list empty, with only the targeted row removed and bystanders untouched. Source-only; openrpc/SDK regenerated by build.Follow-up: the web client shim still derived the currency id from list index — being updated to use this real wire
id(separate web commit).