Repository navigation
refactor(master): extract claim eligibility into a pure module - #336
Merged
beinan merged 1 commit intoOct 8, 2026
Merged
Conversation
`claim_next` decided per candidate whether this poller may attempt the claim transaction through a chain of inlined `continue`s: kind filter, resident-only filter, preparation shape, commit-ready yield, seven-key ownership predicate and the worker-execution rule. None of it was unit testable without etcd and no skip had a name. Move those decisions to `eligibility.rs` as functions of plain inputs (`pre_dependency_filter`, `claim_shape`, `admission_filter`) returning `Result<(), Skip>`. `claim_next` keeps the same etcd reads in the same order, maps `YieldToPreparedCommit` and `OwnershipBlocked` to the existing counters, and traces every other skip with its reason. No behaviour change. `requires_target_lock` moves unchanged. The `preparing` predicate, which was computed twice with slightly different spelling, now exists once. Validation: 7 new etcd-free unit tests cover resident filtering, preparation opt-in, catch-up sharing, the commit-ready yield including the recovery bypass, every ownership predicate, and the worker-execution rule. Clippy -D warnings, fmt and typos clean. task_store (23) and scheduler (31) etcd-backed suites pass locally. Refs lance-format#333. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
17 of 18 tasks
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.
Part of #333 (P0.1).
Problem
claim_nextintask_store.rsdecides per queued candidate whether this poller may attempt the claim transaction through a chain of inlinedcontinues: kind filter, resident-only filter (#331), preparation shape (#308/#327), commit-ready yield (#324), the seven-key ownership predicate, and the worker-execution rule. None of it was testable without etcd, thepreparingpredicate existed twice, and no skip had a name.Approach
New
eligibility.rswith three pure functions:pre_dependency_filter,claim_shape,admission_filter, each returningResult<(), Skip>.claim_nextperforms the same etcd reads in the same order and feeds them in;YieldToPreparedCommitandOwnershipBlockedmap to the existing counters, every other skip is traced with its reason.No behaviour change. This is the foundation for the planner's filter phase and for the "why not now" surface.
Alternatives
Testing through etcd integration only (status quo): too slow and too coarse to pin down individual predicates. A trait over the store: more machinery than needed; plain inputs are enough.
Validation
cargo clippy --all-targets -D warnings,cargo fmt --check,typosclean.task_store23/23,scheduler31/31.🤖 Generated with Claude Code