Harden cloud lease lifecycle and races - #216
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the cloud primary lease implementation by addressing ambiguous renewal outcomes, disposal/operation races around the mutation gate, voluntary-release semantics, and stricter lease-document parsing, backed by expanded adversarial test coverage.
Changes:
- Route renewal outcomes that are ambiguous due to provider timeouts/I/O failures through the existing readback confirmation path (instead of immediately self-fencing).
- Defer mutation-gate disposal until all in-flight / waiting lease operations drain; adjust ReleaseAsync to end local authority without triggering the unexpected lease-loss callback.
- Fail closed on invalid UTF-8 lease documents and add tests covering acquisition races, release fencing, exact expiry boundaries, and malformed records.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/Pants.Tests/Support/TestDoubles/TestCloudObjectStore.cs | Adds seeding support to inject raw bytes/versions for lease-document parsing tests. |
| test/Pants.Tests/Support/TestDoubles/TestCloudLeaseStore.cs | Adds hooks and behaviors to simulate create/replace races and ambiguous write outcomes. |
| test/Pants.Tests/Cloud/CloudLeaseCoordinatorTests.cs | Adds targeted regression/adversarial tests for renewal ambiguity, disposal draining, CAS races, release fencing, parsing corruption, and boundary conditions. |
| src/Pants/Cloud/Internal/Leases/CloudObjectLeaseStore.cs | Enforces strict UTF-8 decoding and treats invalid bytes as corruption. |
| src/Pants/Cloud/Internal/Leases/CloudLeaseCoordinator.cs | Tracks active operations to safely dispose the mutation gate; broadens ambiguous renewal handling; adjusts release to end authority without spurious callbacks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #94
Closes #95
Closes #136
Closes #137
Closes #138
Closes #139
Closes #140
Closes #141
Summary
Compatibility
Validation