Skip to content

fix(backtest): update replay harness for observe+verify ethflow strategy#346

Merged
mfw78 merged 4 commits into
developfrom
feat/45-backtest-observe-verify-clean
Jul 15, 2026
Merged

fix(backtest): update replay harness for observe+verify ethflow strategy#346
mfw78 merged 4 commits into
developfrom
feat/45-backtest-observe-verify-clean

Conversation

@mfw78

@mfw78 mfw78 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The ethflow-watcher strategy was redesigned from submit-based to observe+verify (GETs /api/v1/orders/{uid}, writes observed:{uid} to local store). The backtest harness was never updated, so every fixture classified as RejectedUnexpected and the binary exited 1.
  • Removed the old submit_order + app_data mocks; added a catch-all 200 response for cow_api_request
  • Renamed SubmittedObserved throughout (replay.rs, report.rs, main.rs)
  • classify_ok now checks local store for observed:* key instead of submit_order call count
  • Removed the now-dead submitted_body field from ReplayOutcome

Closes #45

Test plan

  • cargo test -p ethflow-watcher — 11/11 pass (covers the full observe+verify strategy)
  • cargo check -p shepherd-backtest — zero warnings
  • Binary run against 5 real Sepolia EthFlow fixtures collected via backtest_collect.py5/5 Observed, 100%, exit 0
  • Generated report correctly labels passing bucket as Observed + RejectedExpected

lgahdl added 4 commits July 15, 2026 08:15
The old harness mocked submit_order and classified success by whether
the strategy POSTed an order. The redesigned ethflow-watcher strategy
GETs /api/v1/orders/{uid} instead — so every fixture previously
classified as RejectedUnexpected and the binary exited 1.

Now programs a 200 catch-all for cow_api_request, classifies success
by whether observed:{uid} was written to local store, and renames the
Submitted classification to Observed throughout.

Closes #45
- classify_ok now checks `observed:{uid}` (exact fixture UID) instead of
  any `observed:*` prefix — prevents a compute_uid mismatch from producing
  a false Observed classification
- report.rs intro: corrected "programs a 200 for GET /orders/{uid}" to
  reflect the actual catch-all mock setup
- RejectedExpected variant doc: broadened from "404 only" to "any documented
  skip path" so future skip paths are not misleadingly excluded
Review follow-ups on top of the rebase onto develop:

- classify_ok now demands the full observe contract, not just the
  store marker: zero submit_order calls and exactly one
  GET /api/v1/orders/{uid} against the fixture's UID. A regression
  that writes the marker after a different call shape (or that also
  submits) is classified RejectedUnexpected instead of Observed, so
  the backtest stays an independent check on the module tests.
- Regenerated docs/operations/backtest-reports/backtest-7d-2026-06-22.md
  from the committed fixtures: 240/240 (100.0%) Observed, replacing the
  stale submit-era report (issue #45's "stale and unreproducible" item).

Verified: cargo run -p shepherd-backtest -- --fixtures
tools/backtest-collect/fixtures-2026-06-22.json exits 0 with 240/240.
The rebase onto develop removed replay.rs's last shepherd_sdk imports
(the app_data mocks whose CowApiError/HttpFailure types needed it),
leaving the declared dep unused - which the workspace's
unused-crate-dependencies lint denies under CI's -D warnings.
Verified: check --all-targets clean, harness still 240/240 Observed.
@mfw78 mfw78 added the base: develop Open PR targets develop — merge FIRST, before the dev/m1 integration PRs. label Jul 15, 2026
@mfw78 mfw78 merged commit c554426 into develop Jul 15, 2026
5 checks passed
@mfw78 mfw78 deleted the feat/45-backtest-observe-verify-clean branch July 15, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

base: develop Open PR targets develop — merge FIRST, before the dev/m1 integration PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backtest harness validates a deleted submit-based strategy

2 participants