refactor!: simplify replay API — remove MatchStrategy, ReplaySource & Snapshots - #7
Merged
Merged
Conversation
The Custom match strategy was never needed — replay only ever uses
MethodUriAndBodyHash. Remove the MatchStrategy enum and CustomMatcher
type alias, drop the strategy parameter from ReplaySource::{new,
from_jsonl,from_storage} and Snapshots::{from_storage,in_memory}, and
collapse the lookup to the single hash-indexed path (no more per-call
match on strategy, no linear-scan branch).
Breaking change: bump 0.4.0 -> 0.5.0 (pre-1.0 minor = breaking boundary).
Spec §2/§5/§8.1/§8.1.1 updated to describe the fixed match key instead
of pluggable strategies.
Replay is now configured purely by attaching a SnapshotStorage backend to an upstream — there is no caller-facing replay type. - `ReplaySource` and `Snapshots` are removed from the public API (`ReplaySource` is now `pub(crate)`, built internally from the attached backend's `load()` stream at `run()`; `Snapshots` is deleted). - `add_upstream_with` / `add_upstream_with_mode` take `Option<SharedStorage>` directly instead of `Option<Snapshots>`. - Add `InMemoryStorage`, a real in-memory `SnapshotStorage` backend in partly-proxy-types (promotes the former storage.rs doc example), for filesystem-free replay/fixtures — replaces `Snapshots::in_memory`. - Drop the now-unused `ReplaySource::from_jsonl`; the round-trip test loads via `from_storage` instead. No version bump: 0.5.0 already covers these breaking changes vs main's 0.4.0 baseline. Spec §3.3/§4/§4.1/§8/§9.1/§20.1 updated to the storage-backend attach model (also clears leftover `strategy` args from the §4/§20.1 examples).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related simplifications of the replay/storage public API (bumps
0.4.0 → 0.5.0, one minor bump covering both breaking changes).1. Remove
MatchStrategy(commitbc0d76f)The
Custommatcher was never needed — replay only ever usesMethodUriAndBodyHash. Matching is now fixed to a single key: (method, origin-form URI [path + query], SHA-256 of body).MatchStrategyenum andCustomMatchertype alias.strategyparameter from the replay constructors.lookup()collapses to the single hash-indexed path (no per-call match, no linear-scan branch).2. Remove
ReplaySource/Snapshotsfrom the public API (commit729f34b)Replay is now configured purely by attaching a
SnapshotStoragebackend to an upstream — no caller-facing replay type.ReplaySourceis nowpub(crate), built internally from the backend'sload()stream atrun();Snapshotsis deleted.add_upstream_with/add_upstream_with_modetakeOption<SharedStorage>directly.InMemoryStorage— a real in-memorySnapshotStorageinpartly-proxy-types(promotes the formerstorage.rsdoc example) — for filesystem-free replay/fixtures, replacingSnapshots::in_memory.ReplaySource::from_jsonl.Migration
Versioning
0.5.0. Both commits are breaking; under the repo's pre-1.0 rule (minor = breaking boundary) one minor bump from main's0.4.0covers them and clears thecargo semver-checksgate (baseline = PR base = main).Docs
SPECIFICATION.md§2/§3.3/§4/§4.1/§5/§8/§8.1/§8.1.1/§9.1/§20.1 rewritten for the fixed match key and the storage-backend attach model (also cleared leftoverstrategyargs from the §4/§20.1 examples).Testing
cargo build --workspace --all-targets— cleancargo test --workspace— all 23 test binaries passcargo clippy --workspace --all-targets— cleancargo fmt --check --all— clean