#1070 — Spurious ‘Merchant details updated’ for empty inventory on no-op update
Repo: Twill-AI/facade State: closed | Status: done Assignee: nadddder
Created: 2026-02-26 · Updated: 2026-03-06
Description
Summary
When a merchant is first created, the inventory field is empty (NULL in DB). If a user then hits “update” without changing any fields, the client often sends the default empty inventory payload (e.g. {"equipment":[],"requestConsult":false}). The activity diff treats this as a change and creates a “Merchant details updated” activity showing:
- Inventory: Empty →
{"equipment":[],"requestConsult":false}
So a no-op update produces a misleading activity entry.
Current behavior
- DB:
DbMerchant.inventoryisText(null=True, default=None)(app/db/master_tables.py~368). New merchants haveinventory = NULL. - Update diff: In
app/api/merchants_helpers.py(~817–838), the diff comparesold_value = getattr(existing_merchant, key)withnew_valuefrommerchant_updatesusingold_value != new_value. There is no special handling forinventory. - So when
old_valueisNone(or"") andnew_valueis the string'{"equipment":[],"requestConsult":false}', the diff records a change and an activity is created.
Proposed fix
- Normalize “empty” inventory in the diff
- When computing the activity diff for the
inventoryfield, treat the following as equivalent (no change):None""- JSON string that parses to an object with empty equipment and
requestConsult: false, e.g.{"equipment":[],"requestConsult":false}(and common variants, e.g. different key order or whitespace).
- Only record an “inve
- When computing the activity diff for the
Notes
Add implementation notes, blockers, and context here
Related
Add wikilinks to related people, meetings, or other tickets