feat(dig-node): live eviction test for inbound-demand tier + remove dead demand wrappers - #166
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
…mtime Co-Authored-By: Claude <noreply@anthropic.com>
…ead demand wrappers Add a live eviction regression test proving an inbound-DEMANDED module survives a size-cap sweep that sacrifices an older-by-mtime Tier0Precache module through the real module_tier -> plan_module_eviction path (#2013). Remove the now-redundant inbound_demand_count / inbound_demand_tier Node wrappers (and both #[allow(dead_code)]); repoint in-module test callers to the InboundDemand field methods. Correct the SPEC + inbound_demand module doc: inbound demand assigns the Tier1Demand tag (eviction precedence), not a relevance term. Bump workspace 0.90.0->0.91.0 and dig-node-core 0.39.0->0.40.0. Co-Authored-By: Claude <noreply@anthropic.com>
…d ledger doc The relevance-score feed is superseded (#1934 tier-based eviction); inbound demand's keep-effect is the Tier1Demand tag via Node::module_tier. Correct the two remaining copies (struct-field doc + test doc) to match. Co-Authored-By: Claude <noreply@anthropic.com>
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 dig_ecosystem#2013.
Context — rescoped closeout (loop-decider reconciled)
#2013 (wire the tier-1 inbound-demand signal into live relevance + eviction) is ~90% already delivered by epic #1934 PR-3 (
eccc0cc):Node::module_tier(lib.rs:1352) = MAX(inbound_demand.tier(), tier-0 land ledger) →evict_modules_locked→plan_module_evictionsorts byevict_key=(tier.rank, mtime), soTier0Precacheevicts beforeTier1Demand, LRU within tier.relevance();RelevanceInputs.local_read_countis consumed only by the tier-0 selector scoring speculative DHT-sampled candidates. Feeding demand there would be speculative wiring with ~zero behaviour gain + anArc<InboundDemand>refactor — rejected per §2. Demand's keep-effect is delivered by theTier1Demandtag.So this PR is the honest closeout, not new wiring.
What changed
tests::inbound_demanded_module_survives_tier0_eviction_sweep(lib.rs): store A (note_inbound_demand→Tier1Demand, OLDER mtime) survives while store B (mark_tier0_land→Tier0Precache, NEWER mtime) is evicted, through the realmodule_tier→evict_modules_locked→plan_module_evictionpath. Non-vacuous: A is the older file, so pure LRU-by-mtime would evict A and keep B — the opposite of the assertion; it can only pass because tier beats mtime. (The ticket's "B older" wording was self-contradictory — LRU evicts oldest first, making an older-B test vacuous — so A-older/B-newer is the correct construction.)#[allow(dead_code)]demand wrappers — deletedNode::inbound_demand_count+Node::inbound_demand_tier(redundant withmodule_tier's directself.inbound_demand.tier()); repointed the 6 in-module test callers toself.inbound_demand.count/tier. Keptinbound_demand_entry_count(a realcache.statsconsumer). Madetier0_live::mark_tier0_landpub(crate)for the new test (retains its non-test consumer).clippy -D warningsclean.inbound_demand.rsmodule doc now says inbound demand assigns theTier1Demandtag giving eviction precedence (not "feedsrelevance's local-demand term"); the stale SPEC "relevance demand term" claim was already removed by PR-3, so added a clarifying clause thatlocal_read_countdrives tier-0 candidate selection and is legitimately0for speculative candidates.How verified
cargo fmt0,clippy -p dig-node-core -D warningsclean,buildgreen,cargo test -p dig-node-core --lib→ 635 passed, 9 failed (all the known socket-bind sandbox tests). The new test + allinbound_demandtests pass.Version
root
[workspace.package].version0.90.0 → 0.91.0;dig-node-core0.39.0 → 0.40.0;Cargo.lockregenerated (dig-node-service=0.91.0,dig-node-core=0.40.0). Minor.Generated by Claude Code