Skip to content

test(composition): Add a test reproducing the composeDirective issue#2919

Draft
achmiel wants to merge 1 commit into
wundergraph:mainfrom
achmiel:achmiel/compose-directive-issue-reproducer
Draft

test(composition): Add a test reproducing the composeDirective issue#2919
achmiel wants to merge 1 commit into
wundergraph:mainfrom
achmiel:achmiel/compose-directive-issue-reproducer

Conversation

@achmiel

@achmiel achmiel commented Jun 4, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • Tests
    • Added regression test verifying that @composeDirective directives are correctly preserved during subgraph federation, regardless of the order in which subgraphs are processed. Confirms no warnings are emitted.

Context

This PR contains a failing test to illustrate the issue (#2920) and is not meant to be merged.

Open Source AI Manifesto

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

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR adds a Vitest regression test to the compose-directive.test.ts suite that documents and verifies a specific ordering bug in @composeDirective handling during federated schema composition. The test confirms that directive usages are correctly preserved regardless of whether a composing-only subgraph or a composing-and-applying subgraph is processed first.

Changes

Compose Directive Ordering Regression Test

Layer / File(s) Summary
Regression test for composing-only subgraph ordering
composition/tests/v1/directives/compose-directive.test.ts
New test case verifies that @composeDirective usages are not dropped when a subgraph that only composes the directive is processed before a subgraph that both composes and applies it. Test constructs two subgraphs with different directive behaviors, builds expected federated schema, asserts matching output for both orderings, and checks for zero warnings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a test that reproduces a composeDirective issue.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

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

@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/compose-directive.test.ts (1)

503-559: ⚡ Quick win

Align new constant identifiers with the project constant naming rule.

The newly introduced const bindings (composesButDoesNotApply, composesAndApplies, expected, appliesFirst, composesFirst) don’t follow the configured UPPER_SNAKE_CASE convention for constants.

As per coding guidelines: “Use UPPER_SNAKE_CASE for constants.”

🤖 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/compose-directive.test.ts` around lines 503 -
559, Rename the local constant bindings to follow UPPER_SNAKE_CASE: change
composesButDoesNotApply → COMPOSES_BUT_DOES_NOT_APPLY, composesAndApplies →
COMPOSES_AND_APPLIES, expected → EXPECTED, appliesFirst → APPLIES_FIRST, and
composesFirst → COMPOSES_FIRST; update all uses (calls to createSubgraph,
federateSubgraphsSuccess, normalizeString, schemaToSortedNormalizedString, and
the expect assertions) to refer to the new identifiers so the test compiles and
adheres to the project constant naming rule.
🤖 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/compose-directive.test.ts`:
- Around line 503-559: Rename the local constant bindings to follow
UPPER_SNAKE_CASE: change composesButDoesNotApply → COMPOSES_BUT_DOES_NOT_APPLY,
composesAndApplies → COMPOSES_AND_APPLIES, expected → EXPECTED, appliesFirst →
APPLIES_FIRST, and composesFirst → COMPOSES_FIRST; update all uses (calls to
createSubgraph, federateSubgraphsSuccess, normalizeString,
schemaToSortedNormalizedString, and the expect assertions) to refer to the new
identifiers so the test compiles and adheres to the project constant naming
rule.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a890fd18-51e7-4e9b-b693-931271973d36

📥 Commits

Reviewing files that changed from the base of the PR and between 9fa886b and 0e122c7.

📒 Files selected for processing (1)
  • composition/tests/v1/directives/compose-directive.test.ts

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.

1 participant