fix(matcher): prevent CEL from matching label events unintentionally
๐ Description of the Change
Add AST inspection in CEL evaluation to skip label events unless expression explicitly references labels. The AST walker checks "event_type" variable or ".labels" field This prevents generic "event == pull_request" CEL expressions unintentionally matching on label add/remove events.
๐จ๐ปโ Linked Jira
https://issues.redhat.com/browse/SRVKP-8491
๐ Linked GitHub Issue
N/A
๐ Type of Change
- [x] ๐ Bug fix (
fix:) - [ ] โจ New feature (
feat:) - [ ] ๐ฅ Breaking change (
feat!:,fix!:) - [ ] ๐ Documentation update (
docs:) - [ ] โ๏ธ Chore (
chore:) - [ ] ๐
Refactor (
refactor:) - [ ] ๐ง Enhancement (
enhance:) - [ ] ๐ฆ Dependency update (
deps:)
๐งช Testing Strategy
- [x] Unit tests
- [ ] Integration tests
- [ ] End-to-end tests
- [x] Manual testing
- [ ] Not Applicable
๐ค AI Assistance
- [ ] I have not used any AI assistance for this PR.
- [x] I have used AI assistance for this PR.
If you have used AI assistance, please provide the following details:
Which LLM was used?
- [ ] GitHub Copilot
- [ ] ChatGPT (OpenAI)
- [ ] Claude (Anthropic)
- [x] Cursor
- [ ] Gemini (Google)
- [ ] Other: ____________
Extent of AI Assistance:
- [ ] Documentation and research only
- [ ] Unit tests or E2E tests only
- [ ] Code generation (parts of the code)
- [x] Full code generation (most of the PR)
- [x] PR description and comments
- [x] Commit message(s)
[!IMPORTANT] If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message. For example:Co-authored-by: Gemini [email protected] Co-authored-by: ChatGPT [email protected] Co-authored-by: Claude [email protected] Co-authored-by: Cursor [email protected] Co-authored-by: Copilot [email protected]
**๐กYou can use the script
./hack/add-llm-coauthor.shto automatically add these co-author trailers to your commits.
โ Submitter Checklist
- [x] ๐ My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
- [x] โจ I have ensured my commit message prefix (e.g.,
fix:,feat:) matches the "Type of Change" I selected above. - [x] โฝ I have run
make testandmake lintlocally to check for and fix any issues. For an efficient workflow, I have considered installing pre-commit and runningpre-commit installto automate these checks. - [ ] ๐ I have added or updated documentation for any user-facing changes.
- [x] ๐งช I have added sufficient unit tests for my code changes.
- [ ] ๐ I have added end-to-end tests where feasible. See README for more details.
- [ ] ๐ I have addressed any CI test flakiness or provided a clear reason to bypass it.
- [ ] If adding a provider feature, I have filled in the following and updated the provider documentation:
- [ ] GitHub App
- [ ] GitHub Webhook
- [ ] Gitea/Forgejo
- [ ] GitLab
- [ ] Bitbucket Cloud
- [ ] Bitbucket Data Center