Skip to content

fix: contracts composed multiple times - #3040

Merged
wilsonrivera merged 2 commits into
mainfrom
wilson/eng-9847-controlplane-contracts-are-composed-multiple-times
Jul 1, 2026
Merged

fix: contracts composed multiple times#3040
wilsonrivera merged 2 commits into
mainfrom
wilson/eng-9847-controlplane-contracts-are-composed-multiple-times

Conversation

@wilsonrivera

@wilsonrivera wilsonrivera commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes

    • Updated affected-graph impact calculations so contract-based federated graphs are no longer included when determining affected results for subgraph updates.
    • Improved composition behavior for feature-driven subgraph changes to avoid redundant processing of contract graphs.
  • Tests

    • Added a regression test ensuring a contract is not composed multiple times when a feature subgraph is published or updated.

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 July 1, 2026 19:02
@coderabbitai

coderabbitai Bot commented Jul 1, 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: e063fb4b-13fe-4908-bc40-f932e2713c08

📥 Commits

Reviewing files that changed from the base of the PR and between 1f5ffb6 and 5e538ed.

📒 Files selected for processing (1)
  • controlplane/test/contracts.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • controlplane/test/contracts.test.ts

Walkthrough

SubgraphRepository.writeSchemaAndCollectAffected now excludes contract federated graphs at lookup time in both feature-subgraph and non-feature paths. A regression test exercises contract and feature-flag composition counts before and after publishing an updated feature subgraph.

Changes

Contract exclusion fix and regression test

Layer / File(s) Summary
Exclude contract graphs from affected-graph queries
controlplane/src/core/repositories/SubgraphRepository.ts
Both bySubgraphLabels calls now pass excludeContracts: true, so contract federated graphs are excluded during affected-graph collection.
Regression test for contract composition counts
controlplane/test/contracts.test.ts
Imports additional helpers and adds a Vitest case that sets up feature-flag integration, creates a contract and feature flag, publishes a feature subgraph, and verifies composition-count changes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • wundergraph/cosmo#2860: Also changes SubgraphRepository affected-graph selection to exclude contract-based federated graphs during label-based lookup.
  • wundergraph/cosmo#2899: Also touches writeSchemaAndCollectAffected around contract/feature composition fan-out behavior.
  • wundergraph/cosmo#3031: Also updates feature-subgraph affected-graph selection logic in writeSchemaAndCollectAffected.
🚥 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 matches the main fix: preventing contracts from being composed multiple times.
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.

@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!

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.50%. Comparing base (4d54ed9) to head (5e538ed).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3040      +/-   ##
==========================================
+ Coverage   60.92%   65.50%   +4.57%     
==========================================
  Files         482      335     -147     
  Lines       62700    48752   -13948     
  Branches     6237     5427     -810     
==========================================
- Hits        38201    31935    -6266     
+ Misses      24471    16791    -7680     
+ Partials       28       26       -2     
Files with missing lines Coverage Δ
...lplane/src/core/repositories/SubgraphRepository.ts 89.02% <100.00%> (-0.01%) ⬇️

... and 147 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.

@wilsonrivera
wilsonrivera merged commit a9650ee into main Jul 1, 2026
13 checks passed
@wilsonrivera
wilsonrivera deleted the wilson/eng-9847-controlplane-contracts-are-composed-multiple-times branch July 1, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants