Skip to content

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

Open
lgahdl wants to merge 3 commits into
nullislabs:developfrom
bleu:fix/45-backtest-observe-verify
Open

fix(backtest): update replay harness for observe+verify ethflow strategy#170
lgahdl wants to merge 3 commits into
nullislabs:developfrom
bleu:fix/45-backtest-observe-verify

Conversation

@lgahdl

@lgahdl lgahdl commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

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 and others added 3 commits July 10, 2026 15:53
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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- 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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfSsJPYDQ1GQGbnSVFxATx
@lgahdl lgahdl force-pushed the fix/45-backtest-observe-verify branch from c311cfd to 89d5618 Compare July 10, 2026 18:55
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.

Backtest harness validates a deleted submit-based strategy

3 participants