Objective
Add comprehensive tests for the import path resolution improvements introduced in the fix for #23900, covering repo-root-relative paths, .github/agents/ imports, and edge cases.
Context
The path resolution fix in ResolveIncludePath needs test coverage at two levels:
- Unit tests in
pkg/parser/ — for the path resolution logic itself
- Integration/compiler tests in
pkg/workflow/ — for end-to-end import behaviour via CompileToYAML
This task should be completed after the fix in the companion issue is merged.
Test Cases to Add
Unit Tests (pkg/parser/)
File: pkg/parser/import_path_resolution_test.go
Add a new //go:build !integration test file covering ResolveIncludePath with:
.github/agents/planner.md → resolves to <repoRoot>/.github/agents/planner.md (file must exist in tmp fixture)
/agents/planner.md → resolves to <repoRoot>/agents/planner.md
agents/planner.md → still resolves relative to baseDir (.github/workflows/)
../../../etc/passwd → security error (path escapes .github/ folder)
.github/../etc/passwd → security error (normalized path escapes)
Compiler Integration Tests (pkg/workflow/)
File: pkg/workflow/imports_agents_dir_test.go
Add //go:build !integration tests that compile a workflow with:
imports: [.github/agents/my-agent.md] — should compile successfully, agent content inlined
imports: [.github/agents/missing.md] — should return clear error (file not found)
- Nested imports inside a
.github/agents/ file that themselves use relative or repo-root-relative paths
Regression Tests
- Existing
pkg/workflow/imports_test.go and pkg/parser/import_syntax_test.go should still pass without modification (no regressions).
Files to Create/Modify
- Create:
pkg/parser/import_path_resolution_test.go
- Create:
pkg/workflow/imports_agents_dir_test.go
Acceptance Criteria
Generated by Plan Command for issue #23900 · ● 1.4M · ◷
Objective
Add comprehensive tests for the import path resolution improvements introduced in the fix for #23900, covering repo-root-relative paths,
.github/agents/imports, and edge cases.Context
The path resolution fix in
ResolveIncludePathneeds test coverage at two levels:pkg/parser/— for the path resolution logic itselfpkg/workflow/— for end-to-end import behaviour viaCompileToYAMLThis task should be completed after the fix in the companion issue is merged.
Test Cases to Add
Unit Tests (
pkg/parser/)File:
pkg/parser/import_path_resolution_test.goAdd a new
//go:build !integrationtest file coveringResolveIncludePathwith:.github/agents/planner.md→ resolves to<repoRoot>/.github/agents/planner.md(file must exist in tmp fixture)/agents/planner.md→ resolves to<repoRoot>/agents/planner.mdagents/planner.md→ still resolves relative tobaseDir(.github/workflows/)../../../etc/passwd→ security error (path escapes.github/folder).github/../etc/passwd→ security error (normalized path escapes)Compiler Integration Tests (
pkg/workflow/)File:
pkg/workflow/imports_agents_dir_test.goAdd
//go:build !integrationtests that compile a workflow with:imports: [.github/agents/my-agent.md]— should compile successfully, agent content inlinedimports: [.github/agents/missing.md]— should return clear error (file not found).github/agents/file that themselves use relative or repo-root-relative pathsRegression Tests
pkg/workflow/imports_test.goandpkg/parser/import_syntax_test.goshould still pass without modification (no regressions).Files to Create/Modify
pkg/parser/import_path_resolution_test.gopkg/workflow/imports_agents_dir_test.goAcceptance Criteria
go test -run "TestImportPath|TestAgentsDir" ./pkg/parser/ ./pkg/workflow///go:build !integrationbuild tag at the topmake test-unit)Related to Fix: Flexible import path resolution and cross-repo agent imports #23900