fix(first-leg): freeze versioned submission commands across retries

This commit is contained in:
2026-10-02 23:08:58 +08:00
parent 187deb5047
commit e564353a80
6 changed files with 251 additions and 30 deletions
@@ -213,13 +213,13 @@ test('uses the versioned merchant cancellation contract', () => {
test('sends an idempotency key for create and submit writes', () => {
assert.match(apiSource, /'Idempotency-Key': createIdempotencyKey\('first-leg-create'\)/)
assert.match(apiSource, /submitMerchantFirstLegOrder\(id: number \| string, idempotencyKey: string\)/)
assert.match(apiSource, /submitMerchantFirstLegOrder\(id: number \| string, payload: \{ expectedVersion: number \}, idempotencyKey: string\)/)
assert.match(apiSource, /'Idempotency-Key': idempotencyKey/)
assert.match(apiSource, /createMerchantFirstLegOrderBatch\(items: MerchantBatchDraftItem\[\], idempotencyKey: string\)/)
assert.match(apiSource, /headers: \{ 'Idempotency-Key': idempotencyKey \}/)
assert.match(storeSource, /createMerchantFirstLegOrderBatch\(items, idempotencyKey\)/)
assert.match(storeSource, /pendingSubmitKeys\.get\(id\) \?\? createIdempotencyKey\(`first-leg-submit-\$\{id\}`\)/)
assert.match(storeSource, /submitMerchantFirstLegOrder\(id, idempotencyKey\)/)
assert.match(storeSource, /pendingSubmissions\.get\(id\)/)
assert.match(storeSource, /submitMerchantFirstLegOrder\(id, pending\.payload, pending\.key\)/)
})
test('does not expose the contradictory backend rejected state in the client model', () => {