Why renaming a Candid record field can break clients

Candid encodes record labels as numeric identifiers. A source-level rename can therefore change the data contract even when the field type stays the same.

Test an old encoded argument

Consider an existing client that sends a record with a required amount field. A new endpoint expecting required quantity looks for a different numeric label. Renaming a local variable after decoding keeps the public interface intact. To change the wire contract, introduce a versioned method or plan an explicit compatibility transition.

v1: record { amount : nat }
v2: record { quantity : nat }
client still sends the numeric field ID for "amount"

Check compatibility in both directions

Save example arguments and responses from a released client. Decode them with the proposed interface and test the old client against new replies. A passing test of freshly generated bindings on both sides can conceal a break affecting already deployed callers.

Sources