mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-23 18:46:18 +08:00
fd03f31b2c
A C++ method call whose receiver is another call's result — `Foo::instance().bar()`, `WidgetFactory::create().draw()`, `openSession()->run()`, or the same stored in an `auto` local first — lost the receiver's type during extraction. The callee degraded to a bare method name, so when two classes shared a method name the call silently resolved to whichever was indexed first (or not at all), corrupting callers / impact / trace with a plausible-but-wrong edge. Three parts: - Capture C++ return types (new nodes.return_type column, schema v5): the function_definition's `type` field, normalized — smart-pointer pointee unwrapped, void/primitives dropped. - Preserve the inner-call receiver in extraction: a C/C++ field_expression whose receiver is itself a call is encoded `inner().method` instead of dropping to the bare name. Other languages keep the existing behavior. - New resolution strategy (matchCppCallChain): infer the receiver's class from the inner call's return type, then resolve AND validate the method on it. Handles singletons/accessors, factories returning a different type, free-function factories, make_unique/make_shared/new/direct construction, single-level member chains, and namespace-qualified inner calls. A wrong inference yields no edge, never a wrong one. EXTRACTION_VERSION 2->3 (re-index to populate return types). Validated on the issue repro + spdlog: node count stable (no explosion), deterministic, and ~100 pre-existing wrong `.size()`-style edges removed. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
25 lines
1.3 KiB
TypeScript
25 lines
1.3 KiB
TypeScript
/**
|
|
* Extraction version
|
|
*
|
|
* A monotonically-increasing integer that identifies the *shape and depth* of
|
|
* what the extractor writes into the graph. Unlike `CURRENT_SCHEMA_VERSION`
|
|
* (which tracks the SQLite table layout and is migrated in place), this tracks
|
|
* the EXTRACTED CONTENT — node kinds, edges, synthesizers, resolver coverage.
|
|
*
|
|
* When an index was built by an older engine whose `EXTRACTION_VERSION` is
|
|
* below the running engine's, the data on disk is structurally fine but
|
|
* *stale*: it's missing whatever a newer extractor would now produce. A schema
|
|
* migration can't backfill that — only a re-index can. So this is the signal
|
|
* `codegraph status` uses to recommend a re-index, and the reason `codegraph
|
|
* upgrade` reminds users to refresh their projects.
|
|
*
|
|
* BUMP THIS when a release changes extraction output enough that existing
|
|
* indexes should be rebuilt to benefit — e.g. a new language/framework
|
|
* extractor, a new dynamic-dispatch synthesizer, a new node/edge kind, or a
|
|
* resolver fix that materially changes which edges exist. Do NOT bump for
|
|
* pure bug fixes, CLI/UX changes, or schema-only migrations. Over-bumping
|
|
* turns the re-index hint into noise — keep it honest (see CLAUDE.md, "Honesty
|
|
* in the product is load-bearing").
|
|
*/
|
|
export const EXTRACTION_VERSION = 3;
|