Repository navigation
fix(node,dht): sweep the republish scheduler after a lagged commit stream - #1806
Conversation
…ream The republisher schedules a blob's first DHT `Store` off the cache's `subscribe_inserts` broadcast. That channel is bounded and retains nothing it drops, so a `Lagged` receiver cannot backfill — its own API contract says a lagged consumer must force a full republish sweep. The handler only logged, leaving every hash committed inside the lag window with no DHT record until an operator restarted the node. The `Lagged` arm now re-derives the held set and seeds whatever is missing, drawing `uniform(0, 40 min)` per record so the repair costs one cold-start window rather than a burst — an immediate bulk republish is non-conforming here for the reason it is at boot. The sweep runs detached (the store walk costs one `status()` per blob) and coalesces, so repeated lags under sustained commit pressure do not stack walks. `holder_snapshot` lifts the origin-held ∪ store union out of runtime bring-up so cold start and the sweep cannot drift apart. Seeding is now idempotent: `seed_cold_start` skips an already-scheduled hash instead of pushing a second heap entry. A duplicate drained twice and bought one spurious republish per re-seed, which also affected the periodic origin rescan. Its return value counts hashes *newly* scheduled. `schedule_cold_start` is removed — it bypassed the new guarantee and nothing called it. Three counters make the window alertable, with matching `live` rows in the observability registry. Also corrects four passages that still describe the staker-set resync as a follow-up. It shipped in #1498: `RegistrySink::on_tick_complete` re-enumerates `getRegisteredNodes` every `REGISTRY_RESYNC_INTERVAL`, which is what repairs a `nodeIdOf` resolve-failure drop. A regression test pins both legs. The trigger is the cadence, not the recovery edge — no `LogSink` hook carries the poller's error state — so the corrected prose says that rather than over-claiming. Closes #1561
Review findings on the lag sweep, in severity order. The single-flight flag was cleared by a statement after the `await`, so a panic inside the store walk — iroh-blobs is outside the workspace anti-panic lints, and the `JoinHandle` is dropped — stranded it `true` and disabled every later sweep for the process lifetime. The counter kept climbing while the repair counter stayed flat, which the metric docs read as the healthy case: a wedge that looks like health. The slot now releases through `prune_guard::PruneGuard`, the existing RAII helper built for this exact hazard on the rate-limiter sweeps. Coalescing dropped lags instead of re-running. Each pass re-derives the held set once, at its start, so a lag observed mid-walk concerns commits that snapshot cannot contain — skipping it stranded exactly the blobs the sweep exists to recover, contradicting ADR 022 AC 20. The request is now published before the slot is claimed and the worker loops while it can consume one. `decdn_dht_republish_lag_sweeps_total` increments before the claim, so it counts lag events rather than store walks. That placement is worth keeping — it is what makes a wedged slot diagnosable — so the docstring and the ADR row say so instead. `decdn_dht_republish_sweep_failures_total` becomes `..._seed_store_walk_failures_total` and now covers the boot-time cold start, which shares one derivation with the sweep and degraded with no metric at all. A closed cache-commit channel now stops the republisher. `recv` on a closed channel resolves instantly and forever, so the old log-and- continue arm would have spun a core; the task's own `CacheEngine` clone keeps the sender alive, which is what made it unreachable. Doc corrections, all verified against the code: - The resync prose overclaimed. `reconcile_routes` skips an errored route, and a failed `full_snapshot` stamps the clock and defers a further interval — both correlated with the RPC fault that caused the drift. It shortens the window; it does not bound it. - ADR 022 said a publisher re-derives every hash it *holds*, which an origin-only node must not do. It re-derives what it *advertises*. - `HolderSnapshot` is the input to both full seeds, not to every seed — the periodic origin rescan seeds the origin half alone. - `runtime/mod.rs` cited ADR 022 AC 16 (BatchStore acks) for the cold-start seed; AC 15 is the cold-start jitter criterion. - The appendix row for `staker_set_watcher_resolve_failures_total` had drifted from its Rust twin. Tests: the idempotence test asserted `is_empty()`, which reads the `scheduled` set and cannot observe a duplicate heap entry — a mutant that pushed the entry and returned `false` passed. It now asserts heap length, and fails on that mutant. Adds a `lag_sweep` unit test pinning the reseeded count against a pre-seeded scheduler, and an origin-only policy test that runs both polarities so the assertion is a contrast rather than an absolute.
There was a problem hiding this comment.
Pull request overview
This PR adds recovery for lagged cache-commit events in DHT republishing and updates related observability and registry-resync documentation.
Changes:
- Adds jittered, idempotent lag-sweep reseeding and shared holder snapshots.
- Adds metrics and regression tests for lag recovery and origin-only behavior.
- Updates runtime integration, ADRs, documentation, and changelog entries.
Three unresolved moderate issues remain in publish.rs involving worker handoff, duplicate scheduling, and origin-held content checks. Several documentation corrections are also needed.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Summary |
|---|---|
crates/node/tests/dht_bootstrap.rs |
Adds lag-recovery and origin-policy tests. |
crates/node/src/runtime/mod.rs |
Integrates shared snapshots and startup recovery; needs comment updates. |
crates/node/src/prune_guard.rs |
Documents the sweep guard behavior. |
crates/node/src/metrics.rs |
Adds republish metrics. |
crates/node/src/dht/publish.rs |
Implements lag sweeps and scheduler changes; contains three unresolved moderate issues. |
crates/node/src/dht/chain_staker_set.rs |
Updates registry-resync documentation. |
crates/node/src/dht/capacity_bond_registry.rs |
Adds resync regression coverage. |
CHANGELOG.md |
Records the resilience fixes. |
adr/appendix-observability.md |
Registers metrics; needs wording correction about drift bounds. |
adr/022-content-discovery.md |
Documents lag-sweep requirements. |
Suppressed comments (2)
crates/node/src/dht/publish.rs:344
- When
relay_foreign_namespacesis false, skippingiter_hashesalso skips recovery of own non-pinned HTTP/S3 objects:origin_held_hashes()is only an inventory of enumerable origins and present pins, and remote origins deliberately do not enumerate. If such an object was committed but its insert event was dropped, it is in neither half of this snapshot and is never re-seeded. Origin-only mode needs a complete ownership-aware inventory (or an equivalent store scan/filter) to satisfy the full advertised-set recovery guarantee.
if relay_foreign_namespaces {
match cache.iter_hashes().await {
Ok(stored) => hashes.extend(stored),
Err(err) => store_error = Some(err),
crates/node/src/metrics.rs:403
- The final sentence makes the boot failure sound permanent, but a later successful lag sweep can re-enumerate and schedule the store-only hashes. This should describe process lifetime as the no-later-sweep case; otherwise the metric documentation contradicts the recovery path and can mislead incident diagnosis.
/// rather than failing, so nothing else surfaces this: blobs held only
/// in the store stay un-republished until a later sweep or a restart,
/// and on the boot path that is the whole process lifetime.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Review findings on #1806. `RepublishScheduler` tracked bare membership, but a `BinaryHeap` cannot reschedule an interior entry — so every supersede left a tombstone that a later schedule resurrected: it popped already-overdue, passed a membership-only test, and bought a spurious republish. Three call patterns reach it: a re-seed racing the eager per-insert publish, a re-seed racing the tick path's drain-then-reschedule, and `unschedule` followed by a re-seed. `scheduled` now maps each hash to the one due time that counts and `drain_due` discards any entry that disagrees, which also lets `schedule_steady` go back to an unconditional fresh draw per ADR 022 step 3. The sweep slot's release and its re-check had to be one atomic step. A request published between a worker's final check and its release was stranded: the producer saw the slot busy, the worker then exited with nothing left to consume it, and with no later lag those commits were never swept. The slot is now three-state and the release IS the compare-exchange, so it fails if a request landed first. The RAII guard covers the panic path only and is disarmed on the clean path, where a plain store would clobber a producer that had already claimed the slot. `cache_still_holds` consulted only the iroh-blobs store, so a filesystem or pinned-origin hash that was never imported was advertised at probe time via `origin_held_size` yet dropped at its first due time, publishing no `Store` at all. It has silently discarded what the cold-start seed feeds it since #1130. An origin-only node now recovers its own store-only content. The origin-held index covers enumerable origins plus present pins, and a remote S3/R2/HTTP origin deliberately does not enumerate, so an unpinned object the node owns sat in neither half of the snapshot. Stored hashes are put to `origin_probe_presence` — the same question the origin-only serve gate asks — so the snapshot advertises exactly what the node would serve. `Fault` is skipped, never admitted: a blip must not become an advertisement, and faults are not memoised. Doc corrections: the appendix paragraph still said the drift window was "bounded by that cadence", contradicting the row this PR had already corrected; a second `AC 16` reference survived at the bootstrap comment where `AC 15` belongs; and the boot-degradation warn and metric doc both claimed the loss lasted until restart, which the lag sweep now disproves. Tests: the two new invariant tests were vacuous on first writing — jitter meant the stale entry usually was not due yet, so `drain_due` broke out before reaching the check. Rebuilt to construct the exact state; both now fail against membership-only logic. Adds coverage for the origin-held due gate and for origin-only ownership recovery, and gives the stub origin a third axis so a remote origin (answers `size`, never enumerates) is modellable.
|
Addressed the review in 66a1aa7. Both suppressed comments were valid and are also fixed:
Two notes on the fixes themselves:
Both new invariant tests were vacuous when first written (jitter meant the stale entry usually was not due yet, so 1383 tests pass, clippy and rustdoc clean. |
Coverage reportTotal: 81.81% (was 81.71%, ▲ +0.09%) — 66248/80982 lines
History
|
Seven inline findings and four substantive suppressed ones, all verified against the code first. Three were claims this branch introduced that are not true. cache: the origin-held index and the counts describing what the rescan behind it could not resolve are now one `ArcSwap` payload. Published separately, a seed could pair a fault-truncated index with a later rescan's zero fault count and report a short announce set as healthy — the exact failure the counts exist to expose, and reachable because the periodic and reload rescans are detached. cache: candidates dedupe on their own `seen` set. Keying off the index being built meant a hash that resolved `Absent`, or faulted with nothing to carry forward, was re-probed once per listing it appeared in — and counted a fault per probe, so a duplicate inflated the very number the seed reads. cache: `decdn_cache_origin_enumerate_failures_total` covers the rescan's other leg. An origin whose listing fails contributes no candidates at all, so its hashes leave the announce set with no per-hash fault and nothing to carry forward. Counting only probe faults left that shrink silent, which is what this whole change is about. dht: the origin-only ownership probe counts its faults the same way. A `Fault` there is skipped rather than announced — correct, since a blip must not turn into an advertisement the serve gate would refuse — but skipping is still a hash this node holds and does not announce, and on a remote origin it dropped a node's own store-only content while the snapshot read healthy. dht: `run_republish` takes a `CancellationToken` the runtime owns and cancels before the cache flush, replacing the `oneshot`. The previous shape cancelled the sweep when the republisher returned, and nothing orders that against the flush: the stop signal only reaches the sweep once the republisher is next polled. The race was narrowed, not closed. Docs corrected where they overclaimed: `lag_sweeps_total` minus coalesced is not a walk count (the slot holds one queued position, so any number of lags behind a running worker collapse into one further pass); the recovery trigger bounds drift from a *poll* outage, not from a dropped `nodeIdOf`, which returns `Ok` and never errors the route, and a recovery-forced read can itself fail; a probe faults when one or more origins error and none confirms, not when every origin errors. `spawn_lag_sweep`'s "a request is never lost" now names the two paths that discard a queued pass. Shutdown is deliberate. The panic path is not — it is pre-existing #1806 behaviour and out of scope here, filed as #1814. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FcG1aENT41wu3xQTbTkxpU
* fix(node,cache,dht): close the six #1806 review follow-ups Six degradation paths that repair themselves eventually but move no metric, and in three cases silently shrink what the node advertises. cache: `rescan_origins` resolved candidates through `origin_size`, whose per-origin error handling is swallow-and-advance, so a transport fault arrived as `Ok(None)` — indistinguishable from an origin that genuinely does not hold the object. A throttled `HeadObject` window during a rescan evicted those hashes from the origin-held index, and an origin-only node that hit one at boot advertised a fraction of its content for a whole rescan interval with every downstream signal green. The rescan now walks the chain through the fault-aware primitive the serve gate uses, bypassing its memo so a large enumeration cannot evict the live path's warm entries. A faulted candidate keeps whatever the previous index held for it. Faults count on `decdn_cache_origin_probe_failures_total` and reach both DHT seed paths through `HolderSnapshot::origin_probe_faults`, the origin-held half's counterpart to `store_error`. dht: every `Mutex` site in `RepublishScheduler` swallowed poison, and poison is sticky — one panic under a guard turned the scheduler into a black hole for the process lifetime while every liveness signal stayed green. All five sites, plus the two routing-table sites beside them, run through a new `chain_projection::with_lock`, the `Mutex` analogue of the existing `with_read`/`with_write`. dht: the detached lag sweep held a `CacheEngine` clone and was never cancelled, so a walk in flight when the runtime flushed the store took the store-walk failure branch and fired an alertable counter on a clean restart. The worker now selects against a token `run_republish` drops on its way out. dht: `decdn_dht_republish_lag_sweeps_coalesced_total` is the sibling that makes `lag_sweeps_total` readable — the difference is the walks actually started, and a coalesced rate tracking the lag rate one-for-one is the signature of a slot that is never released. node: the capacity-bond registry resync returns `Ok` on a failed read by design (an `Err` would stall event pickup), which left a persistently failing repair moving nothing. It now bumps a failure counter and stamps a liveness gauge; the gauge is what catches the repair being *skipped*, since the reconcile does not run at all while the route is errored. node: that resync was cadence-driven only, and the cadence slips in exactly the scenario that causes the drift. `LogSink` gains `on_recovered`, a sync no-op-by-default seam the poller fires on the tick a route comes back — before that tick's reconcile, so a sink clearing its cadence clock re-reads immediately. All five watchers on the shared poller have it. Tests: poisoned-scheduler round-trip, coalescing counter through the slot protocol, a cancelled sweep leaving the store unwalked, a faulted probe carried forward across a throttle window, the resync counter and gauge, and the recovery edge firing once and before the reconcile. Closes #1807 Closes #1808 Closes #1809 Closes #1810 Closes #1811 Closes #1812 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FcG1aENT41wu3xQTbTkxpU * fix(node,cache,dht): address review of the #1806 follow-ups Seven inline findings and four substantive suppressed ones, all verified against the code first. Three were claims this branch introduced that are not true. cache: the origin-held index and the counts describing what the rescan behind it could not resolve are now one `ArcSwap` payload. Published separately, a seed could pair a fault-truncated index with a later rescan's zero fault count and report a short announce set as healthy — the exact failure the counts exist to expose, and reachable because the periodic and reload rescans are detached. cache: candidates dedupe on their own `seen` set. Keying off the index being built meant a hash that resolved `Absent`, or faulted with nothing to carry forward, was re-probed once per listing it appeared in — and counted a fault per probe, so a duplicate inflated the very number the seed reads. cache: `decdn_cache_origin_enumerate_failures_total` covers the rescan's other leg. An origin whose listing fails contributes no candidates at all, so its hashes leave the announce set with no per-hash fault and nothing to carry forward. Counting only probe faults left that shrink silent, which is what this whole change is about. dht: the origin-only ownership probe counts its faults the same way. A `Fault` there is skipped rather than announced — correct, since a blip must not turn into an advertisement the serve gate would refuse — but skipping is still a hash this node holds and does not announce, and on a remote origin it dropped a node's own store-only content while the snapshot read healthy. dht: `run_republish` takes a `CancellationToken` the runtime owns and cancels before the cache flush, replacing the `oneshot`. The previous shape cancelled the sweep when the republisher returned, and nothing orders that against the flush: the stop signal only reaches the sweep once the republisher is next polled. The race was narrowed, not closed. Docs corrected where they overclaimed: `lag_sweeps_total` minus coalesced is not a walk count (the slot holds one queued position, so any number of lags behind a running worker collapse into one further pass); the recovery trigger bounds drift from a *poll* outage, not from a dropped `nodeIdOf`, which returns `Ok` and never errors the route, and a recovery-forced read can itself fail; a probe faults when one or more origins error and none confirms, not when every origin errors. `spawn_lag_sweep`'s "a request is never lost" now names the two paths that discard a queued pass. Shutdown is deliberate. The panic path is not — it is pre-existing #1806 behaviour and out of scope here, filed as #1814. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FcG1aENT41wu3xQTbTkxpU * fix(node,cache,dht): address the multi-agent review of #1813 Five review passes over the branch (correctness, tests, silent failures, comments, type design). Everything below was verified against the code before acting; three of the findings are things this branch introduced. cache: rescans are serialized. Carrying a faulted candidate forward turned a rescan into a read-modify-write spanning the whole walk, and both triggers spawn detached — so two overlapping passes let the slower one publish a payload derived from a pre-empted index, dropping whatever the fresher pass found. A walk also gets slower exactly when the origin is faulting, which is when a second pass is most likely to start on top of it. cache: only a retry-eligible fault carries an entry forward. Every `Err` was treated as waitable, so a revoked ACL or a symlink escape kept its index entry for the process lifetime — the node advertising content the serve path refuses on every request, which is a worse failure than the one carry-forward exists to prevent. cache: rescan probes get their own ceiling instead of borrowing `cache.origin_probe_timeout_ms`. That knob is sized to stop a slow origin stalling the probe serve path; a bulk walk under it turns a merely slow origin into an all-fault rescan, and on a cold boot — nothing to carry forward — into a permanently empty announce set. cache: `origin_held_hashes` is gone. The whole point of pairing the index with its unresolved counts is that a caller cannot take one without the other, and the periodic rescan seed — the trigger that runs most often — was still taking the set alone and reporting nothing. node: the recovery-forced re-read is floored at a fifteenth of each sink's cadence. A recovery edge fires whenever a route comes back from an errored tick, so an endpoint that flaps rather than staying down bought a full authoritative re-read per flap, aimed at an endpoint already failing. node: all five sinks on the shared poller implement `on_recovered`, not just the registry. Slash, blacklist, fee-shares and rate-bounds each gate their reconcile on a clock stamped before the read, so all four deferred a further interval after exactly the outage that made them stale — the pathology the seam was added for. `ErasedSink`'s method defaults are gone: with one blanket implementation they were unreachable, and their only effect was to make a forgotten forward a silent no-op. node: `notify_recovered_routes` no longer consumes the edge before it can deliver it, and asserts on the unresolved-factory branch like both its siblings. Clearing first meant an unresolved sink lost the recovery for the whole outage rather than one tick. node: the poison-recovery helpers clear the poison as they recover. Poison is sticky and these locks sit on a 1 Hz timer and the inbound `Store` path, so an ungated warn per acquisition is the flood `dispatch`'s own gate exists to prevent. node: the seed's ownership-probe faults get a counter. They were the one leg this branch newly counted in the snapshot and metered nowhere, while the store-walk leg beside them bumped one. Docs: corrected four claims that were wrong rather than imprecise — "running on stale sizes" (a size is immutable for a content address; the real cost is advertising content the origin no longer holds), "covers S3/R2 and the filesystem" (only HTTP's *status* path degrades; its transport faults count), the gauge's "one interval after boot at the earliest" (falsified by the recovery edge in the same PR), and a test doc claiming the coalesced difference counts walks. Tests: whole-tick failure arming the recovery edge for every route — the only path that arms it for an RPC outage, and previously unpinned; the resync floor; a failed resync leaving the liveness gauge unstamped; an authoritative absence still evicting; a permanent fault not carrying forward; the blacklist filter on the announce set; and the rescan's own counts reaching the seed. Not fixed here, filed instead: #1815 (an HTTP 5xx reads as an authoritative absence, and the republisher unschedules on it) and #1816 (routing-table poison recovery now split between the republisher and the query path). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FcG1aENT41wu3xQTbTkxpU * fix(node,cache,dht): address the second review round on #1813 Four unresolved threads, all verified against the code first, all defects this branch introduced. cache: the rescan slot coalesces instead of queueing. Serializing fixed the read-modify-write hazard but not admission: both triggers fire detached, so a walk that outran the cadence left one waiter per tick on the lock, and those waiters then ran a backlog of obsolete passes back to back against an origin already struggling. Triggers now collapse into a single rerun, which is all a rerun can be worth — the next pass re-derives everything. dht: `HolderSnapshot` keeps the rescan's probe faults separate from the seed's own. Merging them meant a rescan fault moved `decdn_dht_republish_seed_origin_probe_failures_total` even with `relay_foreign_namespaces = true`, where the seed asks the origin nothing — double-counting `decdn_cache_origin_probe_failures_total` and contradicting the distinction that counter's own doc draws. `rescan_probe_faults` and `rescan_enumerate_failures` describe a pass that may be as old as the cadence; `ownership_probe_faults` describes this walk, and only it is metered here. node: the bootstrap enumeration stamps the registry's liveness gauge. It is the same `getRegisteredNodes` read against the same contract, and without it the staleness alert's `> 0` guard suppressed the alert forever on exactly the node it exists to find — one where every later resync fails or is skipped, leaving the gauge at zero. monitoring: the resync failure alert measures `increase(...[1h])` rather than `rate(...[15m])`. Attempts are one 15m interval apart, so a window of that same length sees a zero-rate gap whenever a poll or RPC delay pushes two increments further apart — resetting `for`, so a permanently failing resync never fired it. The degradation reporting both seeds do is now one method on `HolderSnapshot`, taking a context string. It was three near-identical warn blocks across two files, and adding a fourth degradation source meant finding all of them. Tests: four concurrent triggers collapsing into one rerun, with the slot still claimable afterwards. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FcG1aENT41wu3xQTbTkxpU * test(client-pull): pace the settle-wait regression test on a paused clock The re-open assertion measured wall-clock time against a 500 ms budget, so it graded the runner's CPU speed as much as the driver's control flow. Under coverage instrumentation the honest, sleep-free path took 550 ms and the test failed while asserting nothing about the behavior it guards. The clock is now paused: `tokio::time::sleep` is the only thing that advances it, so a settle-wait costs a full `settle_backoff` of virtual time and the fetch's CPU cost registers as zero. The budget is `settle_backoff` itself rather than a hand-tuned millisecond count, which keeps the two in step. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FcG1aENT41wu3xQTbTkxpU --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Summary
Closes #1561, which tracked two deferred DHT resilience gaps. Only one turned out to be a real behavioural hole — both code comments cited blockers that other work has since closed.
Sub-task 1 — real gap: no republish sweep after a lagged commit stream
The republisher schedules a blob's first DHT
Storeoff the cache'ssubscribe_insertsbroadcast. That channel is bounded and retains nothing it drops, so aLaggedreceiver cannot backfill — its own API contract (crates/cache/src/engine.rs:1142) says a lagged consumer MUST force a full republish sweep. The handler only logged, leaving every hash committed inside the lag window with no DHT record until an operator restarted the node.The
Laggedarm now re-derives the held set and seeds whatever is missing, drawinguniform(0, 40 min)per record so the repair costs one cold-start window rather than a burst — an immediate bulk republish is non-conforming here for the same reason it is at boot. The sweep runs detached, and coalesces by re-running rather than skipping: each pass re-derives the held set once at its start, so a lag observed mid-walk earns a further pass instead of riding a snapshot taken before its own commits.The comment claimed
iter_hashesdid not exist. It does (crates/cache/src/engine.rs:3057), and has been the cold-start seed since #1130.holder_snapshotlifts the origin-held ∪ store union out of runtime bring-up so cold start and the sweep cannot drift apart.Seeding is now idempotent.
seed_cold_startskipped nothing, so re-seeding pushed a duplicate heap entry that drained a second time and bought one spurious republish per re-seed. That already affected the periodic origin rescan, which re-seeds every interval.schedule_cold_startis removed — it bypassed the new guarantee and had no callers.Sub-task 2 — already implemented; the docs were stale
RegistrySink::on_tick_completehas re-enumeratedgetRegisteredNodeseveryREGISTRY_RESYNC_INTERVALsince #1498, and that is what repairs thenodeIdOfresolve-failure drift the issue describes. Four passages claiming a resync is a "follow-up" are corrected, and a regression test pins both legs (drop → counter → resync converges).The corrected prose is careful not to over-claim in the other direction: the resync shortens the drift window but does not bound it.
reconcile_routesskips an errored route, and a failedfull_snapshotstamps the clock and defers a further interval — both correlated with the RPC fault that caused the drift.Review findings folded in
A multi-agent review of the first commit found two real bugs and four false doc claims, all fixed in
52eecd5a:await, so a panic in the store walk (iroh-blobs is outside the anti-panic lints, and theJoinHandleis dropped) disabled every later sweep for the process lifetime — while the lag counter kept climbing and the repair counter stayed flat, which the metric docs read as healthy. Now released throughprune_guard::PruneGuard, the existing RAII helper built for this hazard on the rate-limiter sweeps.decdn_dht_republish_lag_sweeps_totalincrements before the claim, so it counts lag events, not walks. Placement kept — it is what makes a wedged slot diagnosable — and the docs corrected instead.recvresolves instantly and forever). Unreachable today; now terminal.runtime/mod.rscited AC 16 (BatchStore acks) where AC 15 (cold-start jitter) belongs.Observability
Three counters, with matching
liverows inadr/appendix-observability.md(theadr_registry_names_are_exportedgate keeps them honest):decdn_dht_republish_lag_sweeps_totaldecdn_dht_republish_sweep_reseeded_totaldecdn_dht_republish_seed_store_walk_failures_totalTesting
cargo nextest run -p decdn-node -p decdn-cache— 1379 passed, 0 failed.cargo clippy --all-targets— 0 warnings.cargo fmt --check,RUSTDOCFLAGS="-D warnings" cargo doc, and all pre-commit hooks pass.Both new behavioural tests were verified non-vacuous by mutation:
lag_sweepto return early makes the integration test fail on its scheduled-count assertion.schedule_if_absentpush the heap entry but still returnfalsemakes both idempotence tests fail. That mutant passed the original test, whoseis_empty()assertion reads thescheduledset and cannot observe a duplicate heap entry — it now asserts heap length.Also adds a
lag_sweepunit test pinning the reseeded count against a pre-seeded scheduler, and an origin-only policy test that runs both polarities so the assertion is a contrast rather than an absolute.No contract, ABI, or gas-snapshot surface is touched.
Notes for the issue
getActiveNodes— the name in both checklist items — no longer exists; it was renamed togetRegisteredNodesin #1613. Checklist item 2 was already satisfied by #1498.Known follow-ups deliberately left out of scope: full poison-recovery across
RepublishScheduler(pre-existing convention, 6 sites — anerror!was added on the new path only);origin_held_hashessilently dropping hashes whose size probe fails (pre-existing, indecdn-cache); a sibling counter for coalesced sweeps.🤖 Generated with Claude Code
https://claude.ai/code/session_01FcG1aENT41wu3xQTbTkxpU