Repository navigation
Conversation
…B store (ITL-1452) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 13 billable files and costs up to $3.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 59 minutes for your next included review. View limit details
|
Codecov Report❌ Patch coverage is
... and 4 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
Closing: this lease was written for the earlier SpiralDB client and a drop-based design. spiral-sdk offers no keyed-table drop and no conditional metadata write, so the lease is redesigned with generation tables (PR #588, section 5) and is being rebuilt on current main in ITL-1838. Tracked in ITL-1452. Posted by a Claude Code agent on behalf of @eywalker. |
Fixes ITL-1452. Part of ITL-1446 (design: PR #542, sections 4, 8 and 11).
Inert. A private module,
databases/_spiral_lease.py, with tests on the fake. No library module imports it (a test checks), so no job behaves differently and no hash, stored path, layout or golden value moves. No live SpiralDB was used. There is no changelog fragment of its own: nothing is visible to users.This branch merges PR #544 (the stricter fake) in. Until #544 lands, its commits, including
changelog.d/ITL-1446.md, show in this diff.What it does
orcapod_lease_v1is created exclusively; the owner text is the name of its one key column; SpiralDB's table id is the lease. One claim has one token (UUIDv7 with the operating system's random bits, so a fork cannot repeat it). A failed create is settled by one look at the name, against the token: mine, someone else's, absent, or unreadable. Only "mine" holds. No retry loop.clear_lease) is by a person, for the exact id, and never drops a table that is not the dataset's current lease. Nothing expires.WriteCapability, checked at admission for process, state, lease generation and dataset. Each piece of registered work has its own, revoked when the work ends. A context variable only locates it, and it is taken away around user code.Decisions this rests on
take_lease,_settle_create,Lease.checkclear_leasewrite_sessioncurrent_capability,_Session.admitCachedSourceread is refused while another run holds the storeNew, not in the design, please confirm: a commit that raised, and that its writer has not settled, may still land on the service, so the session leaves the lease behind (
_Session._release, one place). The cost is that a network error in a commit can need a person to clear the lease.Held back, after the second review of the design
Leases of several datasets in one run, one dataset under two addresses (refused, never adopted), automatic clearing, any claim that a timeout proves that no request can still land, and all integration. So the section 4.5 rows on two datasets and on aliases are implemented only as refusals, and the rows on job entry points,
load_onlyandCachedSourcebelong to PR 8.test_drops_go_by_id_and_a_repeated_drop_spares_a_newer_lease,test_never_two_holders_in_any_interleavingtest_a_create_that_landed_without_its_reply_is_recognised,test_a_lost_refusal_is_a_refusal,test_a_lookup_that_fails_never_grants_the_lease,test_a_name_that_looks_free_does_not_prove_the_lease_is_gonetest_a_late_create_is_a_lease_left_behind_never_a_second_holder,test_a_commit_that_failed_may_still_land_so_the_lease_staystest_the_locator_alone_authorizes_nothing,test_a_users_thread_has_no_authority,test_a_users_generator_has_no_authority_at_any_step,test_works_capability_ends_with_the_worktest_closing_admits_only_what_is_already_running,test_a_cancelled_run_waits_for_the_commit_its_thread_is_sending,test_the_final_flush_runs_after_the_drain_and_before_release,test_an_interrupted_drain_keeps_the_lease,test_a_forked_child_cannot_write_and_never_releasesThe documented window of 4.3 is asserted as it is:
test_the_documented_window_a_commit_past_its_check_lands.Tests
82 tests, no sleeps: each request goes through a scripted wire.
test_never_two_holders_in_any_interleavingvisits every order of the requests of 2 and 3 writers, and for 2 writers one fault at every place (crash before or after, lost reply, late create, late drop). Eleven deliberate breakages of the module, among them dropping by name and dropping the capability checks, each fail at least one test.Added to the fake, each tied to a live measurement of section 4.1: an atomic exclusive create with a 409, drop by id with a 404, commits that are one step. Dropping by name looks the id up first (pyspiral 0.16.33's source).
Run locally: the suites that use the fake and the repository checks (2334 passed, 6 xfailed), ruff, whole-repository basedpyright (0 errors), golden
--checkclean. After that run only the lease tests changed, for types; those were run again.🤖 Generated with Claude Code