Partial Update Omission Behavior
Establish what an omitted field does during a partial update, because an omission that resets to default is a mutation the caller never asked for
Use when: the API supports partial updates and the semantics of omitted fields are unconfirmed
Avoid when: omitted fields are documented as unchanged and a test confirms the stored value survives
Procedure
- Capture the full state of a synthetic record you own before the update.
- Send a partial update touching one field while omitting several others.
- Read the record back and compare every field against the captured state, not only the one you sent.
- Identify any omitted field that changed, reset or lost precision as a side effect.
- Repeat once with a different subset omitted to confirm the behaviour is about omission rather than the field.
- Record which fields are preserved, reset or recomputed on omission.
Signals
- An omitted field resets to a default rather than keeping its value
- A numeric or precision-bearing field changes when it was not mentioned
- A nested object is replaced wholesale when only a sibling field was updated
- The behaviour differs between two subsets of omitted fields
Patterns
1. Diff record
before: {a: 1, b: 2, c: 3}
update: {b: 9}
after: {a: 1, b: 9, c: 0} <- omitted c reset
2. Full-diff rule
compare every field rather than only the one you sent; the side effect is on a field you did not touch
3. Subset repeat
a second omission subset separates a field-specific behaviour from a general omission rule
Pitfalls
- Checking only the field that was sent, which is exactly how a reset goes unnoticed
- Attributing a reset to the update when it was caused by a server-side recompute
- Concluding safe behaviour from one subset and never varying it
Done when
- Every field on the record is diffed before and after the partial update
- Preserved, reset and recomputed fields are listed with a confirming second subset