Skip to content

test(core): add unit tests for commit_speculative_tier #3652

@bug-ops

Description

@bug-ops

Description

commit_speculative_tier (native.rs:2234–2293) is a new private async helper added in PR #3651 (#3643). It has no direct unit tests — coverage is only achievable through integration tests that require a live speculation engine.

Missing test cases

  1. engine = None → returns empty map immediately (zero-cost fast path)
  2. try_commit returns None for all calls → returns empty map
  3. try_commit returns Ok(result) → index present in map, tool_started_ats[idx] stamped, ToolStartEvent { speculative: true } emitted
  4. try_commit returns Err(_) → index still in map, tracing::warn! fired

Expected

Each case covered by a focused #[tokio::test] using a mock SpeculationEngine or the existing test infrastructure.

Environment

Metadata

Metadata

Assignees

Labels

P3Research — medium-high complexityenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions