Skip to content

fix(compile): anchor source/pipeline paths to trigger repo, not workspace#342

Merged
jamesadevine merged 2 commits intomainfrom
copilot/fix-pipeline-file-path
Apr 28, 2026
Merged

fix(compile): anchor source/pipeline paths to trigger repo, not workspace#342
jamesadevine merged 2 commits intomainfrom
copilot/fix-pipeline-file-path

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

Summary

{{ source_path }} and {{ pipeline_path }} were emitted as {{ workspace }}/<file>, but {{ workspace }} now follows the user's workspace: setting. When workspace: points at a checked-out alias, the integrity check and Stage 3 --source look in the alias repo for files that only exist in the trigger ("self") repo:

Error: Failed to read pipeline file: /mnt/vss/_work/1/s/exp23-a7-nw/ctf.yml

The two concepts were conflated — where the agent runs vs. where the source/compiled yaml live. This PR separates them.

  • New {{ trigger_repo_directory }} placeholder in src/compile/common.rs, computed from front_matter.checkout independently of workspace::
    • no additional checkouts → $(Build.SourcesDirectory)
    • any additional checkouts → $(Build.SourcesDirectory)/$(Build.Repository.Name)
  • Rewired generate_source_path / generate_pipeline_path to emit "{{ trigger_repo_directory }}/<relative>". {{ working_directory }} / {{ workspace }} are unchanged — agent workingDirectory and AWF --container-workdir still honor workspace:.
  • Registered the placeholder in the replacement list after {{ source_path }} / {{ pipeline_path }}, matching the existing two-pass expansion pattern ({{ integrity_check }}{{ pipeline_path }}{{ trigger_repo_directory }}).
  • Tests: updated existing generate_source_path / generate_pipeline_path assertions; added coverage for generate_trigger_repo_directory (with and without additional checkouts) plus a regression test asserting trigger-repo dir ≠ working dir when workspace: resolves to an alias.
  • Docs: AGENTS.md sections for {{ source_path }} and {{ pipeline_path }} rewritten to reflect trigger-repo anchoring; new {{ trigger_repo_directory }} section added.

Test plan

  • cargo build, cargo test, cargo clippy --all-targets --all-features — all pass with no new warnings.
  • New unit tests cover the alias-workspace regression directly.

@jamesadevine
Copy link
Copy Markdown
Collaborator

/rust-review

1 similar comment
@jamesadevine
Copy link
Copy Markdown
Collaborator

/rust-review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

Rust PR Reviewer completed successfully!

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Rust PR Review

Summary: Looks good — clean, targeted fix with thorough tests and correct two-pass expansion ordering.

Findings

✅ What Looks Good

  • Two-pass expansion is correct. generate_source_path / generate_pipeline_path embed \{\{ trigger_repo_directory }} as a string literal. The replacement list in compile_shared places \{\{ trigger_repo_directory }} after \{\{ source_path }} and \{\{ pipeline_path }}, so all embedded occurrences of the new placeholder are resolved in a single final pass. The ordering comment makes this explicit — good defensive documentation.

  • generate_trigger_repo_directory is correctly scoped. It takes &[String] (the checkout list), not the workspace setting. The two return values are static strings ($(Build.SourcesDirectory) or $(Build.SourcesDirectory)/$(Build.Repository.Name)) — no user input is embedded, so there's no injection surface.

  • Regression test is well-structured. test_trigger_repo_directory_independent_of_workspace_alias uses compute_effective_workspace + generate_working_directory to assert the two paths genuinely diverge when workspace: points at an alias. This precisely targets the reported failure scenario.

  • No callers of the old \{\{ workspace }}/ path pattern remain. Both generate_source_path and generate_pipeline_path were the only producers of that pattern; both are updated.

  • \{\{ workspace }} and \{\{ working_directory }} are left untouched in the replacement list, preserving existing agent workingDirectory / AWF --container-workdir behaviour.

No bugs, security concerns, or missing test coverage found.

Generated by Rust PR Reviewer for issue #342 · ● 331.1K ·

@jamesadevine
Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

…file-path

# Conflicts:
#	AGENTS.md

Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 28, 2026

@copilot resolve the merge conflicts in this pull request

Merged origin/main and resolved the conflicts in AGENTS.md (kept the trigger-repo anchoring while folding in the upstream relative-path examples for {{ source_path }} / {{ pipeline_path }}) in 20128bd. cargo build and cargo test pass.

@jamesadevine jamesadevine merged commit 0845490 into main Apr 28, 2026
@jamesadevine jamesadevine deleted the copilot/fix-pipeline-file-path branch April 28, 2026 14:53
Copilot stopped work on behalf of jamesadevine due to an error April 28, 2026 14:53
Copilot AI requested a review from jamesadevine April 28, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants