Skip to content

Conversation

@alexec
Copy link
Contributor

@alexec alexec commented Jan 11, 2026

Selectors.MatchesIncludes now returns (bool, string). Context logs human-readable reasons for including or skipping items. Add table-driven tests and FEATURE_EXPLANATORY_LOGGING.md doc.

Selectors.MatchesIncludes now returns (bool, string). Context logs
human-readable reasons for including or skipping items. Add table-driven
tests and FEATURE_EXPLANATORY_LOGGING.md doc.
Copilot AI review requested due to automatic review settings January 11, 2026 22:28
@alexec alexec enabled auto-merge (squash) January 11, 2026 22:29
@alexec alexec merged commit 3e1cbf1 into main Jan 11, 2026
5 of 7 checks passed
@alexec alexec deleted the select_logging branch January 11, 2026 22:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the CLI's logging to provide clear explanations for why items (rules, tasks, skills, commands) are included or excluded during context assembly. The MatchesIncludes method now returns both a boolean match result and a human-readable reason string.

Changes:

  • Modified Selectors.MatchesIncludes to return (bool, string) with detailed match/mismatch reasons
  • Enhanced logging throughout context.go to display inclusion/exclusion explanations
  • Added comprehensive table-driven tests for the new functionality

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
pkg/codingcontext/selectors/selectors.go Refactored MatchesIncludes to return match result and reason string
pkg/codingcontext/context.go Updated all MatchesIncludes call sites to handle the new return signature and log reasons
pkg/codingcontext/selectors/selectors_test.go Added table-driven tests for reason string validation and updated existing test
FEATURE_EXPLANATORY_LOGGING.md Added comprehensive documentation for the new explanatory logging feature

Comment on lines +140 to +141
// No selectors specified
return true, "no selectors specified (included by default)"
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This return statement is unreachable. The early return at lines 98-100 handles the case when there are no selectors (nil or empty map), so execution cannot reach line 141. Remove this unreachable code block.

Copilot uses AI. Check for mistakes.
selectors: []string{"env=production"},
frontmatter: markdown.BaseFrontMatter{Content: map[string]any{"language": "go"}},
wantMatch: true,
wantReason: "no selectors specified (included by default)",
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case expects the reason 'no selectors specified (included by default)', but the code returns an empty string when there are no selectors (line 99 in selectors.go). The test expectation should be an empty string to match the actual behavior.

Copilot uses AI. Check for mistakes.
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