Skip to content

refactor(snapshots): drop ignored ?network= query param, rely on client filter#150

Open
Kewe63 wants to merge 1 commit into
circlefin:mainfrom
Kewe63:fix/snapshot-api-filter-cleanup
Open

refactor(snapshots): drop ignored ?network= query param, rely on client filter#150
Kewe63 wants to merge 1 commit into
circlefin:mainfrom
Kewe63:fix/snapshot-api-filter-cleanup

Conversation

@Kewe63

@Kewe63 Kewe63 commented Jun 14, 2026

Copy link
Copy Markdown

Summary

The snapshot listing API at https://snapshots.arc.network/api/snapshots returns entries for every network regardless of the ?network= query parameter — client-side filtering by network has been the actual behavior since the parameter was introduced. Carrying the parameter in the URL is noise and, worse, implies a server-side contract that does not exist.


Fix

  • Dropped ?network= from the request URL.
  • Tightened the comment (previously a FIXME) to accurately describe the client-side filter as the real filter, and flagged the request URL as the only place that would need to change if the server ever starts honouring ?network=.

Changes

File: crates/arc-snapshots/src/download.rs

  • Removed ?network= query parameter from request URL.
  • Updated comment to reflect actual client-side filtering contract.

Tests updated:

Test Change
fetch_latest_snapshot_urls_returns_correct_urls No longer pins the server to a specific ?network= value
fetch_latest_snapshot_urls_uses_devnet_network_param Renamed to fetch_latest_snapshot_urls_uses_devnet_listing; reworked to assert the actual contract — devnet chain is selected correctly from a multi-network listing
fetch_latest_snapshot_urls_filters_by_network_devnet New symmetric test for the devnet filter, mirroring the existing testnet one

How to Test

# Snapshot download tests
cargo test -p arc-snapshots --lib download::
# ✅ 32 passed, 0 failed

# Format & lint
cargo fmt --check -p arc-snapshots
cargo clippy -p arc-snapshots --all-targets -- -D warnings
# ✅ Both clean

Risk & Impact

None. The server never honored ?network=, so removing it from the request changes nothing at runtime. Client-side filtering behavior is unchanged. Tests now accurately reflect the actual contract.

Type: ♻️ Refactor

…nt filter

The snapshot listing API at https://snapshots.arc.network/api/snapshots
returns entries for every network regardless of the ?network= query
parameter; the client has been filtering by network locally since the
parameter was introduced. Carrying the parameter in the URL is therefore
just noise, and worse, it implies a server-side contract that does not
exist.

Drop the parameter. Tighten the comment that justified it (it was a
FIXME) to describe the client-side filter as the actual filter and
flag the request URL as the only place that would need to change if
the server ever starts honouring ?network=.

Tests updated to match the new request shape:
- 'fetch_latest_snapshot_urls_returns_correct_urls' no longer pins the
  server to a specific ?network= value, since the client no longer
  sends one.
- 'fetch_latest_snapshot_urls_uses_devnet_network_param' was
  asserting that the client sent the param; renamed to
  'fetch_latest_snapshot_urls_uses_devnet_listing' and reworked to
  assert the actual current contract — the devnet chain is selected
  correctly from a multi-network listing.
- 'fetch_latest_snapshot_urls_filters_by_network_devnet' is a new
  symmetric test for the devnet filter, mirroring the existing
  testnet one.
@ZhiyuCircle ZhiyuCircle added refactor Cleanup / internal restructure ops Component: ops labels Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ops Component: ops refactor Cleanup / internal restructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants