Skip to main content

Module artifact_pattern

Module artifact_pattern 

Source
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§

ArtifactPatternRewrite
The result of mapping one artifact pattern across a target-dir rewrite.
ArtifactRetrievalDiagnostics
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 (target or a .rch-target* worker-scoped dir), never under src/ or the project root itself.
rewrite_artifact_pattern
Rewrite pattern from original_target_dir to effective_target_dir.