100%

04 — gds-off-hot-path-tiered

Goal

Keep GDS global enrichment OFF the query hot path (user-approved tiered design): the synchronous incremental refreshes only the cheap per-file legs (SCIP emit, symbols, CALLS resolution) so callers/callees/clones/blast_radius are HEAD-fresh before serving; the global GDS recompute (PageRank/betweenness/Leiden/MISSING_ABSTRACTION) fires in the background, insights lagging at most one refresh.

Implementation Sketch

Split the sync-tail: the --changed cheap legs run synchronously inside the flock; GDS enrichment detaches (background, serialized by its own flock) so the wrapper returns before GDS completes. status surfaces insights_stale (already wired) so the ≤1-refresh lag is observable. --full keeps GDS synchronous.

Spec References

intel_repo/scripts/sync-ori-graph.sh (GDS enrichment tail inside flock, rc-gated); intel_repo/neo4j/gds_enrich.py (skip-if-fresh, last_insights_at ‘checked not wrote’); intel_repo/CLAUDE.md §GDS Graph Insights Cadence (sync-tail; per-commit deliberately absent)

Work Items

  • Detach GDS enrichment from the synchronous --changed path (background, own flock)
  • Cheap legs (SCIP/symbols/CALLS) stay synchronous + complete before serve
  • status insights_stale reflects the ≤1-refresh GDS lag (observable, not silent)
  • --full keeps GDS synchronous; test: stale query returns before GDS finishes, insights catch up next gate