Skip to content

feat(genome): rank_pages_for_eviction — single-source tier eviction policy - #1623

Merged
joelteply merged 2 commits into
canaryfrom
feat/genome-eviction-ranker
Jun 15, 2026
Merged

joelteply merged 2 commits into
canaryfrom
feat/genome-eviction-ranker

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

TierStore::evict must drop resident pages under pressure, but the trait defines no policy and each role runs a different canonical EvictionPolicy (tier.rs). This adds the single pure definition of "under THIS policy, which pages are least valuable to keep?" — the genome analog of paging::lease_revocation::select_leases_to_revoke. Every role-specific TierStore::evict delegates to ONE ordering instead of re-encoding it inline.

rank_pages_for_eviction(pages: &[ResidentPage], policy: &EvictionPolicy) -> Vec<PageRef>

Pure, no I/O, no mutation. Pinned pages excluded (composition layer protects them mid-turn). Per-policy order:

  • LruWithinTurn / LruAcrossTurns — oldest last_access_ms first.
  • LfuPlusRecency — fewest access_count_window first, oldest as recency tiebreak.
  • DemandAlignedWithRefinedPreference — shares LFU's ResidentPage-level order (least-demanded first); its refined-over-imported preference needs blob provenance (not on ResidentPage) and is layered on by the TierStore.
  • AppendOnlyGcOnSleep — empty (Frozen never evicts on the hot path).

Deterministic for a given input order (stable sort). The caller walks the order, dropping pages until enough bytes are freed — so evict() stays a thin loop with no policy logic.

Scope

This is the pure policy; the role-specific stores (FastTierStore=VRAM, BenchTierStore=SSD, …) that call it are the I/O-bearing follow-ups. The trait + an InMemTier stub already exist in store.rs.

Validation (rust:1.95, continuum-core --lib)

6 passed; 0 failed (one per policy family + pinned-excluded + empty-input) · CARGO_EXIT=0 · clean compile.

🤖 Generated with Claude Code

…olicy

`TierStore::evict` (genome/store.rs) must drop resident pages under memory
pressure, but the trait defines no policy and each role runs a different
canonical `EvictionPolicy` (tier.rs). This adds the single, pure definition
of "under THIS policy, which pages are least valuable to keep?" — the genome
analog of `paging::lease_revocation::select_leases_to_revoke`. Every
role-specific TierStore::evict delegates to ONE ordering instead of
re-encoding it inline.

`rank_pages_for_eviction(pages: &[ResidentPage], policy: &EvictionPolicy)
-> Vec<PageRef>` — pure, no I/O, no mutation. Pinned pages excluded (the
composition layer protects them mid-turn). Per-policy order:
- LruWithinTurn / LruAcrossTurns — oldest last_access_ms first.
- LfuPlusRecency — fewest access_count_window first, oldest as recency
  tiebreak.
- DemandAlignedWithRefinedPreference — shares LFU's ResidentPage-level order
  (least-demanded first); its refined-over-imported preference needs blob
  provenance (not on ResidentPage) and is layered on by the TierStore.
- AppendOnlyGcOnSleep — empty (Frozen never evicts on the hot path).

Deterministic for a given input order (stable sort). The caller walks the
returned order, dropping pages until enough bytes are freed — so evict()
stays a thin loop with no policy logic.

Validated rust:1.95 (continuum-core --lib): 6 tests pass (one per policy
family + pinned-excluded + empty-input), CARGO_EXIT=0, clean compile.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…tion (reviewer nit, #1623)

Pages equal on the policy signal now break by a total order on PageRef
(page_order_key), so a TierStore can pass its HashMap-backed pages directly
without run-dependent eviction order — matching the lease_id tiebreak in
select_leases_to_revoke. Added a test feeding the same snapshot in both
input orders and asserting identical output.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply
joelteply merged commit 9fce671 into canary Jun 15, 2026
@joelteply
joelteply deleted the feat/genome-eviction-ranker branch June 15, 2026 00:28
@github-actions github-actions Bot added size: L and removed size: M labels Jun 15, 2026
joelteply added a commit that referenced this pull request Oct 31, 2026
Card 2a0d34cf: land the identity custody fix in base.

762adeb2 is the airc canary head + the read-never-mints identity
custody fix (fix/read-never-mints-identity, card 4b2dbdf3): a READ of
the work board on a named home no longer silently mints and overwrites
a citizen's identity.key; init --as mints explicitly.

Bumps every workspace pin in Cargo.toml [workspace.dependencies]
(airc-core, airc-blobs, airc-protocol, airc-ipc, airc-bus, airc-lib,
airc-wire, airc-trust, airc-work) and re-resolves Cargo.lock to the new
rev (15 lock entries).

This rev already carries #1623 (sealed progress / terminal reply
lifecycle, which satisfied the c7083d04 BLOCKED note) plus #1618, #1624,
#1630, #1633, #1635 on top.

Suite status: airc suite green at 762adeb2 (identity_commands 10/10,
airc-identity unit+doc). continuum suite re-run follows against this pin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant