Files
claude-code/rust/MOCK_PARITY_HARNESS.md
Yeachan-Heo c2f1304a01 Lock down CLI-to-mock behavioral parity for Anthropic flows
This adds a deterministic mock Anthropic-compatible /v1/messages service,
a clean-environment CLI harness, and repo docs so the first parity
milestone can be validated without live network dependencies.

Constraint: First milestone must prove Rust claw can connect from a clean environment and cover streaming, tool assembly, and permission/tool flow
Constraint: No new third-party dependencies; reuse the existing Rust workspace stack
Rejected: Record/replay live Anthropic traffic | nondeterministic and unsuitable for repeatable CI coverage
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep scenario markers and expected tool payload shapes synchronized between the mock service and the harness tests
Tested: cargo fmt --all
Tested: cargo clippy --workspace --all-targets -- -D warnings
Tested: cargo test --workspace
Tested: ./scripts/run_mock_parity_harness.sh
Not-tested: Live Anthropic responses beyond the five scripted harness scenarios
2026-04-03 01:15:52 +00:00

939 B

Mock LLM parity harness

This milestone adds a deterministic Anthropic-compatible mock service plus a reproducible CLI harness for the Rust claw binary.

Artifacts

  • crates/mock-anthropic-service/ — mock /v1/messages service
  • crates/rusty-claude-cli/tests/mock_parity_harness.rs — end-to-end clean-environment harness
  • scripts/run_mock_parity_harness.sh — convenience wrapper

Scenarios

The harness runs these scripted scenarios against a fresh workspace and isolated environment variables:

  1. streaming_text
  2. read_file_roundtrip
  3. grep_chunk_assembly
  4. write_file_allowed
  5. write_file_denied

Run

cd rust/
./scripts/run_mock_parity_harness.sh

Manual mock server

cd rust/
cargo run -p mock-anthropic-service -- --bind 127.0.0.1:0

The server prints MOCK_ANTHROPIC_BASE_URL=...; point ANTHROPIC_BASE_URL at that URL and use any non-empty ANTHROPIC_API_KEY.