test_support/binding_vm_service_fake library

Shared in-process VmService fake bridging VmServiceClient.callServiceExtension calls into a real LeonardBinding's two test helpers (registry-routed: methods whose <ns>.<tool> suffix is in extensionRegistry.mergedTools() go to invokeExtensionTool; everything else falls through to invokeServiceExtension).

Hoisted from three sibling clones:

  • packages/leonard_flutter/test/binding_e2e_integration_test.dart (origin)
  • packages/leonard_agent/test/integration/provider_loop_integration_test.dart
  • packages/leonard_agent/test/_support/binding_vm_service_fake.dart

Lives under lib/test_support/ so it's importable as package:leonard_flutter/test_support/binding_vm_service_fake.dart but is NOT re-exported from lib/leonard_flutter.dart — opt-in test-only surface.

Optional observationFixture: when non-null AND the method equals ext.exploration.core.get_stable_observation, the fake returns {type: 'Observation', value: <fixture.body>} and bypasses the binding's real handler. Every other extension and extension tool routes normally regardless.

The fixture parameter is Object? (NOT a typed ObservationFixture?) because leonard_flutter cannot depend on leonard_agent — the harness-side ObservationFixture lives in package:leonard_agent/src/dogfood/observation_fixture.dart. Callers pass whatever object exposes a body getter returning Map<String, dynamic>; the fake reads it via dynamic dispatch.