Skip to content

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

Description

@github-actions

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions