Entity Graph Cache
Track: entity-graph-cache-20260329
Overview
Replace the current parent-path cache invalidation with an entity graph-based system inspired by Stellate (GraphQL CDN). Track entity dependencies across cached responses and invalidate precisely when mutations occur. Additionally, enable GraphQL API caching by detecting query vs mutation in POST /graphql requests.
This moves local-hub from URL-pattern invalidation to semantic entity-level invalidation, enabling cross-protocol cache coherence between REST and GraphQL.
Requirements
Functional Requirements
Non-functional Requirements
Acceptance Criteria
Out of Scope
- Deep nested entity traversal (only top-level extraction)
- GraphQL subscription support
- Turso cloud replication (Phase 3)
- Automatic schema introspection for entity type detection
- Cache warming or prefetching
Assumptions
- GitHub REST API responses consistently include
node_id fields for primary entities
- GraphQL responses include entity identifiers in predictable locations (
id, node_id fields)
Entity Graph Cache
Overview
Replace the current parent-path cache invalidation with an entity graph-based system inspired by Stellate (GraphQL CDN). Track entity dependencies across cached responses and invalidate precisely when mutations occur. Additionally, enable GraphQL API caching by detecting query vs mutation in POST /graphql requests.
This moves local-hub from URL-pattern invalidation to semantic entity-level invalidation, enabling cross-protocol cache coherence between REST and GraphQL.
Requirements
Functional Requirements
node_id(Global Relay ID). Top-level extraction only (response root entities).entity_id → [cache_key]in libsql. When an entity is referenced by a cached response, register the dependency.SHA256(query + variables). Detect query vs mutation by parsing the operation type from the request body.Non-functional Requirements
Acceptance Criteria
/repos/org/repo/issues/123succeeds, both the REST/issues/123cache AND any GraphQL query referencing that issue'snode_idare invalidatedqueryoperation) return cached responses withx-local-hub-cache: hiton repeated identical requestsmutationoperation) pass through to GitHub and invalidate all cache entries referencing affected entitiesnode_idfrom both REST JSON responses and GraphQL responsedatafieldsOut of Scope
Assumptions
node_idfields for primary entitiesid,node_idfields)