Module warm

Module warm 

Source
Expand description

2026-09-26: The shared warm cargo target dir, a port of the harness’s warm_cargo_cache.sh. With a cold dir every generated Axum project compiles its whole dependency tree inside the scorer’s build timeout. This builds a template project in the debug profile (for the agent’s own cargo test and cargo run) and the release profile (for the scorer’s cargo build --release), and returns the dir that the agent shell and the scorer both set as CARGO_TARGET_DIR.

Owner: bench, agentic. Invariants: prepare returns the dir only after both profile builds succeeded; any failure is an error, never a fall back to a cold dir.

Constants§

TEMPLATE_MAIN
2026-09-26: The template’s main.rs, a ping/pong server on METRALE_HARNESS_PORT; the same text as the main.rs heredoc in warm_cargo_cache.sh after its first comment line (asserted in the tests).
TEMPLATE_MANIFEST
2026-09-26: Parses to the same TOML as the Cargo.toml heredoc in warm_cargo_cache.sh (asserted in the tests).

Functions§

prepare
2026-09-26: Prepares the shared warm target dir and returns it. A failure is an error rather than a fall back to a cold dir, which would show only as slow or timed-out builds.
template_dir
2026-09-26: METRALE_WARM_TEMPLATE_DIR, else $HOME/.cargo/metrale-warm-template, as in warm_cargo_cache.sh.
warm_target_dir
2026-09-26: METRALE_WARM_TARGET_DIR, else $HOME/.cargo/metrale-warm-target: the variable and default path of warm_cargo_cache.sh, run_tier.sh and score_run.py’s _warm_target_dir (asserted in the tests).
write_template
2026-09-26: Writes the template project. A file whose content already matches is left untouched.