Skip to content
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

Update main with version-2.8.3-beta #3084

Merged
merged 26 commits into from
Jul 12, 2024
Merged

Update main with version-2.8.3-beta #3084

merged 26 commits into from
Jul 12, 2024

Conversation

sachindshinde
Copy link
Contributor

No description provided.

sachindshinde and others added 25 commits July 8, 2024 15:37
For very large graphs cloning types with lots of join directives can be expensive. Since these directives will not be used in the Schema that is cloned for toAPISchema(), add the ability to optionally omit them
When working with elements with many referencers, `addReferencer()`
became very hot.
    
If you have eg. 100 referencers, each one is added one by one, and each
new addition iterates the entire existing referencers list. This could
cause quadratic performance.

This changes the `_referencers` values to be JS `Set`s. This maintains
the same order for algorithms that rely on order.

---------

Co-authored-by: Renée Kooi <[email protected]>
This PR adds a changeset file for #3056.
For condition resolution, we use a cache that supports caching data per query graph node or edge.

This cache's code was pre-allocating arrays that would almost always be sparsely populated, and for large schemas this overhead is significant. This PR changes these arrays into maps.
While looking at satisfiability validations, @duckki noticed that we were throwing away dead-end/unadvanceable data. I wanted to check whether we could use closures to avoid executing dead-logic entirely unless it's needed (when no options are found for a path), and it turns out it's possible (specifically, the closure's state ends up being immutable, so delaying execution shouldn't change behavior). This PR accordingly wraps the dead-end logic with closures, and only executes them when needed for generating satisfiability errors.
The goal of this commit is to switch from using a dense array for the
various 'sources' passed around in mergeType code, to using a Map
instead. These Map structures have the potential to omit many elements
corresponding to irrelevant subgraphs, becoming sparser than an array,
but this commit preserves the dense array-like behavior, for now.
Since we already loop over all input sources to add shallow versions of
fields to the dest object in addFieldsShallow, we can return a
representation of what was added to be used later in mergeObject,
mergeInterface, and mergeInput, yielding a speedup.

The source of the speedup is the use of sparse Sources maps, so not all
subgraphs need to have an entry in Sources, though some subgraphs still
do have (intentionally) undefined entries, indicating the subgraph does
not contribute a particular field, but might matter for validation of
the field.

I'm aware JavaScript also supports "sparse arrays" which are Array
objects with "holes" in them (missing elements, not just undefined), but
not all operations (such as sparseArray.entries()) skip the holes, so it
seemed better/safer to use an explicitly sparse data structure like Map.
…ype-sources

Use sparse `Map`s rather than dense `sources` arrays in `mergeType` code.
Only run override validation when field has an `@override` in at least one subgraph
…ld_value_hints

Inconsistent value type hints should not be duplicated per subgraph
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to
version-2.8.3-beta, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`version-2.8.3-beta` is currently in **pre mode** so this branch has
prereleases rather than normal releases. If you want to exit
prereleases, run `changeset pre exit` on `version-2.8.3-beta`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @apollo/[email protected]

### Patch Changes

- Error messages are now lazily evaluated for satisfiability
validations.
([#3068](#3068))

- Query graph caches now use maps instead of sparsely-populated arrays
for per-subgraph data.
([#3066](#3066))

- Add a fast path to skip override validation for fields without any
subgraph `@override`s.
([#3070](#3070))

- Type merging now uses maps instead of sparsely-populated arrays for
per-subgraph data.
([#3069](#3069))

- Stop duplicating hints for inconsistent value type fields per
subgraph.
([#3071](#3071))

- Use sets instead of arrays for tracking schema type/directive
referencers.
([#3067](#3067))

- Updated dependencies
\[[`38debcf2f9af1a719bd1c8acbd9335efa8427ddb`](38debcf),
[`860aace9904e787f9bf05aad94be5b5920f10543`](860aace),
[`f753d55e9a49d11389ee4f8d7976533447e95ede`](f753d55),
[`3af790517d662f3bec9064c0bf243014c579e9cd`](3af7905)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Updated dependencies
\[[`38debcf2f9af1a719bd1c8acbd9335efa8427ddb`](38debcf),
[`860aace9904e787f9bf05aad94be5b5920f10543`](860aace),
[`67b70c6e68b1cdbf8f03dacafd636e27ed9b7814`](67b70c6),
[`f753d55e9a49d11389ee4f8d7976533447e95ede`](f753d55),
[`f5f6a799d6b3675eecb0eaec7a816d746cd136b2`](f5f6a79),
[`42bd27af6a23bcfdd36951dbfa3fb9f7ba833f3a`](42bd27a),
[`3af790517d662f3bec9064c0bf243014c579e9cd`](3af7905)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- For very large graphs cloning types with lots of join directives can
be expensive. Since these directives will not be used in the Schema that
is cloned for toAPISchema(), add the ability to optionally omit them
([#3053](#3053))

- Use sets instead of arrays for tracking schema type/directive
referencers.
([#3067](#3067))

## @apollo/[email protected]

### Patch Changes

- Error messages are now lazily evaluated for satisfiability
validations.
([#3068](#3068))

- Query graph caches now use maps instead of sparsely-populated arrays
for per-subgraph data.
([#3066](#3066))

- Updated dependencies
\[[`f753d55e9a49d11389ee4f8d7976533447e95ede`](f753d55),
[`3af790517d662f3bec9064c0bf243014c579e9cd`](3af7905)]:
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Query graph caches now use maps instead of sparsely-populated arrays
for per-subgraph data.
([#3066](#3066))

- Use sets instead of arrays for tracking schema type/directive
referencers.
([#3067](#3067))

- Updated dependencies
\[[`38debcf2f9af1a719bd1c8acbd9335efa8427ddb`](38debcf),
[`860aace9904e787f9bf05aad94be5b5920f10543`](860aace),
[`f753d55e9a49d11389ee4f8d7976533447e95ede`](f753d55),
[`3af790517d662f3bec9064c0bf243014c579e9cd`](3af7905)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Updated dependencies
\[[`f753d55e9a49d11389ee4f8d7976533447e95ede`](f753d55),
[`3af790517d662f3bec9064c0bf243014c579e9cd`](3af7905)]:
    -   @apollo/[email protected]

## [email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This PR fixes the issue identified in [this review
comment](#3069 (comment)).
Specifically, this PR fixes the bug in composition hint/error message
generation where missing sources were computed incorrectly. (No
changeset needed since the referenced PR hasn't been released yet.)
This PR adds a changeset file for #3075 (even though it's not really
necessary for the eventual patch release, it turns out we need it for
the changesets GH action to auto-file the PR).
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to
version-2.8.3-beta, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`version-2.8.3-beta` is currently in **pre mode** so this branch has
prereleases rather than normal releases. If you want to exit
prereleases, run `changeset pre exit` on `version-2.8.3-beta`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @apollo/[email protected]

### Patch Changes

- Fix logic to compute missing subgraphs when generating composition
hints/errors
([#3076](#3076))

-   Updated dependencies \[]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Updated dependencies
\[[`f376447a820e3c0ae41d16d1fd3b681d2f1e8c14`](f376447)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

-   Updated dependencies \[]:
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

-   Updated dependencies \[]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

-   Updated dependencies \[]:
    -   @apollo/[email protected]

## @apollo/[email protected]



## [email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to
version-2.8.3-beta, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`version-2.8.3-beta` is currently in **pre mode** so this branch has
prereleases rather than normal releases. If you want to exit
prereleases, run `changeset pre exit` on `version-2.8.3-beta`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @apollo/[email protected]

### Patch Changes

- Updated dependencies
\[[`50d648ccffb05591878de75dc5522914ed48698f`](50d648c)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Updated dependencies
\[[`50d648ccffb05591878de75dc5522914ed48698f`](50d648c)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- dummy commit to force beta.2
([#3078](#3078))

## @apollo/[email protected]

### Patch Changes

- Updated dependencies
\[[`50d648ccffb05591878de75dc5522914ed48698f`](50d648c)]:
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Updated dependencies
\[[`50d648ccffb05591878de75dc5522914ed48698f`](50d648c)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Updated dependencies
\[[`50d648ccffb05591878de75dc5522914ed48698f`](50d648c)]:
    -   @apollo/[email protected]

## [email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@sachindshinde sachindshinde requested a review from a team as a code owner July 12, 2024 22:04
Copy link

changeset-bot bot commented Jul 12, 2024

🦋 Changeset detected

Latest commit: 42aac5f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@apollo/composition Patch
@apollo/query-graphs Patch
@apollo/federation-internals Patch
@apollo/query-planner Patch
@apollo/gateway Patch
@apollo/subgraph Patch
apollo-federation-integration-testsuite Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Jul 12, 2024

Deploy Preview for apollo-federation-docs ready!

Name Link
🔨 Latest commit 42aac5f
🔍 Latest deploy log https://app.netlify.com/sites/apollo-federation-docs/deploys/6691a8eca3d5a00008271b12
😎 Deploy Preview https://deploy-preview-3084--apollo-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codesandbox-ci bot commented Jul 12, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@sachindshinde sachindshinde merged commit d6b707a into main Jul 12, 2024
17 of 18 checks passed
@sachindshinde sachindshinde deleted the version-2.8.3-beta branch July 12, 2024 22:19
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