Skip to content

Add tests to check whether read function values are returned for incremental results - #13333

Merged
jerelmiller merged 1 commit into
release-4.3from
jerel/cache-read-tests
Jul 13, 2026
Merged

Add tests to check whether read function values are returned for incremental results#13333
jerelmiller merged 1 commit into
release-4.3from
jerel/cache-read-tests

Conversation

@jerelmiller

@jerelmiller jerelmiller commented Jul 13, 2026

Copy link
Copy Markdown
Member

While implementing the incremental fixes in #13324, I noticed another case we aren't handling correctly with incremental streaming: read functions are run, but the results are never applied to intermediate incremental results. cache.diff runs the read functions, but because we only apply diff.result when diff.complete (which is false when @defer chunks haven't streamed yet), we never see the transformed values.

I want to make sure #13324 fixes most (if not all) of these cases, so I'm creating a separate test suite for this. These tests are added in a separate file to avoid conflicts with the test file changes from #13324. That PR will be remove this test file and copy over the tests to maintain a clean merge.

Summary by CodeRabbit

  • Tests
    • Added comprehensive coverage for incremental GraphQL delivery using @defer and @stream.
    • Validated cache field transformations across partial results, streamed list items, nested objects, overlapping selections, and residual cache data.
    • Documented expected behavior for scenarios still under development.

@apollo-librarian

apollo-librarian Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 7c9694eb96c819f309dcfaa4
Build Logs: View logs


✅ AI Style Review — No Changes Detected

No MDX files were changed in this pull request.

Review Log: View detailed log

This review is AI-generated. Please use common sense when accepting these suggestions, as they may not always be accurate or appropriate for your specific context.

@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d8de22d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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


type Friend = { id: number; name: string };

test.failing(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Many of these are test.failing (which I expected). .failing will be removed in #13324.

@coderabbitai

coderabbitai Bot commented Jul 13, 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: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 14b139cc-e63a-4ea5-924e-629c8cf3d593

📥 Commits

Reviewing files that changed from the base of the PR and between b021583 and d8de22d.

📒 Files selected for processing (1)
  • src/core/__tests__/client.watchQuery/cacheFieldReadIncrementalGraphQL17Alpha9.test.ts

📝 Walkthrough

Walkthrough

Adds a GraphQL 17 Alpha 9 incremental delivery test suite covering cache field read functions across deferred fields, streamed lists, partial cache data, residual fills, overlapping selections, and nested objects.

Changes

Incremental cache field reads

Layer / File(s) Summary
Deferred cache read scenarios
src/core/__tests__/client.watchQuery/cacheFieldReadIncrementalGraphQL17Alpha9.test.ts
Adds helpers and tests for read functions across deferred streaming, partial cache merges, overlapping selections, and residual cache completion.
Streamed list cache reads
src/core/__tests__/client.watchQuery/cacheFieldReadIncrementalGraphQL17Alpha9.test.ts
Tests read-function application to streamed list items, partial cached lists, and residual complete items.
Nested streamed selections
src/core/__tests__/client.watchQuery/cacheFieldReadIncrementalGraphQL17Alpha9.test.ts
Tests read functions for nested objects with overlapping streamed and non-streamed fields.

Estimated code review effort: 4 (Complex) | ~45 minutes

Poem

I’m a bunny with chunks in my queue,
Watching cached fields turn bright and new.
Deferred bits hop, streams gently flow,
Nested reads bloom as the results grow.
Some tests pass, some failures say,
“More cache magic is on its way!”

🚥 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 accurately summarizes the new tests for cache read behavior in incremental results.
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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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.

@pkg-pr-new

pkg-pr-new Bot commented Jul 13, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@apollo/client@13333

commit: d8de22d

@jerelmiller
jerelmiller merged commit a9e4462 into release-4.3 Jul 13, 2026
53 checks passed
@jerelmiller
jerelmiller deleted the jerel/cache-read-tests branch July 13, 2026 22:01
jerelmiller added a commit that referenced this pull request Jul 13, 2026
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