feat(router): entity caching with L1/L2, shadow mode, and per-request cache controls (3/6)#2955
Conversation
… cache controls Extracted from jensneuse/entity-caching-v2 (PR #2777) — router layer, stacked on the demo PR. Entity cache OTEL/Prometheus metrics are split into the next PR. - router/pkg/entitycache: in-memory L1, Redis L2, circuit breaker - router/core: factoryresolver mapping of proto cache config to planner metadata, graph server wiring, per-request cache-control headers (incl. WS subscriptions), EntityCacheKeyInterceptor module hook - graphql-go-tools pinned to 63fa1c88 (PR #1259 + v2.4.4 merged via entity-caching-v244-merge branch) — this also moves astjson to the caching arena rework (MergeValuesWithPath now returns 2 values; flushwriter adapted) - router-tests/entity_caching: integration suite consuming demo's cachetest subgraphs; config composed via wgc (composition-go was removed on main), testdata/config.json regenerated with main's composition - subscription-overhaul adaptation shims from the old base were dropped in favor of main's versions (websocket, flushwriter, executor, updater, mocks) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
❌ Internal Query Planner CI checks failedThe Internal Query Planner CI checks failed in the celestial repository, and this is going to stop the merge of this PR. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## milinda/entity-caching-1b-demo #2955 +/- ##
==================================================================
- Coverage 65.29% 57.70% -7.60%
==================================================================
Files 258 245 -13
Lines 27762 27734 -28
==================================================================
- Hits 18128 16003 -2125
- Misses 8169 10150 +1981
- Partials 1465 1581 +116
🚀 New features to boost your workflow:
|
Part 2 of 4 — split out from #2777 (
jensneuse/entity-caching-v2). Stacked on #2944.What's included
factoryresolvermapping of proto cache config to planner metadata, graph server wiring, per-request cache-control headers (graphql_handler), plan generator nil guard, config schema + defaultstestdata/config.jsonExcluded
router/internal/graphiql/graphiql.html(playground embed) ships in part 3/4 — this PR runs with the previous embedded playground.Verification
go build ./...passes inrouter/anddemo/;go vet ./entity_caching/...passes inrouter-tests/.🤖 Generated with Claude Code
Update: test subgraphs coupled to demo
The six entity_caching test subgraphs were moved into
demo/pkg/subgraphs/cachetest/and are imported by the suite — same coupling pattern as the main suite (testenv→demo/pkg/subgraphs). router-tests no longer carries subgraph implementations. Pure move: schemas/resolvers/data unchanged,make composereproduces an identicaltestdata/config.json, full suite green.Diff cleanup
HasNonDefaultExporter+ bootstrap guard) moved to the benchmark/tooling PR (6/6) — it is a general tracing perf change motivated by benchmarking, not entity caching.demo/pkg/subgraphs/projects/generatedproto churn — leftoverreservedmarkers from fields added and removed during development; the GraphQL schema is unchanged.router/entity-caching.config.yaml(unreferenced sample) androuter-tests/entity_caching/graph.yaml(duplicated the subgraph list thatcmd/composeowns; nothing consumed it).generatetarget moved todemo/Makefile(generate-cachetest) next to the subgraphs it regenerates.Rebased onto main (2026-06-10)
63fa1c88— PR feat: add caching to loader graphql-go-tools#1259 with v2.4.4 merged in (branchentity-caching-v244-merge; conflicts inresolve/context.go+resolve/resolvable.goresolved keeping caching fields + theactualListSizes→typeNameStatsrename). Needed because main's router uses v2.4.4 APIs (TypeNameStats) that the PR head lacked.MergeValuesWithPathreturn 2 values; main's flushwriter call site adapted.cmd/composereplaced with awgc-based Makefile target (+ restoredgraph.yamlinput) sincecomposition-gowas removed on main (chore: remove composition-go #2830);testdata/config.jsonregenerated with main's composition.ExecutionOptions.Cachingwiring in the WS path).