Skip to content

fix: allow fields marked with @inaccessible to be used in SubscriptionFilter - #3142

Open
wilsonrivera wants to merge 5 commits into
mainfrom
wilson/cosmo-296-composition-subscriptionfilter-should-allow-inaccessible
Open

fix: allow fields marked with @inaccessible to be used in SubscriptionFilter#3142
wilsonrivera wants to merge 5 commits into
mainfrom
wilson/cosmo-296-composition-subscriptionfilter-should-allow-inaccessible

Conversation

@wilsonrivera

@wilsonrivera wilsonrivera commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Subscription filters can now reference inaccessible root and nested fields without triggering validation errors.
    • Kafka and NATS subscription filters now generate valid configurations when conditions include inaccessible fields.
    • Subscription schemas and filter definitions are normalized correctly when inaccessible fields are used, improving compatibility for subscriptions that depend on protected or internally managed data.
    • Appropriate warnings are now surfaced when inaccessible fields are included in subscription filter conditions.

Checklist

Open Source AI Manifesto

This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.

@wilsonrivera
wilsonrivera requested a review from a team as a code owner August 6, 2026 15:26

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 09a455a0-c600-44a3-aefa-2c08cd2788b7

📥 Commits

Reviewing files that changed from the base of the PR and between f05ea1a and 4498e80.

📒 Files selected for processing (1)
  • composition/tests/v1/directives/subscription-filter.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • composition/tests/v1/directives/subscription-filter.test.ts

Walkthrough

Subscription filter validation no longer rejects inaccessible root types or fields. Kafka and NATS tests verify successful federation, filter configurations, and normalized schemas. The obsolete nested inaccessible-field fixture was removed.

Changes

Subscription filter accessibility

Layer / File(s) Summary
Relax accessibility validation
composition/src/v1/federation/federation-factory.ts
Removed the inaccessible subscription field-path error import and checks for inaccessible root types and traversed fields.
Update subscription filter tests
composition/tests/v1/directives/subscription-filter.test.ts
Added inline subgraph construction. Kafka and NATS tests now expect successful federation and validate filter configurations and normalized schemas. Removed the obsolete nested-field fixture.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • wundergraph/cosmo#2797: Changes the same subscription-filter validation logic and related tests for inaccessible fields.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: allowing @inaccessible fields in SubscriptionFilter validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 1.58%. Comparing base (64eaf60) to head (4498e80).
⚠️ Report is 2 commits behind head on main.

❌ Your project check has failed because the head coverage (1.58%) is below the target coverage (30.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #3142       +/-   ##
==========================================
- Coverage   62.37%   1.58%   -60.79%     
==========================================
  Files         262     327       +65     
  Lines       31003   45805    +14802     
  Branches        0     485      +485     
==========================================
- Hits        19337     728    -18609     
- Misses      10158   44763    +34605     
+ Partials     1508     314     -1194     

see 589 files with indirect coverage changes

🚀 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
composition/tests/v1/directives/subscription-filter.test.ts (1)

406-407: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Assert the generated subscription filter.

federateSubgraphsSuccess checks only result.success. The test can pass if the name condition is silently omitted from fieldConfigurations. Assert that the generated configuration contains fieldPath: ['name'] and values: ['test'].

The helper behavior is defined in composition/tests/utils/utils.ts:84-97.

Proposed assertion
-      federateSubgraphsSuccess([subgraphR, subgraphN], ROUTER_COMPATIBILITY_VERSION_ONE);
+      const result = federateSubgraphsSuccess([subgraphR, subgraphN], ROUTER_COMPATIBILITY_VERSION_ONE);
+      expect(result.fieldConfigurations).toContainEqual({
+        argumentNames: [],
+        fieldName: 'one',
+        typeName: SUBSCRIPTION,
+        subscriptionFilterCondition: {
+          in: {
+            fieldPath: ['name'],
+            values: ['test'],
+          },
+        },
+      });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@composition/tests/v1/directives/subscription-filter.test.ts` around lines 406
- 407, Update the test using federateSubgraphsSuccess to inspect the generated
subscription filter configuration, asserting it contains fieldPath ['name'] and
values ['test']; retain the existing federation success assertion while
verifying the name condition was not omitted.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@composition/tests/v1/directives/subscription-filter.test.ts`:
- Around line 406-407: Update the test using federateSubgraphsSuccess to inspect
the generated subscription filter configuration, asserting it contains fieldPath
['name'] and values ['test']; retain the existing federation success assertion
while verifying the name condition was not omitted.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 41669638-409c-4a01-9dd4-6a56bcb63b0b

📥 Commits

Reviewing files that changed from the base of the PR and between 2f50ab8 and dc292c4.

📒 Files selected for processing (2)
  • composition/src/v1/federation/federation-factory.ts
  • composition/tests/v1/directives/subscription-filter.test.ts
💤 Files with no reviewable changes (1)
  • composition/src/v1/federation/federation-factory.ts

Comment thread composition/tests/v1/directives/subscription-filter.test.ts Outdated
Comment thread composition/tests/v1/directives/subscription-filter.test.ts Outdated

@Aenimus Aenimus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@Aenimus
Aenimus self-requested a review August 7, 2026 15:11
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