fix(tui): normalize artifact footer path separators for Windows

Fixes an upstream Windows-lane test failure introduced by #5212
(commit f0a6898c3, "fix(tui): honest large-output truncation + recovery
path").

#5212 flipped the adaptive-evidence contract so the model-facing
truncation footer MUST name the on-disk artifact path, but the footer
kept building that path with absolute_path.display().to_string(), which
on Windows emits backslashes (\artifacts\) while the acceptance test
asserts the POSIX form (/artifacts/).

- truncate.rs: the truncated_preview recovery_path (both the adaptive
  evidence path and the legacy spillover fallback) now goes through
  crate::artifacts::format_artifact_relative_path, which normalizes
  separators to '/' — the same normalization the artifact_relative_path
  metadata field already used.
- Consumers that read the footer path back (tool_routing, retrieval,
  UI preview) construct PathBuf from the string, and PathBuf::from
  accepts forward slashes on Windows, so no behavior change beyond the
  model-facing text being platform-independent.

The failing test (headless_bash_success_and_failure_are_distinct_
bounded_exact_evidence) fails identically on upstream main without this
PR's changes; this commit lands the repair inside the Layer 5.3 PR to
unblock the Windows lane.

Paulo Aboim Pinto
This commit is contained in:
Paulo Aboim Pinto committed 2026-08-07 09:09:41 +02:00
1 parent 24e4ac9b9c
commit 8f2b622dc5
1 file changed
+2 -2
+2 -2
View File
@@ -582,7 +582,7 @@ fn apply_spillover_inner(
head,
tail,
&original_content,
&absolute_path.display().to_string(),
&crate::artifacts::format_artifact_relative_path(&absolute_path),
Some(artifact_id.as_str()),
);
artifact_path = Some((absolute_path, relative_path, record));
@@ -852,7 +852,7 @@ fn apply_adaptive_evidence_inner(
head,
tail,
&original,
&absolute_path.display().to_string(),
&crate::artifacts::format_artifact_relative_path(&absolute_path),
Some(artifact_id.as_str()),
);
let metadata = result.metadata.get_or_insert_with(|| serde_json::json!({}));