Skip to content

refactor(workspace,contracts)!: delete dead code found by the mechanism inventory sweep - #1850

Merged
alpergundogdu merged 3 commits into
mainfrom
claude/inventory-tracking-mechanisms-ut26dc
Aug 27, 2026
Merged

alpergundogdu merged 3 commits into
mainfrom
claude/inventory-tracking-mechanisms-ut26dc

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Deletes everything the codebase-wide mechanism inventory sweep found with no production caller — including code whose only callers were its own tests, and those tests with it. +247 / −4,147 across 37 files. Companion issues: #1844 (staged mechanisms worth wiring instead), #1845 (stale docs).

Whole mechanisms removed

  • client-pull/src/rtt_map.rs (236 LOC) — the ADR 037 client RTT map; nothing constructed it (its own header said so). The shipped warming path ranks by live probe RTT via discovery::proxy_warming_order; the WarmingCandidate doc now describes that divergence without pointing at a module.
  • The fused progressive pull (NodeOrigin::open_progressive_pull, NodeProgressivePull, TeeVerdict, abandon_corrupt, private candidate walkers) — superseded by the two-leg window path (open_pull_leg + run_pull_leg + the serve leg). Its only external callers were tests: 13 test fns and 4 helpers deleted from node_origin_pull.rs (14,509 → 12,720 LOC).
  • Streaming-to-sink remnants in client-pull/src/sink.rs — pull_to_sink, the decode_to_sink loop only it drove, resume_offset, resume_is_genuine, and their tests. The live streaming path is ClientRangedStore::ingest_stream (which keeps PullReader, StashedFault, classify_decode_error, content_paid_frontier — all still live and tested).
  • config-types::Percent (125 LOC) — the seed-leech share-ratio consumer described in its docs was never built; the Bytes half of node: type-encode the seed-leech cap units (Bytes/Percent newtypes) to close the config→LeechCaps confusion seam #894 stays.
  • discovery::rank and the Probed.has_live_channel field only it read (both CLI construction sites set it to a constant false), plus RTT_REUSE_TOLERANCE.

Smaller deletions

Area Removed
cache retry_fetch; the run_with_retry wrapper that became dead with it (engine calls run_with_retry_classified directly)
node chain-events CursorStart::Seeded { persist } field — its only production shape was None since the origin route was folded into the blacklist route; the poller's checkpoint-hold test now exercises the real FromCheckpoint shape
node BOOTSTRAP_TIMEOUT (an alias of client::DHT_CLIENT_TIMEOUT, which already bounds every outbound DHT request), RoutingTable::cmp_by_distance, selection::top_n, ShedState::tracked_clients (its leak-prune tests now read the private field directly), ClientHandler::lane_state_snapshot
incentive MemoryPendingSettleStore, ARBITRUM_SEPOLIA_CHAIN_ID (test-only; literal inlined), CheckpointKey::Origin (kept only so a multi-key test had a second key)
client-pull ClientRangedStore::{present_handle, data_path_handle}
reputation interaction module is now crate-private (every item in it was already pub(crate))
e2e remove_origin, blacklist_added_at, owner_pool_nonce fixture verbs no journey calls
contracts CapacityBond.getBondMultiple — ADR 003 § payments explicitly excludes it from the interface, and it was spending bytecode on a contract near the EIP-170 ceiling; CapacityBond.getNode — zero consumers anywhere including tests (Rust binds getNodeByAddress); the ADR 003 interface listing drops the getNode line

Deliberately kept (checked, not dead)

  • False positives from the sweep, confirmed live: rate::BPS_SCALE (used in verify_rate's arithmetic), ClientHandler::register_lane (called on the voucher path), RecordStore::publisher_record_count (enforces the per-publisher admission cap).
  • LaneState::apply_voucher/stage_voucher — documented as the canonical voucher-verification entry and load-bearing for the channel_state_store persistence suite; removing them means rewriting live-store coverage, not deleting dead code.
  • DhtHandler::with_routing and ConnectionLimiter::per_source_tracked — constructor/observability seams that the DHT integration suites and probe_loopback's limiter-GC assertion (tests of live code) are built on; deleting them deletes that coverage.
  • The buffered stream_fetch* family — the harness client for the node loopback suites and the e2e ClientFixture; production uses open_progressive_pull (client-pull's) + drive.

Validation

  • cargo build / cargo clippy --workspace --all-targets / cargo fmt -- --check — clean
  • Tests: node lib 760 ✓, node_origin_pull 65 ✓, channel_state_store 14 ✓, cli 439 ✓, client-pull / cache / incentive / reputation / config-types suites ✓
  • Contracts: forge fmt --check ✓, FOUNDRY_PROFILE=ci forge build --sizes --deny warnings ✓, forge test 843 passed / 0 failed ✓ (Foundry v1.7.1, solc 0.8.28)

🤖 Generated with Claude Code

https://claude.ai/code/session_013XCL6WZ1TzGypMUpFbvUYb


Generated by Claude Code

…sm inventory sweep (#1844 sibling)

Remove code with no production caller, along with the tests that existed
only to exercise it. Net -3,900 lines.

Whole mechanisms:
- client-pull: the rtt_map module (nothing constructs it; the shipped
  ADR 037 warming path ranks by live probe RTT), pull_to_sink and the
  decode_to_sink loop it drove, resume_offset / resume_is_genuine
  (superseded by the checkpointing ClientRangedStore), discovery::rank
  and the Probed.has_live_channel field only it read
- node: the fused progressive pull (NodeOrigin::open_progressive_pull,
  NodeProgressivePull, TeeVerdict), superseded by the two-leg window
  path; its 13 tests and 4 helpers in node_origin_pull.rs
- config-types: the Percent module (its seed-leech consumer was never
  built; the Bytes half of #894 remains)

Smaller items:
- cache: retry_fetch and the run_with_retry wrapper (the engine calls
  run_with_retry_classified directly)
- node: CursorStart::Seeded persist field (its route no longer exists;
  the checkpoint-hold poller test now runs on FromCheckpoint),
  BOOTSTRAP_TIMEOUT (client::DHT_CLIENT_TIMEOUT already bounds every
  request), cmp_by_distance, selection::top_n, ShedState::tracked_clients,
  ClientHandler::lane_state_snapshot
- incentive: MemoryPendingSettleStore, ARBITRUM_SEPOLIA_CHAIN_ID,
  CheckpointKey::Origin (kept only for a multi-key test)
- client-pull: ClientRangedStore::{present_handle,data_path_handle}
- reputation: interaction module is crate-private (all items pub(crate))
- e2e: remove_origin, blacklist_added_at, owner_pool_nonce fixture verbs
- contracts: CapacityBond.getBondMultiple (ADR 003 excludes it from the
  interface) and CapacityBond.getNode (zero consumers; the ADR 003
  interface listing drops it, getNodeByAddress stays)

Kept deliberately: BPS_SCALE, register_lane, publisher_record_count
(live callers), apply_voucher/stage_voucher (canonical voucher entry,
carries channel_state_store coverage), DhtHandler::with_routing and
per_source_tracked (constructor/observability seams for integration
suites of live code), the stream_fetch* harness family.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013XCL6WZ1TzGypMUpFbvUYb
Copilot AI lite review requested due to automatic review settings August 26, 2026 22:13
@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.85% (2575/2866 lines)
▲ +0.16pp vs base (89.69% → 89.85%)
Run: 33019205430

…ode removal

`OriginFetch` and `Origin` are no longer imported where the
`collect_to_bytes` and `fetch` links resolve them, so both links
now use full paths. Caught by `cargo doc -D warnings`.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013XCL6WZ1TzGypMUpFbvUYb

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes code paths and tests identified as having no production callers after a mechanism-inventory sweep, trimming unused client-pull utilities, node pull-through legacy (“progressive/window”) remnants, stale config vocabulary types, and unused contract view helpers. The changes reduce maintenance surface area while keeping the currently shipped pull-through and retry mechanisms as the canonical paths.

Changes:

  • Remove dead node pull-through APIs/tests (notably NodeOrigin::open_progressive_pull and related helpers) in favor of the established two-leg pull path.
  • Remove unused client-pull / config-types mechanisms (rtt_map, sink “pull-to-sink” remnants, Percent) and simplify discovery ranking shape.
  • Remove unused watcher cursor persistence shape (CursorStart::Seeded { persist }) and unused contracts views (CapacityBond.getBondMultiple, getNode) with ADR interface update.

Reviewed changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/reputation/src/lib.rs Make interaction module crate-private and update crate docs accordingly.
crates/node/tests/node_origin_pull.rs Delete tests that only exercised removed progressive/window pull APIs; adapt remaining tests to buffered fetch path.
crates/node/src/slash_watcher.rs Update cursor start construction to new CursorStart::Seeded { at } shape and adjust tests.
crates/node/src/selection.rs Remove unused top_n helper and its unit tests.
crates/node/src/node_origin/pull_leg.rs Update docs to reference buffered Origin::fetch pipeline rather than removed progressive pull API.
crates/node/src/node_origin/mod.rs Delete the progressive/window pull API and related types; tighten imports/docs around remaining pull paths.
crates/node/src/load_shed/state.rs Remove tracked_clients accessor and update tests to check internal map length directly.
crates/node/src/handlers/client/mod.rs Remove unused lane_state_snapshot and adjust test to read lane state directly.
crates/node/src/dht/routing.rs Remove unused cmp_by_distance helper and its unit test.
crates/node/src/dht/capacity_bond_registry.rs Update cursor start construction to new seeded shape and adjust tests.
crates/node/src/dht/bootstrap.rs Remove dead BOOTSTRAP_TIMEOUT alias and its documentation.
crates/node/src/channel_store.rs Remove dead test that relied on removed checkpoint key.
crates/node/src/chain_events/resumable_watcher.rs Simplify CursorStart::Seeded to be non-persisting; remove persist-related logic/tests and update docs.
crates/node/src/chain_events/multiplexed_poller.rs Update tests to reflect new cursor start semantics (use FromCheckpoint for durable cursors).
crates/node/src/blacklist_watcher.rs Update cursor start construction to new seeded shape and adjust tests.
crates/incentive/src/store.rs Remove dead CheckpointKey::Origin and MemoryPendingSettleStore plus tests.
crates/incentive/src/lib.rs Stop re-exporting removed store types/keys.
crates/incentive/src/eth_identity.rs Inline chain id literal in tests after removing dead constant.
crates/e2e/src/chain.rs Remove dead ChainFixture helper methods with no journey callers.
crates/e2e/src/assert.rs Remove unused owner_pool_nonce helper.
crates/config-types/src/percent.rs Delete unused Percent newtype module.
crates/config-types/src/lib.rs Remove percent module wiring and export.
crates/config-types/src/bytes.rs Update docs to no longer reference Percent.
crates/client-pull/src/sink.rs Remove dead pull-to-sink/resume helpers and related tests; keep streaming-decode support types used by ranged ingest path.
crates/client-pull/src/rtt_map.rs Delete unused RTT map implementation and tests.
crates/client-pull/src/ranged_store.rs Remove dead handle getters that had no callers.
crates/client-pull/src/lib.rs Stop exporting deleted rtt_map; adjust module doc note for sink links.
crates/client-pull/src/discovery.rs Remove dead “live channel” ranking fields/logic and update docs accordingly.
crates/cli/src/commands/fetch.rs Stop populating removed Probed.has_live_channel; update comments around failover ordering.
crates/cache/tests/s3_origin.rs Update test comment to reflect current retry loop entry point.
crates/cache/src/retry.rs Remove dead run_with_retry wrapper and retry_fetch; keep run_with_retry_classified as the single retry loop primitive.
crates/cache/src/origin/s3.rs Update docs to reference run_with_retry_classified.
crates/cache/src/origin/mod.rs Update trait docs to no longer reference removed retry_fetch.
crates/cache/src/lib.rs Remove re-export of deleted Percent.
crates/cache/src/circuit_breaker.rs Update docs to reference run_with_retry_classified.
contracts/src/CapacityBond.sol Remove unused view methods to reduce bytecode size.
adr/003-payments.md Remove getNode from the documented interface list.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Removing CapacityBond.getBondMultiple and getNode changes the
contract's deterministic gas profile, so the enforced .gas-snapshot
gate needs the fresh baseline (FOUNDRY_PROFILE=ci forge snapshot).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013XCL6WZ1TzGypMUpFbvUYb
@github-actions

Copy link
Copy Markdown

Coverage report

Total: 82.04% (was 82.08%, ▼ 0.04%) — 67905/82767 lines

File Coverage Lines Δ
crates/cache/src/circuit_breaker.rs 96.82% 335/346 ● 0.00%
crates/cache/src/lib.rs 100.00% 28/28 ● 0.00%
crates/cache/src/origin/mod.rs 62.50% 70/112 ● 0.00%
crates/cache/src/origin/s3.rs 89.36% 546/611 ● 0.00%
crates/cache/src/retry.rs 94.92% 187/197 ▲ +15.35%
crates/cli/src/commands/fetch.rs 32.62% 521/1597 ▲ +0.02%
crates/client-pull/src/discovery.rs 96.34% 789/819 ▼ 0.05%
crates/client-pull/src/lib.rs 89.24% 1676/1878 ● 0.00%
crates/client-pull/src/ranged_store.rs 91.04% 1037/1139 ▲ +0.48%
crates/client-pull/src/rtt_map.rs — — deleted
crates/client-pull/src/sink.rs 88.00% 132/150 ▲ +0.80%
crates/config-types/src/bytes.rs 100.00% 46/46 ● 0.00%
crates/config-types/src/percent.rs — — deleted
crates/e2e/src/assert.rs 13.27% 13/98 ▲ +1.45%
crates/e2e/src/chain.rs 13.72% 229/1669 ▲ +0.22%
crates/incentive/src/eth_identity.rs 88.06% 317/360 ▲ +0.28%
crates/incentive/src/store.rs 92.45% 245/265 ▼ 0.02%
crates/node/src/blacklist_watcher.rs 74.78% 925/1237 ▼ 0.06%
crates/node/src/chain_events/multiplexed_poller.rs 89.92% 1178/1310 ▼ 0.14%
crates/node/src/chain_events/resumable_watcher.rs 89.81% 194/216 ▼ 1.17%
crates/node/src/channel_store.rs 86.18% 1316/1527 ▼ 0.11%
crates/node/src/dht/bootstrap.rs 85.19% 92/108 ● 0.00%
crates/node/src/dht/capacity_bond_registry.rs 81.28% 686/844 ▼ 0.07%
crates/node/src/dht/routing.rs 97.68% 337/345 ▼ 0.08%
crates/node/src/handlers/client/mod.rs 92.71% 1564/1687 ▼ 0.08%
crates/node/src/load_shed/state.rs 100.00% 87/87 ● 0.00%
crates/node/src/node_origin/mod.rs 92.86% 963/1037 ▲ +1.42%
crates/node/src/node_origin/pull_leg.rs 85.61% 577/674 ● 0.00%
crates/node/src/selection.rs 97.07% 397/409 ▼ 0.22%
crates/node/src/slash_watcher.rs 59.10% 263/445 ▼ 0.27%
History
Commit Total Δ vs base
d5fd3f1 (HEAD) 82.04% ▼ 0.04%

@alpergundogdu
alpergundogdu merged commit 0ae1e02 into main Aug 27, 2026
25 checks passed
@alpergundogdu
alpergundogdu deleted the claude/inventory-tracking-mechanisms-ut26dc branch August 27, 2026 06:05
yigitdot added a commit that referenced this pull request Aug 27, 2026
One conflict, in `crates/incentive/src/store.rs`. The dead-code sweep
(#1850) deleted `MemoryPendingSettleStore` and its two tests, which nothing
on main references; this branch had carried them along untouched while
editing the floor-loss surface immediately below them. Took main's
deletion and kept this branch's `(pool_id, signer)` floor-loss doc and its
`signers()` test helper.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.

3 participants