speculative_bench calls .file_name().unwrap() on a path taken directly from the --target CLI argument. Path::file_name() returns None for paths ending in .. or a trailing slash component that normalizes away, so a user who passes such a path gets a bare unwrap panic instead of a diagnostic.
Evidence
src/bin/speculative_bench.rs:829:
let row = if synthetic.target_subdir == target.file_name().unwrap().to_string_lossy() {
target comes straight from the command line. PathBuf::from("models/foo/..").file_name() and similar inputs return None, and the unwrap() aborts the whole bench run with a panic backtrace rather than telling the operator what was wrong with the argument.
Suggested fix
One to three lines. Either tolerate the missing file name:
let target_name = target.file_name().map(|n| n.to_string_lossy()).unwrap_or_default();
or fail early with a context error such as --target must name a model directory before the comparison. Either is fine; the second gives the operator a clearer message.
Acceptance criteria
speculative_benchcalls.file_name().unwrap()on a path taken directly from the--targetCLI argument.Path::file_name()returnsNonefor paths ending in..or a trailing slash component that normalizes away, so a user who passes such a path gets a bare unwrap panic instead of a diagnostic.Evidence
src/bin/speculative_bench.rs:829:
targetcomes straight from the command line.PathBuf::from("models/foo/..").file_name()and similar inputs returnNone, and theunwrap()aborts the whole bench run with a panic backtrace rather than telling the operator what was wrong with the argument.Suggested fix
One to three lines. Either tolerate the missing file name:
or fail early with a context error such as
--target must name a model directorybefore the comparison. Either is fine; the second gives the operator a clearer message.Acceptance criteria
speculative_benchwith a--targetpath ending in..or a trailing slash prints a readable error naming the--targetargument, not a panicmodels/<name>path comparison at src/bin/speculative_bench.rs:829 behaves exactly as before for normal paths