Skip to content

Conversation

@ysmolski
Copy link
Contributor

@ysmolski ysmolski commented Aug 5, 2025

During normalization this option enforces directiveIncludeSkipVisitor to keep nodes and delete directives instead.

Summary by CodeRabbit

  • New Features
    • Added a configurable option to control whether nodes affected by @skip and @include directives are preserved or removed during operation normalization.
  • Tests
    • Introduced new test cases to verify the behavior of preserving nodes when processing @skip and @include directives.

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 5, 2025

Walkthrough

A new option was introduced to control whether nodes affected by GraphQL @skip and @include directives are preserved or removed during AST normalization. The implementation adds a configurable flag, updates the normalization logic to respect this flag, and extends the test suite to verify the new behavior.

Changes

Cohort / File(s) Change Summary
Option and Normalizer Logic
v2/pkg/astnormalization/astnormalization.go
Added ignoreSkipInclude boolean field and functional option WithIgnoreSkipInclude; updated normalizer to pass this flag to directive visitor setup.
Directive Visitor Implementation
v2/pkg/astnormalization/directive_include_skip.go
Added keepNodes field to visitor struct; introduced directiveIncludeSkipKeepNodes function for configurable node preservation; modified directiveIncludeSkip to call new function with default behavior; renamed and refactored handleRemoveNode to removeParentNode.
Tests for Node Preservation
v2/pkg/astnormalization/directive_include_skip_test.go
Added new subtests under "keepNodes" to verify that nodes with @skip and @include directives are preserved when using the new visitor variant; updated imports accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb09c36 and fa127e0.

📒 Files selected for processing (3)
  • v2/pkg/astnormalization/astnormalization.go (3 hunks)
  • v2/pkg/astnormalization/directive_include_skip.go (6 hunks)
  • v2/pkg/astnormalization/directive_include_skip_test.go (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • v2/pkg/astnormalization/directive_include_skip_test.go
  • v2/pkg/astnormalization/astnormalization.go
  • v2/pkg/astnormalization/directive_include_skip.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build and test (go 1.23 / ubuntu-latest)
  • GitHub Check: Build and test (go 1.23 / windows-latest)
  • GitHub Check: Build and test (go 1.23 / windows-latest)
  • GitHub Check: Build and test (go 1.23 / ubuntu-latest)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch yury/eng-7726-skipinclude-should-be-ignored-in-query-plan-generator

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ysmolski ysmolski force-pushed the yury/eng-7726-skipinclude-should-be-ignored-in-query-plan-generator branch from 604a6f9 to fa544f1 Compare August 5, 2025 13:42
@ysmolski ysmolski requested a review from devsergiy August 5, 2025 13:42
@ysmolski ysmolski force-pushed the yury/eng-7726-skipinclude-should-be-ignored-in-query-plan-generator branch 2 times, most recently from 421dbc1 to 2239e7b Compare August 5, 2025 16:14
@ysmolski ysmolski force-pushed the yury/eng-7726-skipinclude-should-be-ignored-in-query-plan-generator branch from 2239e7b to eb09c36 Compare August 6, 2025 09:02
During normalization this option enforces directiveIncludeSkipVisitor to
keep nodes and delete directives instead.
@ysmolski ysmolski force-pushed the yury/eng-7726-skipinclude-should-be-ignored-in-query-plan-generator branch from eb09c36 to fa127e0 Compare August 6, 2025 09:58
@ysmolski ysmolski merged commit dfd6523 into master Aug 6, 2025
10 checks passed
@ysmolski ysmolski deleted the yury/eng-7726-skipinclude-should-be-ignored-in-query-plan-generator branch August 6, 2025 12:25
ysmolski pushed a commit that referenced this pull request Aug 6, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.0.0-rc.217](v2.0.0-rc.216...v2.0.0-rc.217)
(2025-08-06)


### Bug Fixes

* add an option to ignore skip/include directives
([#1261](#1261))
([dfd6523](dfd6523))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Added an option to ignore skip/include directives in GraphQL
processing.

* **Documentation**
  * Updated the changelog with details for version 2.0.0-rc.217.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@coderabbitai coderabbitai bot mentioned this pull request Oct 17, 2025
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.

3 participants