Skip to content

Minor followup for feedback from incremental cache implementation - #13360

Merged
jerelmiller merged 9 commits into
release-4.3from
jerel/incremental-feedback
Jul 27, 2026
Merged

Minor followup for feedback from incremental cache implementation#13360
jerelmiller merged 9 commits into
release-4.3from
jerel/incremental-feedback

Conversation

@jerelmiller

@jerelmiller jerelmiller commented Jul 27, 2026

Copy link
Copy Markdown
Member

Followup to #13347

Discussed with @phryneas in person. Instead of conditionally passing in the symbol by having caches opt-in, we pass it unconditionally. Caches that want to take advantage of behavior using that symbol can come talk to us on how to implement against the incremental behavior.

Summary by CodeRabbit

  • Improvements
    • Improved incremental, deferred, and streamed cache diff handling.
    • Updated cache diff results to provide more consistent data-state information.
    • Simplified incremental data processing across cache implementations.
  • Bug Fixes
    • Corrected partial-data and missing-field behavior during streaming and incremental reads.
    • Preserved compatibility for standard cache diff queries that do not use incremental options.

@jerelmiller
jerelmiller requested a review from phryneas July 27, 2026 18:37
@apollo-librarian

apollo-librarian Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 2f45effadfa94f5305cf925d
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 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ecefa26

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 27, 2026

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

commit: ecefa26

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Apollo Client updates incremental diff contracts, derives incremental behavior from option presence in StoreReader, simplifies QueryInfo integration, and adjusts incremental diff tests and generated API reports.

Changes

Incremental diff handling

Layer / File(s) Summary
Diff API contracts
.api-reports/api-report*.api.md, src/cache/core/cache.ts, src/cache/inmemory/types.ts, src/cache/inmemory/inMemoryCache.ts
ApolloCache.diff accepts incremental metadata and can return data-state results; internal symbol typing and the InMemoryCache marker field are updated or removed.
Store reader incremental flow
src/cache/inmemory/readFromStore.ts
Incremental behavior is based on whether the internal option exists, affecting boundary pruning, missing fields, dataState, and returned results.
QueryInfo integration and coverage
src/core/QueryInfo.ts, src/cache/inmemory/__tests__/cache.diff/incremental.test.ts
QueryInfo always passes incremental metadata to cache.diff, and tests use undefined for the internal option while retaining existing assertions.

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

Possibly related PRs

Suggested labels: auto-cleanup

Suggested reviewers: phryneas, daleseo

Sequence Diagram(s)

sequenceDiagram
  participant QueryInfo
  participant ApolloCache
  participant InMemoryCache
  participant StoreReader
  QueryInfo->>ApolloCache: Pass incrementalInfo to diff
  ApolloCache->>InMemoryCache: Execute incremental diff overload
  InMemoryCache->>StoreReader: Read with incremental option
  StoreReader-->>InMemoryCache: Return diff and dataState
  InMemoryCache-->>ApolloCache: Return diff result
  ApolloCache-->>QueryInfo: Return diff or data-state result
Loading

Poem

I’m a rabbit with a diff in my hat,
Incremental data hops out—just like that.
Symbols grow quiet, types line up neat,
Streams and defers find carrots to eat.
Hop, hop, the cache flows sweet!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is vague and doesn't clearly describe the main change to incremental cache diff handling. Use a concise title that names the core change, such as updating incremental diff handling or cache diff overloads.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@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)
src/cache/inmemory/__tests__/cache.diff/incremental.test.ts (1)

54-9423: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a presence-versus-value regression case.

These replacements are correct only because StoreReader now uses own-property presence. Add paired coverage where the symbol is omitted versus present with undefined; otherwise a future truthiness check or symbol loss during object spreading could make the existing tests pass while non-incremental reads regress.

🤖 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 `@src/cache/inmemory/__tests__/cache.diff/incremental.test.ts` around lines 54
- 9423, Add paired regression tests around the incremental-read options used by
cache.diff: verify behavior when handleIncrementalSymbol is omitted entirely
versus explicitly present with an undefined value. Use the existing
defer-related cache.diff tests and assertions as the model, ensuring both cases
cover presence semantics and would fail if implementation reverted to truthiness
checks or lost the symbol during object spreading.
🤖 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 `@src/cache/inmemory/__tests__/cache.diff/incremental.test.ts`:
- Around line 54-9423: Add paired regression tests around the incremental-read
options used by cache.diff: verify behavior when handleIncrementalSymbol is
omitted entirely versus explicitly present with an undefined value. Use the
existing defer-related cache.diff tests and assertions as the model, ensuring
both cases cover presence semantics and would fail if implementation reverted to
truthiness checks or lost the symbol during object spreading.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: f17b909c-89f5-4558-b61f-140baf2e9bab

📥 Commits

Reviewing files that changed from the base of the PR and between 0a27476 and ecefa26.

📒 Files selected for processing (8)
  • .api-reports/api-report-cache.api.md
  • .api-reports/api-report.api.md
  • src/cache/core/cache.ts
  • src/cache/inmemory/__tests__/cache.diff/incremental.test.ts
  • src/cache/inmemory/inMemoryCache.ts
  • src/cache/inmemory/readFromStore.ts
  • src/cache/inmemory/types.ts
  • src/core/QueryInfo.ts
💤 Files with no reviewable changes (1)
  • src/cache/inmemory/types.ts

@jerelmiller jerelmiller changed the title Minor feedback for incremental result Minor followup for feedback from incremental cache implementation Jul 27, 2026
@jerelmiller
jerelmiller merged commit 7aaa484 into release-4.3 Jul 27, 2026
53 checks passed
@jerelmiller
jerelmiller deleted the jerel/incremental-feedback branch July 27, 2026 19:22
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