Repository navigation
feat: commit preconditions judged on the manifest a commit lands on - #8801
Conversation
a202bc2 to
9ecb5b6
Compare
2d6f91f to
673de02
Compare
9ecb5b6 to
07a65b8
Compare
673de02 to
2fdd8f3
Compare
07a65b8 to
8e0cf3e
Compare
`CommitBuilder::with_precondition` takes a `CommitPrecondition`, judged on the latest manifest on every attempt; publication is then conditioned on that manifest still being the predecessor through `CommitHandler::commit_after`. The handle's version must also still carry the identity it was loaded with, so a candidate is never built from a deleted incarnation. Refusal is `PrerequisiteFailed`; handlers that cannot decide it atomically, detached commits, dataset creation and URI destinations (which resolve to whatever occupies the URI now) refuse the option outright. `RequiredSchemaMetadata` is the first precondition, with `with_required_schema_metadata(key, value)` as shorthand. The session manifest, transaction and index-metadata caches key on identity too, since a recreated dataset reuses version numbers. Co-Authored-By: Claude Fable 5 <[email protected]>
8e0cf3e to
375e58f
Compare
There was a problem hiding this comment.
❌ Gate recommendation: request changes.
The current PR patch is unchanged by this rebase, and both prior code findings remain fixed.
The dependency sequence is still incomplete: this commit consumes predecessor-publication APIs supplied only by the open base PR #8800. Land #8800 into main first, then rebase or retarget this PR onto that landed commit so this change cannot be accepted without its atomic publication contract.
Xuanwo
left a comment
There was a problem hiding this comment.
An opt-in commit handler can satisfy the documented put_if_predecessor contract and report a successful write that never becomes the latest version. On 375e58f3, judge_preconditions reads the latest manifest, while target_version comes from dataset.manifest.version + 1. The reservation checks the identity of a retained version record and the availability of the target. After version cleanup, both checks can hold even though the branch has moved on.
Please derive the candidate version from the manifest whose preconditions passed and require the handler to confirm atomically at publication that this manifest is still the branch head. A handler that cannot guarantee this should refuse the operation. Please cover strict overwrite from an old handle and append overlapping cleanup through CommitBuilder, checking that a reported success is visible when reopening the latest version.
This finding comes from the commit path and the handler contract. #8800 has landed at e7fecb960, so this PR can now target main.
CommitBuilder::with_preconditiontakes aCommitPrecondition, judged onthe latest manifest on every attempt; publication is then conditioned on
that manifest still being the predecessor through
CommitHandler::commit_after. The handle's version must also still carrythe identity it was loaded with, so a candidate is never built from a
deleted incarnation. Refusal is
PrerequisiteFailed; handlers that cannotdecide it atomically, detached commits, dataset creation and URI
destinations (which resolve to whatever occupies the URI now) refuse the
option outright.
RequiredSchemaMetadatais the first precondition, withwith_required_schema_metadata(key, value)as shorthand. The sessionmanifest, transaction and index-metadata caches key on identity too, since
a recreated dataset reuses version numbers.