Skip to content

[WIP] Add tests for repo-root-relative import path resolution#24506

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/add-tests-import-path-resolution
Closed

[WIP] Add tests for repo-root-relative import path resolution#24506
Copilot wants to merge 1 commit intomainfrom
copilot/add-tests-import-path-resolution

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 4, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>[plan] Add tests for repo-root-relative import path resolution (.github/agents/ imports)</issue_title>
<issue_description>## 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:

  1. Unit tests in pkg/parser/ — for the path resolution logic itself
  2. 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

  • All new tests pass with go test -run "TestImportPath|TestAgentsDir" ./pkg/parser/ ./pkg/workflow/
  • New test files have correct //go:build !integration build tag at the top
  • No regressions in existing import tests (make test-unit)
  • Tests cover success paths, error paths, and security edge cases
    Related to Fix: Flexible import path resolution and cross-repo agent imports #23900

Generated by Plan Command for issue #23900 · ● 1.4M ·

  • expires on Apr 6, 2026, 2:14 PM UTC

Comments on the Issue (you are @copilot in this section)

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.

[plan] Add tests for repo-root-relative import path resolution (.github/agents/ imports)

2 participants