Change commands and retries
How does a stable change identity prevent dual or contradictory acceptance?
Scale alone does not ensure consistent retry behaviour. This proposed API binds the role, business object, change payload and expected state to each new intent. An idempotency key identifies the same intent after a response is lost.
Starting point Test document hotspots separately from overall load.
Assumptions for the example case
Our own fictitious example design: A text document with a character sequence and comments; several devices per person; deterministic merging; server-side checked permissions during synchronization. Figures and quality goals are illustrative test assumptions. Outside are table formulas, encrypted end-to-end cooperation and automatic content conflict resolution.
Retries and new intent
Synchronization envelope · Operation instead of document overwriting
The same operation identity returns the existing confirmation; different content causes a conflict and cannot silently become valid.
Proposed domain API contracts
- POST
/documents/{id}/changesSubmit offline change for acceptance.
- Input
- Editor identity, D-91, G-91, device counter, O-91, parent reference, character operation and canonical content up to 65536 UTF-8 bytes.
- Result
- Confirmed change identity when current write permission allows it. A missing dependency leaves the change waiting; revoked permission or a changed retry causes rejection.
- Retry behaviour
- An identical operation by the same authorised role on the same object, using the same key and canonical payload, returns the stored original result. A changed payload under that key is rejected. External result identifiers are durably deduplicated after authentication; new intents check the current version again.
- POST
/documents/{id}/grantsChange write permissions.
- Input
- Document owner, D-91, target person, role, expected permissions version, reason and key.
- Result
- New rights version applies atomically to the following change acceptance; historically confirmed changes are preserved.
- Retry behaviour
- An identical operation by the same authorised role on the same object, using the same key and canonical payload, returns the stored original result. A changed payload under that key is rejected. External result identifiers are durably deduplicated after authentication; new intents check the current version again.
- GET
/documents/{id}/syncRead confirmed changes since the known revision.
- Input
- Authorized identity,D-91, device reference and last confirmed change state.
- Result
- Missing accepted changes or snapshot with full revision watermark; local unconfirmed work remains separate.
- Retry behaviour
- Repeating a read creates no business effect; the returned current state may change between requests.
Protect change identity
Compare identity and canonical payload.
O-91 is sent again.
X is accepted once; Z under the same identity is rejected.
- Alternative considered
- Only counter progress overlooks manipulated repetition.
- Trade-off
- Metadata must be retained.
- Reassess
- Device change requires regulated new identity.
Terms in this step
- Protect change identity
- X is accepted once; Z under the same identity is rejected.
Try it yourself
Send O-91 with X twice and then with Z. Predict text effect and conflict.
A hint for your attempt
Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.
Compare with a possible solution
- First part of the solution
- X is accepted exactly once under O-91.
- Second part of the solution
- Z under the same identity is rejected; a real new change needs a new stable identity.
Apply to your project
Which corresponding assumption in your project would you check first? Use as an occasion: Device change requires a regulated new identity.