Skip to content

Entity caching: fix inconsistency in cache-control header handling#7987

Merged
SimonSapin merged 4 commits intodevfrom
simon/ROUTER-1200
Jul 28, 2025
Merged

Entity caching: fix inconsistency in cache-control header handling#7987
SimonSapin merged 4 commits intodevfrom
simon/ROUTER-1200

Conversation

@SimonSapin
Copy link
Contributor

@SimonSapin SimonSapin commented Jul 28, 2025

When the Subgraph Entity Caching feature is in use, it determines the Cache-Control HTTP response header sent to supergraph clients based on those received from subgraph servers.
In this process, Apollo Router only emits the max-age directive and not s-maxage.
This PR fixes a bug where, for a query that involved a single subgraph fetch that was not already cached, the subgraph response’s Cache-Control header would be forwarded as-is.
Instead, it now goes through the same algorithm as other cases.


Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • PR description explains the motivation for the change and relevant context for reviewing
  • PR description links appropriate GitHub/Jira tickets (creating when necessary)
  • Changeset is included for user-facing changes
  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Metrics and logs are added3 and documented
  • Tests added and passing4
    • Unit tests
    • Integration tests
    • Manual tests, as necessary

Exceptions

Note any exceptions here

Notes

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. A lot of (if not most) features benefit from built-in observability and debug-level logs. Please read this guidance on metrics best-practices.

  4. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

…have one

This fix an inconsistency in the header in the supergraph response between:

* A query with a single fetch that is a cache miss
* The same query with a cache hit
@SimonSapin SimonSapin requested a review from a team July 28, 2025 13:10
@apollo-librarian
Copy link

apollo-librarian bot commented Jul 28, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 2 changed, 0 removed
* (developer-tools)/apollo-mcp-server/(latest)/command-reference.mdx
* (developer-tools)/apollo-mcp-server/(latest)/guides/index.mdx

Build ID: 07538ab9c16d88442b9d20bf
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/07538ab9c16d88442b9d20bf

@github-actions

This comment has been minimized.

@SimonSapin SimonSapin requested a review from a team as a code owner July 28, 2025 15:27
@SimonSapin SimonSapin changed the title Entity/response cache: "merge" cache-control headers even if we only have one Entity caching: fix inconsistency in cache-control header handling Jul 28, 2025
@SimonSapin SimonSapin merged commit 4b22854 into dev Jul 28, 2025
15 checks passed
@SimonSapin SimonSapin deleted the simon/ROUTER-1200 branch July 28, 2025 17:32
@lrlna lrlna mentioned this pull request Aug 25, 2025
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.

2 participants