Skip to main content

Module detect

Module detect 

Source
Expand description

#8206: project-side detection of a runnable test command, the precondition the #2279 verify-before-finish trigger was missing.

Why: super::names_test_command is a pure text match over the task prompt and project context. On an EMPTY project root — a projectless tcode tui run whose work root is a fresh scratch dir (#8205) — a prompt that merely says “run cargo test” tripped the gate even though no command could possibly have satisfied it, and the run wedged: the agent was refused, could not comply, and was refused again. This module answers the question the gate should have asked first — “is there anything here a test command could run against?”. What: detect_test_command probes the bound project root for a manifest that implies a specific test command (Cargo.toml, a package.json with a test script, a pytest config, go.mod), falling back to the prompt-named command when the root is non-empty but carries no recognised manifest. A missing root, or an empty one, yields an UndetectableReason instead — the gate turns that into an accepted finish carrying a note, never a refusal. Test: verify_gate::tests::detect_*.

Enums§

TestCommandTarget
What a runnable test command was detected FROM, for the bound project.
UndetectableReason
Why no test command could be detected — the reason the accepted finish records instead of a refusal.

Functions§

detect_test_command
Detect the test command the gate would require, for the bound project.