Skip to content

Make the first S3 write create-only - #5

Open
janbjorge wants to merge 2 commits into
claude/code-review-bugs-vokwlk-02-heartbeat-requires-in-progressfrom
claude/code-review-bugs-vokwlk-03-s3-conditional-create
Open

janbjorge wants to merge 2 commits into
claude/code-review-bugs-vokwlk-02-heartbeat-requires-in-progressfrom
claude/code-review-bugs-vokwlk-03-s3-conditional-create

Conversation

@janbjorge

@janbjorge janbjorge commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Stack 3/9, base #4.

With if_match=None the S3 put was unconditional, so two processes creating the object could overwrite each other. Now sends IfNoneMatch="*" and maps ConditionalRequestConflict to CASConflictError.

Tests: test_write_without_if_match_is_create_only, test_racing_first_writes_second_gets_cas_conflict, test_racing_first_enqueues_both_survive fail on base; test_write_with_if_match_sends_condition, test_write_other_client_error_is_not_cas_conflict pass on both.

With if_match=None, S3Storage omitted IfMatch and did an unconditional
PutObject. Two processes bootstrapping an empty key both read (b"", None)
and both wrote, so the loser's first operation (e.g. an enqueue) was
silently overwritten. InMemoryStorage, LocalFileSystemStorage and
GCSStorage already treat if_match=None as "must not exist".

Send IfNoneMatch="*" when if_match is None so S3 rejects the second
creator with PreconditionFailed, and also map 409
ConditionalRequestConflict to CASConflictError. Document if_match=None
as create-only in the port contract and README.

This branch has not been deployed

No deployments
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.

1 participant