Skip to content

Only include relevant snippets #3586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2025
Merged

Only include relevant snippets #3586

merged 1 commit into from
Jul 3, 2025

Conversation

ciarams87
Copy link
Contributor

Proposed changes

Problem: SnippetsFilters are being included in NGINX configuration for all gateways regardless of whether routes attached to those specific gateways actually referenced the filters.

Solution: Implemented gateway-specific scoping by adding GetReferencedSnippetsFilters() method that returns only SnippetsFilters referenced by routes attached to the current gateway.

Testing: Added comprehensive unit tests for the new scoping logic including positive and negative test cases. Verified all existing tests continue to pass, confirming that the gateway-scoping behavior works correctly and doesn't break existing functionality.

Closes #3566

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.

Fixed an issue where SnippetsFilters were being included in NGINX configuration for all gateways regardless of whether routes attached to those specific gateways actually referenced the filters.

@ciarams87 ciarams87 requested a review from a team as a code owner July 3, 2025 12:01
@github-actions github-actions bot added the bug Something isn't working label Jul 3, 2025
Copy link

codecov bot commented Jul 3, 2025

Codecov Report

Attention: Patch coverage is 84.09091% with 7 lines in your changes missing coverage. Please review.

Project coverage is 86.88%. Comparing base (4ccd74f) to head (d88ba23).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/controller/state/graph/gateway.go 81.57% 4 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3586   +/-   ##
=======================================
  Coverage   86.87%   86.88%           
=======================================
  Files         127      127           
  Lines       15226    15266   +40     
  Branches       62       62           
=======================================
+ Hits        13228    13264   +36     
- Misses       1847     1848    +1     
- Partials      151      154    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@salonichf5 salonichf5 left a comment

Choose a reason for hiding this comment

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

🚀

@ciarams87 ciarams87 force-pushed the bug/fix-snippets-gw-scope branch from fe5c210 to d88ba23 Compare July 3, 2025 18:45
@ciarams87 ciarams87 merged commit ad133d8 into main Jul 3, 2025
42 of 43 checks passed
@ciarams87 ciarams87 deleted the bug/fix-snippets-gw-scope branch July 3, 2025 19:11
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in NGINX Gateway Fabric Jul 3, 2025
ciarams87 added a commit that referenced this pull request Jul 3, 2025
Problem: SnippetsFilters are being included in NGINX configuration for all gateways regardless of whether routes attached to those specific gateways actually referenced the filters.

Solution: Implemented gateway-specific scoping by adding GetReferencedSnippetsFilters() method that returns only SnippetsFilters referenced by routes attached to the current gateway.
sjberman pushed a commit that referenced this pull request Jul 7, 2025
Problem: SnippetsFilters are being included in NGINX configuration for all gateways regardless of whether routes attached to those specific gateways actually referenced the filters.

Solution: Implemented gateway-specific scoping by adding GetReferencedSnippetsFilters() method that returns only SnippetsFilters referenced by routes attached to the current gateway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working release-notes
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

NGF does not separate log format for multiple gateways?
4 participants