Skip to content

Add expectedChecksum support to set, setMany, and setNull#85

Merged
zeevdr merged 1 commit into
mainfrom
feat/expected-checksum
May 24, 2026
Merged

Add expectedChecksum support to set, setMany, and setNull#85
zeevdr merged 1 commit into
mainfrom
feat/expected-checksum

Conversation

@zeevdr
Copy link
Copy Markdown
Member

@zeevdr zeevdr commented May 24, 2026

Summary

  • ChecksumMismatchError was exported but unreachable because no write method ever sent a checksum to the server; this surfaces it as a real, usable API.
  • Adds expectedChecksum to set() and setNull(), and expectedChecksums (per-field record) to setMany(), so callers can enforce optimistic concurrency when writing config values.

Test plan

  • set() passes expectedChecksum through to the proto request
  • set() raises ChecksumMismatchError when the server returns ABORTED
  • setMany() maps per-field checksums onto the correct FieldUpdate entries; fields without a checksum get undefined
  • setMany() raises ChecksumMismatchError on ABORTED
  • setNull() passes expectedChecksum through to the proto request
  • setNull() raises ChecksumMismatchError on ABORTED
  • All 192 tests pass, biome and tsc clean

Closes #54

Adds optimistic concurrency control to all write methods. Callers can
pass a checksum from a previous GetField/GetConfig response to prevent
lost updates when multiple actors modify the same field concurrently.
The server returns ABORTED on mismatch, which the SDK maps to
ChecksumMismatchError.

- set/setNull: new expectedChecksum option
- setMany: new expectedChecksums record option (per-field)

Co-Authored-By: Claude <noreply@anthropic.com>
Closes #54
@zeevdr zeevdr added this to the Beta Readiness milestone May 24, 2026
@zeevdr zeevdr added size: S Quick win — a few hours or less priority: P1 Current milestone work labels May 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@zeevdr zeevdr merged commit c420e64 into main May 24, 2026
14 checks passed
@zeevdr zeevdr deleted the feat/expected-checksum branch May 24, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: P1 Current milestone work size: S Quick win — a few hours or less

Projects

None yet

Development

Successfully merging this pull request may close these issues.

expected_checksum support across SDK (or remove ChecksumMismatchError)

1 participant