Expand description
Target-dir-aware artifact pattern rewriting (bd-session-history-remediation-ocv9i.9.1).
RCH rewrites CARGO_TARGET_DIR on the worker (to .rch-target, a pooled
root, or a worker-scoped dir) so concurrent builds don’t collide. But the
artifact patterns an agent (or the classifier) specifies are written
against the original target dir — so retrieval looks in the wrong place
and reports a spurious “artifact miss”. rewrite_artifact_pattern maps a
pattern from the original target dir to the effective one, and
ArtifactRetrievalDiagnostics records the original pattern, the effective
pattern, the target dir, and the matched files so the rewrite is auditable.
Structs§
- Artifact
Pattern Rewrite - The result of mapping one artifact pattern across a target-dir rewrite.
- Artifact
Retrieval Diagnostics - Auditable record of an artifact-retrieval attempt under a (possibly rewritten) target dir. Printed by retrieval diagnostics and surfaced in the JSON envelope.
Constants§
- ARTIFACT_
OUTPUT_ ROOTS - Recognized artifact output roots (relative to the project). A retrieved artifact must land under one of these — never over tracked source.
Functions§
- artifact_
dest_ is_ safe - Whether a retrieved artifact’s RELATIVE destination is safe to write into the
local project. Protects against a malicious or stale remote layout
overwriting local source: the destination must not escape the project root
(no absolute path, no
..traversal — the top-level root protection) and must land under a recognized artifact output root (targetor a.rch-target*worker-scoped dir), never undersrc/or the project root itself. - rewrite_
artifact_ pattern - Rewrite
patternfromoriginal_target_dirtoeffective_target_dir.