Skip to content

Fix: compilation.exclude does not filter primitive discovery#477

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-primitive-discovery-exclusion
Draft

Fix: compilation.exclude does not filter primitive discovery#477
Copilot wants to merge 3 commits intomainfrom
copilot/fix-primitive-discovery-exclusion

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

Description

compilation.exclude patterns were only applied during context optimization (directory scanning/placement), not during primitive discovery. This caused .instructions.md files in excluded directories to leak into compiled output.

# apm.yml
compilation:
  exclude:
    - "docs/**"

Files under docs/ were still discovered, parsed, and compiled into AGENTS.md/CLAUDE.md.

Changes:

  • discovery.py: Added exclude_patterns parameter to discover_primitives(), discover_primitives_with_dependencies(), and scan_local_primitives() with glob matching helpers (** support, cross-platform path normalization)
  • agents_compiler.py: Passes config.exclude to both discovery code paths
  • 5 new tests covering single/multiple exclude patterns across both discovery entry points

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI and others added 2 commits March 27, 2026 11:54
Propagate exclude patterns from CompilationConfig to the primitive
discovery phase so that .instructions.md files (and other primitives)
inside excluded directories are never discovered or compiled.

Fixes #464

Agent-Logs-Url: https://github.com/microsoft/apm/sessions/6aae940e-6c6a-40f5-9f06-994570e01fa7

Co-authored-by: danielmeppiel <51440732+danielmeppiel@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix compilation.exclude to filter primitive discovery Fix: compilation.exclude does not filter primitive discovery Mar 27, 2026
Copilot AI requested a review from danielmeppiel March 27, 2026 12:01
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.

[BUG] compilation.exclude does not filter primitive discovery

2 participants