Skip to content

strip unused QuotingMetricsTracker surface, dead deps, and dead feature flag#109

Merged
grumbach merged 3 commits into
mainfrom
strip-unused-quoting-metrics
May 22, 2026
Merged

strip unused QuotingMetricsTracker surface, dead deps, and dead feature flag#109
grumbach merged 3 commits into
mainfrom
strip-unused-quoting-metrics

Conversation

@grumbach
Copy link
Copy Markdown
Collaborator

Summary

  • Strip orphaned fields and helpers from QuotingMetricsTracker — the price formula reads exactly one input (close_records_stored), everything else was scaffolding without a consumer.
  • Drop three unused direct dependencies (aes-gcm-siv, hkdf, self_encryption) and the dead dev Cargo feature flag.
  • Re-word the pricing-module doc to remove the misleading "Phase 1 recalibration" framing.

Net: +28 / -413 across 6 files (Cargo.lock loses 76 lines on its own).

What's actually dead

QuotingMetricsTracker shipped with seven fields, but only close_records_stored is read by calculate_price (which is the only consumer). The others were either ghost infrastructure (entire persistence layer: with_persistence, PersistedMetrics, maybe_persist, Drop::persist) or values that get bundled into a QuotingMetrics struct nobody calls — received_payment_count, records_per_type, start_time/live_time, network_size. Production constructs the tracker via ::new(_), never ::with_persistence(_), so the on-disk format and debounce machinery never fired anywhere.

Cargo deps aes-gcm-siv, hkdf, self_encryption were declared for a legacy data-migration feature that was never built — zero use statements across src/. Cargo feature dev had zero #[cfg(feature = "dev")] gates.

What this PR doesn't touch

  • The pricing formula itself is unchanged — only the unused metrics scaffolding around it goes.
  • record_payment is removed (only fed the dropped counter); record_store loses its unused data_type parameter. The wire protocol still carries data_type through ChunkQuoteRequest and MerkleCandidateQuoteRequest, untouched.
  • No external crate (ant-client, ant-protocol, evmlib, saorsa-core) imports the affected surface. Verified by grep across the workspace and ~/.cargo/registry/.

Verification

  • 472 lib tests pass.
  • cargo clippy --all-features --all-targets -- -D warnings clean.
  • cargo fmt --check clean.
  • cargo doc --no-deps --all-features with RUSTDOCFLAGS="--deny=warnings" clean.

Test plan

  • CI green on ubuntu + windows
  • Spot-check that downstream consumers (ant-client) build against this branch unchanged
  • One reviewer sanity-checks the record_store signature change isn't load-bearing somewhere I missed

grumbach added 3 commits May 21, 2026 14:59
The quote-pricing formula in payment/pricing.rs reads exactly one input:
close_records_stored. Every other field on QuotingMetricsTracker
(received_payment_count, records_per_type, start_time, network_size) is
written but never read by any production code path, and there are no
prometheus / opentelemetry / metrics dependencies or HTTP/RPC status
endpoints that observe them. Likewise the entire persistence layer
(with_persistence, PersistedMetrics, maybe_persist, Drop::persist,
PERSIST_INTERVAL) is unreachable in production: node.rs and devnet.rs
both construct the tracker via ::new(_), never ::with_persistence(_),
so the on-disk format and debounce machinery serve no purpose.

This commit narrows the tracker to its live surface:
- one field: close_records_stored
- two methods: record_store(), records_stored()
- ::new(initial_records) constructor

QuoteGenerator::record_payment() and the storage handler's
record_payment() call site go away (they only fed the dropped
received_payment_count counter). QuoteGenerator::record_store() loses
its unused data_type parameter.

472 lib tests pass; clippy clean; rustfmt clean; cargo doc warning-free.
The label implied a roadmap (a pending Phase 2 with new inputs to the
formula) that does not exist anywhere in the repository. Rewords the
module doc to describe the current formula on its own terms and keeps
the historical context as "an earlier formula" rather than "Phase 0".

No code change.
Three direct dependencies (aes-gcm-siv, hkdf, self_encryption) were
declared for a legacy ant-node data migration that was never
integrated. `grep` confirms zero imports across src/. The "dev"
Cargo feature is declared but has zero `#[cfg(feature = "dev")]`
gates anywhere in src/.

Cargo.lock loses 76 lines of transitive baggage along with these.
472 lib tests pass; clippy clean; rustfmt clean; cargo doc clean.
Copilot AI review requested due to automatic review settings May 21, 2026 06:54
Copy link
Copy Markdown

Copilot AI left a comment

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 unused quoting-metrics scaffolding and associated dead code paths, simplifies the storage->pricing signal to a single counter (close_records_stored), and trims unused Cargo dependencies/feature flags to reduce maintenance overhead.

Changes:

  • Simplify QuotingMetricsTracker to only track close_records_stored, removing unused counters, per-type tracking, and persistence helpers.
  • Update storage handler and quote generator to record only store events (remove payment recording and data_type parameter from record_store).
  • Remove unused direct dependencies (aes-gcm-siv, hkdf, self_encryption), drop the unused dev feature, and refresh pricing module docs.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/storage/handler.rs Stops recording payment/type metrics on chunk PUT; only increments stored-record counter.
src/payment/quote.rs Removes record_payment and changes record_store API to match simplified metrics tracker.
src/payment/pricing.rs Updates module-level documentation wording (no pricing logic change).
src/payment/metrics.rs Replaces multi-metric + persistence tracker with a single atomic counter.
Cargo.toml Removes dead direct deps and removes the unused dev feature.
Cargo.lock Removes lock entries for eliminated direct dependencies and their no-longer-needed transitive packages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/payment/quote.rs
Comment thread src/payment/metrics.rs
@grumbach grumbach merged commit 2a8b91d into main May 22, 2026
14 checks passed
@grumbach grumbach deleted the strip-unused-quoting-metrics branch May 22, 2026 05:00
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