Skip to content

feat: Check the preconditions on a subject recursively, for the subject together with every subject below it. - #433

Merged
goloroden merged 4 commits into
mainfrom
432-check-preconditions-on-a-subject-recursively
Oct 23, 2026
Merged

goloroden merged 4 commits into
mainfrom
432-check-preconditions-on-a-subject-recursively

Conversation

@goloroden

Copy link
Copy Markdown
Member

The preconditions on a subject can now apply to the subject together with every subject below it, through PreconditionOptions with recursive, as the v2 API of EventSourcingDB offers it (thenativeweb/eventsourcingdb#1277). Existing calls send the same requests as before.

Against a server without the v2 API, a write with a recursive precondition fails with an IncompatibleServer error before the write is sent, rather than being checked on the subject alone. Before it fails, the client asks the server once more which API it offers, if it had remembered v1, so that a server upgraded while the application runs is used through v2 at once; every other request keeps using the remembered answer meanwhile.

The options are an optional last parameter, so every existing call keeps working; a point-free call such as subjects.map(isSubjectPristine) no longer compiles in TypeScript, since map passes the index as the second argument. On v1, only options with recursive set to false are stripped; anything else is refused, so that a caller without types never gets a check on the subject alone without notice.

The tests against the preview image pass once it contains thenativeweb/eventsourcingdb#2398.

Closes #432

🤖 Generated with Claude Code

https://claude.ai/code/session_01CiuYmw4N6SSzfFyrwftUEj

goloroden and others added 4 commits October 23, 2026 07:13
… API, and refuse a recursive one before sending it to a server without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CiuYmw4N6SSzfFyrwftUEj
…nd refuse any but a non-recursive one on a server without the v2 API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CiuYmw4N6SSzfFyrwftUEj
…sing a write with a recursive precondition, so that a server upgraded meanwhile gets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CiuYmw4N6SSzfFyrwftUEj
…again before a recursive write, and keep it if finding out fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CiuYmw4N6SSzfFyrwftUEj
@goloroden
goloroden requested a review from a team as a code owner October 23, 2026 08:22
@goloroden goloroden self-assigned this Oct 23, 2026
@goloroden
goloroden merged commit 1ef85db into main Oct 23, 2026
3 checks passed
@goloroden
goloroden deleted the 432-check-preconditions-on-a-subject-recursively branch October 23, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check preconditions on a subject recursively

1 participant