Skip to content

feat(dig-node): live eviction test for inbound-demand tier + remove dead demand wrappers - #166

Merged
MichaelTaylor3d merged 4 commits into
mainfrom
feat/2013-inbound-demand-eviction-closeout
Aug 3, 2026
Merged

feat(dig-node): live eviction test for inbound-demand tier + remove dead demand wrappers#166
MichaelTaylor3d merged 4 commits into
mainfrom
feat/2013-inbound-demand-eviction-closeout

Conversation

@MichaelTaylor3d

Copy link
Copy Markdown
Contributor

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):

  • Eviction (b) — DONE: Node::module_tier (lib.rs:1352) = MAX(inbound_demand.tier(), tier-0 land ledger) → evict_modules_lockedplan_module_eviction sorts by evict_key=(tier.rank, mtime), so Tier0Precache evicts before Tier1Demand, LRU within tier.
  • Relevance (a) — SUPERSEDED: post-#1934 the cache evicts by tier, not by relevance(); RelevanceInputs.local_read_count is consumed only by the tier-0 selector scoring speculative DHT-sampled candidates. Feeding demand there would be speculative wiring with ~zero behaviour gain + an Arc<InboundDemand> refactor — rejected per §2. Demand's keep-effect is delivered by the Tier1Demand tag.

So this PR is the honest closeout, not new wiring.

What changed

  • Live eviction regression testtests::inbound_demanded_module_survives_tier0_eviction_sweep (lib.rs): store A (note_inbound_demandTier1Demand, OLDER mtime) survives while store B (mark_tier0_landTier0Precache, NEWER mtime) is evicted, through the real module_tierevict_modules_lockedplan_module_eviction path. 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.)
  • Removed both #[allow(dead_code)] demand wrappers — deleted Node::inbound_demand_count + Node::inbound_demand_tier (redundant with module_tier's direct self.inbound_demand.tier()); repointed the 6 in-module test callers to self.inbound_demand.count/tier. Kept inbound_demand_entry_count (a real cache.stats consumer). Made tier0_live::mark_tier0_land pub(crate) for the new test (retains its non-test consumer). clippy -D warnings clean.
  • Doc/SPEC drift correctedinbound_demand.rs module doc now says inbound demand assigns the Tier1Demand tag giving eviction precedence (not "feeds relevance's local-demand term"); the stale SPEC "relevance demand term" claim was already removed by PR-3, so added a clarifying clause that local_read_count drives tier-0 candidate selection and is legitimately 0 for speculative candidates.

How verified

cargo fmt 0, clippy -p dig-node-core -D warnings clean, build green, cargo test -p dig-node-core --lib → 635 passed, 9 failed (all the known socket-bind sandbox tests). The new test + all inbound_demand tests pass.

Version

root [workspace.package].version 0.90.0 → 0.91.0; dig-node-core 0.39.0 → 0.40.0; Cargo.lock regenerated (dig-node-service=0.91.0, dig-node-core=0.40.0). Minor.


Generated by Claude Code

claude added 4 commits August 3, 2026 09:54
…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>
@MichaelTaylor3d
MichaelTaylor3d merged commit 0ea07c6 into main Aug 3, 2026
15 checks passed
@MichaelTaylor3d
MichaelTaylor3d deleted the feat/2013-inbound-demand-eviction-closeout branch August 3, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants