`def sort[A: Ordering]` desugars to an implicit `Ordering[A]`, so a context
bound is a real dependency the function has on that typeclass -- and the
idiomatic form is more common in modern Scala than the desugared
`(implicit ...)` it compiles to. `context_bound` was not referenced anywhere
in the extractor, so the dependency was invisible wherever it appeared.
Two grammar shapes drive the implementation, both verified against
tree-sitter-scala 0.26.0 before writing the fix:
- `context_bound` is a direct child of `type_parameters`, one per bound, so
the walk belongs in the existing per-function Scala block and needs no new
handler.
- A higher-kinded parameter nests a further `type_parameters` for its own arity
brackets (`def program[F[_]: Async: Temporal]`), so the walk recurses rather
than reading direct children only -- otherwise both bounds on `program` are
missed.
`upper_bound` (`[T <: Comparable[T]]`) is a distinct node type and is
deliberately not matched: a subtype constraint is not a dependency, so an edge
there would assert something the source does not say. Bounds also get their
own `type_bound` context rather than reusing `parameter_type`, so a consumer
can tell a typeclass constraint from a parameter annotation.
One trap worth recording, because the neighbouring code invites it:
`type_parameters` and `parameters` carry the *same* field name on
`function_definition`, so `child_by_field_name("parameters")` returns whichever
comes first. The bounds are therefore located by node type, never by field
name -- a field lookup would read the function's real parameters as bounds. A
regression test pins that `xs: List[A]` still resolves under `parameter_type`
and never under `type_bound`.
Verified:
- uv run pytest tests/test_scala_context_bounds.py -q (10 passed)
- 6 of the 10 new tests fail on the pre-fix tree
- uv run pytest tests/ -q -> 28 failed, 6164 passed, 101 skipped; the 28
failures are byte-identical to the clean-tree baseline and none touch Scala
- uv run ruff check . -> clean
- uv run pyright -> 635 errors, identical to the clean-tree baseline
Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit e293b64f6e)
A type alias (`type Alias = List[Int]`), an `opaque type`, and a `match type`
all declare a dependency on the types they name, but the type-reference
dispatch only fired for `val_definition`/`var_definition`, so these produced
zero `references` edges in any context -- in contrast to a `val`/`var`, whose
annotation is walked.
`match_type` needed a second, independent change: the type-reference walker's
recursion whitelist did not know `match_type`/`type_case_clause`, so even a
correctly dispatched call on a match type's right-hand side would have
resolved nothing. Both are now handled, recursing over named children exactly
as `compound_type` already is.
Verified field names against tree-sitter-scala 0.26.0 before writing the fix:
`type_definition` carries its RHS under the `type` field for all three forms
(`generic_type`, `type_identifier`, `match_type`), so the existing
`child_by_field_name("type")` walk applies verbatim and no new handler is
needed. File-scope aliases inherit the #2054 anchor fallback.
Scope: only the edges are added. The alias still gets no node of its own, which
is a separate already-accepted tradeoff shared with `val`/`given` bindings.
Verified:
- uv run pytest tests/test_scala_type_definition.py -q (10 passed)
- 8 of the 10 new tests fail on the pre-fix tree
- uv run pytest tests/ -q -> 28 failed, 6154 passed, 101 skipped; the 28
failures are byte-identical to the clean-tree baseline and none touch Scala
- uv run ruff check . -> clean
- uv run pyright -> 635 errors, identical to the clean-tree baseline
Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 879dfd330d)
Scala 3 allows `val`/`var` to be written directly at file scope with no
enclosing object/class/trait. The `val_definition`/`var_definition`
type-reference dispatch was gated on `and parent_class_nid`, so a file-scope
binding produced no node and no edge of any kind, while the byte-identical
definition nested one level inside any container resolved correctly. The
missing container was the only difference: both positions parse to the same
node type carrying the same `type` field.
This is the Scala instance of a generic defect in the walker's default
recursion path that had already caused and been fixed once for Python
(#1050) -- a position that legitimately has no container must fall back to
the file node rather than be skipped. The fix reuses the `owner_nid =
parent_class_nid or file_nid` idiom already present in the property branch
above, and moves the self-reference guard onto the same anchor so a
file-scope binding cannot mint an edge from the file node to itself.
Behaviour is unchanged for class-nested bindings; a regression test pins
that case explicitly.
Verified:
- uv run pytest tests/test_scala_top_level_binding.py -q (8 passed)
- 6 of the 8 new tests fail on the pre-fix tree, 2 pass either way
(the in-class control, and the self-edge guard which is trivially empty
before the fix and meaningful after it)
- uv run pytest tests/ -q -> 28 failed, 6144 passed, 101 skipped; the 28
failures are byte-identical to the clean-tree baseline (missing
tree-sitter grammars for erlang/R/solidity/vbnet, plus ollama retry
tests) and none touch Scala
- uv run ruff check . -> clean
- uv run pyright -> 635 errors, identical to the clean-tree baseline
(pre-existing debt; this change adds none)
Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 2d61ef7e68)
Two small follow-ups on the 0.9.75 batch:
- merge-graphs --previous now reports a clear error and exits 1 on a
malformed/unreadable JSON file instead of crashing with an uncaught
traceback (follow-up to #4006).
- JS/TS super.m() fails closed (no edge) instead of falling back to the
file-wide name map, which bound it to the overriding method as a wrong
self-loop. The extends chain is unknown at this pass, so super can
never be resolved here; inherited this.m() still keeps the plain
lookup (follow-up to #4012).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Covers the exact shape from the issue through the real CLI command
(an imports edge and a calls edge between the same pair surviving a
cluster only run), plus a direct unit test on the export function
confirming only a dangling endpoint is dropped, never a real pair.
Confirmed to fail against pre fix code.
(cherry picked from commit 5bde5b5a06)
Covers the exact shape from the issue: a file imports a symbol that a
second file contains, with no direct file to file edge between them.
Confirmed to fail against pre fix code (reports no path found despite
both halves of the route existing).
(cherry picked from commit 6a7a720894)
The ollama branch of _call_openai_compat assigned extra_body outright,
so the {"thinking": {"type": "disabled"}} body that
GRAPHIFY_DISABLE_THINKING sets a few lines earlier was discarded and the
flag was silently inert on that backend. Merge the num_ctx / keep_alive
defaults into whatever is already there.
A provider-supplied extra_body is unaffected: that case already skips
the ollama defaults entirely.
Part of #3988.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit f5cc53cf12)
Covers the exact shape from the issue: a real previous merged
clustering restored by node id instead of merge graphs' own fresh
per source offset, plus a new node getting no community rather than
an unrelated offset. Confirmed to fail against pre fix code.
(cherry picked from commit b9f21e9bec)
Covers the exact shape from the issue: two projects, each with their
own absolute cache directory, touched in one process. Confirmed to
fail against pre fix code: shared, poisoned index, no warning on
switch, and a dropped reload when revisiting the first root.
(cherry picked from commit 2429ce1b0e)
A `macro_rules! name { ... }` is a named, invocable item, but its node
type (macro_definition) had no branch, so the macro was dropped entirely:
it never became a node, and a `name!(...)` invocation of it (a
macro_invocation, never a call_expression) had nothing to resolve to.
Emit a node per macro_definition and resolve a bare `name!` invocation to
it with a calls edge. Macros are tracked in their own name registry, not
the function/type label map, because a macro and a function can share a
name (`vec!` vs `vec`); the node id is macro-qualified for the same
reason and the label carries a `!`. A scoped invocation (`log::info!`)
is cross-module/crate and stays unresolved (fail-closed).
Adds regression tests for the dropped definition, the resolved local
invocation, name coexistence with a same-named function, and the
unresolved scoped case.
(cherry picked from commit 7010322250)
defmacro/defmacrop (macros) and defguard/defguardp (guard macros) define
named, invocable members with the same head shape as def/defp — a call
head, optionally wrapped in a when binary_operator. Only def/defp were
handled, so these fell through to the generic recursion and were dropped
entirely: the member was never a node, and a call to a locally-defined
macro had nothing to resolve to.
Handle them in the same branch as def/defp. They are already listed in
the call-pass skip keywords, so their defining keyword is never mistaken
for a call.
Adds a regression test proving the macro, private macro, and guard were
previously dropped and that a call to a local macro now resolves.
(cherry picked from commit 237d358e39)
A PHP 8.1 `enum` is in the PHP class_types, so the enum type and its
methods were captured, but the cases (`case Hearts = 'H';`) nest in the
`enum_declaration_list` body as `enum_case` nodes that no handler
visited. They were dropped, leaving the enum a caseless leaf.
Add a PHP extra-walk that emits a node plus a case_of edge per case,
keying the name off the case's `name` field. This brings PHP to parity
with Java #1719 (enum_constant), Scala, Swift, and C++. Backed enums
(`: string`) and pure enums are both handled, and enum methods are
untouched.
Adds a regression test proving the cases were previously dropped.
(cherry picked from commit 3a9d305277)
A Zig error set (`const E = error{ A, B };`) parses as a
variable_declaration whose value is an error_set_declaration. That value
node type was not among the recognised forms, so the declaration fell
through the variable_declaration handler and both the error type and its
members were dropped entirely.
An error set is a named enumeration of error values, the direct parallel
of a Zig enum. Recognise error_set_declaration and emit the type node
plus a node and a case_of edge per member identifier, matching the
existing enum-member handling. Struct and union fields are untouched.
Adds a regression test proving the whole declaration was previously
dropped.
(cherry picked from commit 3e7f4a5905)
self.save, a paren-less save and save(x) with no receiver all send to
the current object, but they went through the file-wide name map,
which keeps only the last definition of each name, so they landed on
whichever class the file declares last, as EXTRACTED. In sinatra's
base.rb, Helpers#not_found was wired to Base#error and
AcceptEntry#to_s to MimeTypeEntry#to_str.
Route them through _self_call_target with the in-file inherits walk.
A top-level def and a mixed-in module method are not methods of an
unrelated class, so implicit-self sends to them resolve as before.
(cherry picked from commit 0175b64783)
self.save(), a bare save() (implicit self) and super.ping() in a Swift
method went through the file-wide name map, which keeps only the last
definition of each name, so they landed on whichever class the file
declares last, as EXTRACTED. In Alamofire, DataRequest.init calling
super.init() was recorded as DataRequest.init calling itself, and
URLEncodedFormEncoder's keyed container calls went to the unkeyed one.
Route them through _self_call_target with the in-file inherits walk,
which Swift supports because its inherits edges exist at this point.
Free functions, constructors and calls from an extension of the same
type resolve exactly as before.
(cherry picked from commit a8333ea8a1)
this.save() in one JS/TS class was resolved through the file-wide name
map, which keeps only the last definition of each name, so a class that
calls this.save() was wired to the save() of whichever class the file
declared last, as EXTRACTED. In zod's v3 types.ts every ZodString,
ZodNumber and ZodBigInt check method landed on ZodDate._addCheck.
Route this.m() and super.m() through the self-call lookup the Python
fix added, renamed _self_call_target. It binds to the caller's own
class when that class defines m(). JS/TS extends edges are only emitted
by the later symbol pass, so the base chain is unknown at this point;
anything the own class does not define keeps the plain lookup, which
leaves inherited this.m() edges exactly as they were.
(cherry picked from commit 33184e7b06)
self.m(), cls.m() and super().m() are exempt from the receiver-typed
defer because the receiver is the caller's own instance, but the lookup
they fell through to was the file-wide name map, which keeps only the
last definition of each name. Two classes in one file that both define
m() sent every self-call to whichever was declared last, as EXTRACTED.
On httpx that wires the sync Client's request/send chain into
AsyncClient, and every super().__init__() in _exceptions.py into
RequestNotRead.__init__.
Resolve these against the enclosing class, then its in-file bases
nearest first (super skips the class itself), the same order the ObjC
resolver uses for self. A tie between two bases on one level binds
nothing, and a method of a class outside the chain is never the target.
A module-level callable stored on the instance still binds as before.
(cherry picked from commit 02e1ed4e10)
build_merge carries forward the hyperedges of files that were not
re-extracted, but it skipped any carried hyperedge whose id also appeared
in the new chunks, whichever file the new one came from. Hyperedge ids
are chosen per extraction, so two documents can emit the same id: a full
build keeps both, yet re-extracting only one of them silently dropped the
other file's hyperedge.
Match a re-emission on (id, source_file) instead of id alone. The new
side's source_file is normalized the same way the carried side already
is, and an empty source_file counts as missing. A re-emission from the
same file, or a source-less hyperedge re-emitted without one, still
replaces the carried copy. merge_raw_extraction already replaces
hyperedges per source with no id-only check, so the two paths now agree.
Refs #3981
(cherry picked from commit 0c72e04c8a)
Register .vh with the existing Verilog detection and extraction paths,
including incremental and watch coverage.
Refs #3749
AI-Assisted-By: OpenAI Codex
(cherry picked from commit 3b74b8ad3d)
A wikilink such as [[note.en]], [[v1.2 release]] or [[Mr. Smith]] was
dropped: Path("note.en").suffix is ".en", so the target skipped the
extension-less .md completion and was rejected as a non-document link,
although note.en.md exists and is a node. The docstring already promised
that extension-less wikilink targets resolve to sibling .md.
For wikilinks only, a target whose suffix is not a document extension is
now retried as <name>.md through the same sibling-then-vault resolution,
and kept only when that document exists. A literal target that graphify
indexes itself keeps precedence: [[pic.png]] beside pic.png and
pic.png.md still yields no edge. [[missing.en]] and inline/reference
links keep their current behavior.
Assisted-by: assayer harness on Claude Code (https://github.com/Yyunozor/assayer-memory-mcp)
(cherry picked from commit 3d281a674a)
When a class is only referenced in a type annotation (Python) or a generic
argument (C#) earlier in the file, that reference mints a source-less stub
with the class name. A later `Parser()` / `new Widget()` in the same file
found the stub in the local lookup, was recognised as an external stub, and
was dropped: it was neither emitted as a local edge nor queued for
cross-file resolution. Since 0.9.62 these constructor edges were missing.
Queue those calls for cross-file resolution as well. That pass already
refuses source-less targets (#3156), so the stub itself still never becomes
a calls hub.
These calls did not bind to anything before, so a rescued call is marked
and only binds with evidence: an import of the target, or for C# the
namespace / `using` scope via CsharpNameResolver. Without that, a file that
imports `com.lib.Client` or uses `System.Collections.Generic` would bind
`new Client()` / `new List<int>()` to an unrelated same-named class.
For C#, `new X()` also drops `case_of` / `defines` targets from its
candidates, the same exclusion the C# type-definition index uses (#3815),
so it cannot bind to an enum member or property named X.
Fixes#3888
(cherry picked from commit e4a9270f45)
Rust's standard-library types were absent from _LANGUAGE_BUILTIN_GLOBALS, so
every Option/Vec/String/Result annotation was extracted as a domain type and
resolved to a few canonical nodes with corpus-wide degree (String led a
1,200-file workspace with ~1,700 edges).
Add a Rust-only _RUST_BUILTIN_TYPES set, kept separate so the same names still
resolve as user types in other languages, and skip those names in the Rust
type-reference and call collectors. The filter is definition-aware: a file that
defines its own `struct Result<T>` keeps its references.
A tuple-struct construction (`ClientId(id)`) targets a data definition, not a
callable, so it is now emitted as `references[constructor]` instead of `calls`
in both the in-file and cross-file paths; a real function call still emits
`calls`.
(cherry picked from commit 88cb2a8cd1)
Ids are casefolded, so `fn handle`, `const HANDLE`, `struct HANDLE` or an
`impl` for `HANDLE` share the id of `struct Handle`, and walk() keeps
whichever item comes first. The pre-scan registered the type id
regardless, so a reference placed above the declarations was bound to
that shared id and could end on the function or on the other item, where
v8's extractor left a sourceless stub. For the same reason a `HANDLE`
reference (a `type HANDLE` alias, or an imported name) placed above a
local `struct Handle` was bound to the struct.
Only pre-register a type when every file-level item behind its id is
that same type (`#[cfg]` twins count once), and match it by its exact
name. An `impl` block counts as the type it names, since walk() gives it
the node of its type text; methods keep impl-qualified ids and are not
counted. Otherwise the forward reference keeps its stub. A reference
placed after an item that already owns the id still resolves through
seen_ids, unchanged from v8.
Adds regression cases for a type colliding with a function (also in an
`extern` block), a const, a static, another type, an `impl` for another
type and a type alias, and controls where the id is not shared: another
function name, `#[cfg]` twins, an `impl` for the type itself, a method
named like the type, and a generic type only an `impl` names.
Assisted-by: assayer harness on Claude Code (https://github.com/Yyunozor/assayer-memory-mcp)
(cherry picked from commit 93fa872e2c)
ensure_named_node only resolved names already in seen_ids, so a struct,
enum or trait used above its declaration in the same file got a
sourceless stub:
fn before(s: &Sink) {}
struct Sink { n: u32 }
The corpus-level rewire folds that stub back onto the real struct only
when the name is unique across the corpus. Once another file declares a
`Sink` as well, the reference stays on the stub, and `affected` or
`explain` on the local struct miss that user.
Pre-scan the struct/enum/trait names the file declares, as the Verilog,
SQL and Bash extractors already pre-scan their definitions, and let
ensure_named_node resolve against them, so a use above a declaration
resolves exactly as a use below it already does. Only these three items
are pre-registered: walk() never makes a node of a `type` alias or
`union`, so registering one would leave its references to be dropped by
the final dangling-edge filter. The scan never descends further than
walk(), so every registered id ends up as a node.
Adds regression coverage for a struct, enum and trait used above their
declarations, a type declared in an inline module, the two-file
ambiguous case (cold and warm cache), and the items that must not
resolve a forward reference (type alias, union, function body, const
and static initializers).
Assisted-by: assayer harness on Claude Code (https://github.com/Yyunozor/assayer-memory-mcp)
(cherry picked from commit d73c4adf59)
Inside a class body a `virtual double area() = 0;` (pure virtual), a
`virtual void draw();` and a plain prototype `int run();` parse as a
`field_declaration` whose declarator is a `function_declarator`. The field
branch recognised that shape only to skip emitting a type reference — it still
emitted a node for every declarator as a DATA MEMBER (a bare `area` label with
a `defines`/field edge).
So a pure-virtual interface class had no method nodes, only phantom fields; a
header-declared method and its out-of-line/overriding definition did not share
one node (`area` field vs `.area()` method); and a call to such a method
resolved to a field-shaped node.
Fix: in the field-declaration branch, emit a function_declarator with the same
shape a defined method uses — a `.name()` label, a `method` edge, and callable
— so the declaration and its definition collapse to one method node (parity
with the Java/TypeScript/Scala abstract-method contract). A genuine data member
still gets its `defines` field edge.
This corrects the label of every header-declared method, so a few existing
cross-file tests that asserted the old bare `bar`/`run` field label now assert
`.bar()`/`.run()`; the resolved call edges (source, target, confidence) are
unchanged, and the decl/def merge still produces exactly one node carrying the
definition site.
Added tests/test_cpp_method_declarations.py.
(cherry picked from commit 0038af9394)
A bodyless `def area: Double` parses as `function_declaration`; a `def` WITH a
body is `function_definition`. Only the latter was a Scala function type, so
every deferred (abstract) method was dropped.
In Scala that is the common case, not an edge case: a `trait` used as an
interface is entirely deferred defs, so the whole contract vanished — the trait
had no method nodes, and a concrete method calling a deferred one
(`describe` -> `name()`) had no target to link to. The same held for an
`abstract class`'s abstract members.
Fix: add `function_declaration` to the Scala function types. A bodyless `def`
only occurs inside a `trait`/`abstract class` body, so it is always a method
declaration; its name sits on the same `name` field as `function_definition`.
Added tests/test_scala_abstract_methods.py: deferred methods (with and without
a parameter list) become nodes in both a trait and an abstract class, a pure
interface trait keeps every contract method, and a call to a deferred method
now resolves.
(cherry picked from commit 7c82507b5e)
An abstract class's `abstract area(): number;` parses as
`abstract_method_signature`, which was not a TypeScript function type, so the
abstract method was dropped. An interface's `method_signature` has long been a
function type, so `interface D { draw(): void }` put `draw` in the graph — but
the identical contract on an `abstract class` did not.
The result: the base of an abstract class kept only its concrete methods, a
polymorphic `shape.area()` had no declaration to resolve to, and the overridden
contract had no node to carry it.
An abstract method is the same kind of contract as an interface method: a
subclass must implement it. Add `abstract_method_signature` to the TS function
types (inherited by the TSX config). Its name sits on the same `name` field as
`method_signature`, so no other change is needed. Abstract fields
(`public_field_definition`) are left as-is, matching concrete fields which are
not nodes either.
Added tests/test_ts_abstract_methods.py: the abstract method becomes a node,
a call through the abstract type resolves to it, and it reaches parity with the
interface method it mirrors.
(cherry picked from commit 2100098042)
A receiver-less Ruby method call written without parentheses — the most
common call form in idiomatic Ruby — was dropped from the call graph:
def run
build # a method call on self
end
Tree-sitter parses that `build` as a bare `identifier`, structurally
identical to a local-variable read (`x`). The call-walk only inspected
`call` nodes, so `build(1)`, `self.build` and `build arg` all produced a
`calls` edge while the bare `build` produced nothing. A whole module of
mutually-calling helpers could end up with no internal edges at all.
The Ruby resolver already had a dedicated bare-call promotion path, but it
had nothing to promote because extraction never produced the call.
Fix: mirror Ruby's own disambiguation rule — a bare identifier is a send on
`self` unless a local or parameter of that name is in scope. `_ruby_local_names`
collects the bound names of a method body (parameters, assignments, block
params, `for` variables, `rescue` captures); a bare identifier not among them
is routed through the normal callee path as a non-member call, resolving
in-file (EXTRACTED) or becoming a raw_call the resolver can prove.
The collector is deliberately over-inclusive, so a missed binding only
suppresses a candidate call (fail-closed) rather than inventing a wrong edge.
A receiver-position send (`logger.info` where `logger` is itself a send) is
left for a follow-up and stays unresolved rather than guessed.
Added tests/test_ruby_bare_self_send_calls.py covering the self-send, the
cross-module and mixed-in cases, and the negatives (a local, a parameter and
a block parameter that shadow a method name must NOT become calls).
(cherry picked from commit c95b11c8e6)
_window?.Refresh() parses as a conditional_access_expression, not a
member_access_expression, so the invocation branch fell through to the
raw-text fallback. That split "_window?.Refresh" on the dot and recorded
the receiver as "_window?", which no receiver table types, so the call
was dropped with no unresolved entry.
Read both shapes through one helper that returns the name and receiver
nodes, and use it for the call-site generic-argument walk as well, so
recv?.Do<T>() keeps its references edges. The cast and partial-class
receivers from #3797 are separate and not touched here.
(cherry picked from commit e6e39a9aa5)
The body walker only visited `call` nodes, so a `fun Name/Arity`
reference — the idiomatic way to pass a local function to lists:map,
spawn, etc. — was dropped from the call graph. It parses as an
internal_fun node (name in the `fun` field, arity in the `arity` field).
Resolve it by exact name and arity and emit an indirect_call edge: the
function is handed off to be invoked, not called on the spot. Remote
references (fun mod:f/2, external_fun) name an explicit module and belong
to the cross-file remote-call boundary; they stay unresolved here.
Fixes#3993
(cherry picked from commit 1748e9bf0a)
A colon call `obj:method()` parses as a method_index_expression whose
callee is in the `method` field and whose receiver is in the `table`
field, but _LUA_CONFIG read the absent `name` field, so the callee was
never captured and every colon call was dropped from the call graph.
Point the accessor at the right fields and, when the receiver is `self`,
rewrite the bare method name to its enclosing-table label (Animal:method)
so it resolves like any other colon-method definition. An arbitrary-object
receiver (other:m()) is left unqualified and deferred so it cannot bind to
an unrelated same-named bare function.
Fixes#3991
(cherry picked from commit 000b0775c0)
When ~/.claude/CLAUDE.md is a symlink, the registration block is written
into the file it points to, but install only printed the link path, so a
rules file elsewhere changed without any mention. Print `link -> target`
for symlinks on install and on the project-scoped removal path.
(cherry picked from commit f05abb2b25)
When removing the graphify section leaves an instructions file empty,
uninstall deletes it. If the file is a symlink, only the link was deleted
and the graphify section stayed in the file it points to. Now uninstall
writes through the symlink instead, so the target is cleaned and the
link stays.
Applies to .claude/CLAUDE.md, CLAUDE.md, GEMINI.md, AGENTS.md,
CODEBUDDY.md and .github/copilot-instructions.md.
(cherry picked from commit cf260b5163)
Upgrading the package never touches hooks already on disk, so repos
initialised before a hook fix (such as the #2253 console-window launcher)
keep running the old script while `graphify hook status` says
"installed". Status now compares the installed graphify block with the
current template, ignoring the two per-install values (the pinned
interpreter and the viz limit export), and tells the user to run
`graphify hook install`, which already rewrites the block in place.
(cherry picked from commit 2e43d53ffa)
_label_batch_with_retry retried the ids a truncated reply left out (#3671)
inside the try that guards the batch's own parse. A retry that still would
not parse therefore landed in this batch's except branch, which re-split the
whole batch, asking the backend again for ids it had already named, and when
that failed the same way the error discarded every name of the batch, the
ones already parsed included. Likewise, once a parse failure split a batch,
one half failing at the base case discarded the names the other half got.
Parse the batch's own reply inside the try, then retry the missing ids (all
of them after a parse failure, the plain #1278 split) outside it, one half at
a time: a half that still won't parse is recorded and the other half still
runs. A batch re-raises only when none of it could be named, so
label_communities still skips a batch that yields nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 24055dabfc)
`push_to_falkordb` and `push_to_neo4j` upsert every node with
`MERGE (n:<Label> {id: $id}) SET n += $props`, which matches on (label, id).
Neither path created an index on that pattern first, so the engine had to
scan every node already carrying the label to decide whether the node is
already there. Each upsert then costs O(nodes with that label) and a full push
degrades to O(n^2): on the graph in #3804 (167,428 nodes / 209,215 edges
across 6 labels) throughput collapsed from ~10,000 node upserts/60s to
~100 upserts/300s partway through, with the database at ~97% CPU.
Create one index per distinct label up front, before the upsert loop. The
label set is derived exactly as the push loops derive it, so every label a
MERGE matches against is covered. Neo4j uses IF NOT EXISTS to stay idempotent
across re-pushes; FalkorDB's CREATE INDEX has no such clause, so a re-push
against an already-indexed graph is tolerated rather than failing an
otherwise valid push.
Refs #3804
Co-Authored-By: opencode space-bunny-free <noreply@opencode.ai>
(cherry picked from commit a3275e2c97)
With exclude_hubs_percentile set, excluded hubs are removed from the
graph that gets partitioned. A node whose only neighbours are hubs (e.g.
a local symbol of a hub file, or a dependency entry of a manifest) is
then isolated in that subgraph and came back as a singleton community,
while the hub itself was reattached by majority vote. Every such node
ended up cut off from the only node it connects to, and the community
count inflated with singletons.
Such nodes are now held out of the partition and placed after the hubs
are reattached, with the same majority vote the hubs use; since all of
their neighbours are hubs and every hub is placed by then, the vote
always has a winner. A self-loop does not count as a neighbour. True
isolates, and nodes whose only edge is a self-loop, are unchanged.
Follow-up to #919, where --exclude-hubs was introduced. The cluster()
docstring now says so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 39a24a0626)
extract_astro fed the whole .astro file to the JS grammar. The template is
not JS, so every page reported a syntax error (usually at line 1-2) and
symbols tree-sitter could not recover past the template were dropped.
Blank everything outside the frontmatter and JS <script> bodies (keeping
newlines so locations still match, as _vue_mask_non_script does) and parse
with the TS grammar, Astro's default. Scripts with a non-JS type
(application/ld+json, ...) are blanked too. The existing regex import
rescue is unchanged.
Fixes#2788. Covers the unmasked-script half of #3337.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit fe07657fe1)
_top_level_dir() returned the whole path when it had no "/", so two
files at the scan root (a flat folder of notes, or README.md and
setup.py) got different "top-level dirs". Every such cross-file edge
(other than suppressed INFERRED calls/uses) received +2 and the reason
"connects across different repos/directories" in surprising_connections,
which is false.
- A path without "/" now maps to the scan root ("."). "." rather than ""
keeps root files distinct from an absolute path outside the scan root,
whose first component is "".
- Backslashes and a leading "./" are normalized first: build_from_json
converts backslashes but keeps "./", and serve.py's _load_graph() and
API callers can skip build_from_json altogether.
- The comparison key is (node "repo", top-level dir). merge-graphs and
global add keep source_file repo-relative and tag nodes with "repo",
so two repos can share directory names; single-repo graphs have no
"repo" and are unaffected. On merged graphs a cross-repo edge now gets
the bonus whenever the repos differ; before, it depended on whether
the top-level directory names happened to differ.
Tests: the flat case (fails on d6eaa8a), merged graphs, backslash and
"./" paths, plus pins for what must not change (root vs subdirectory,
root vs out-of-root absolute path).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 05d6410535)
The invocation resolver only fired for self/unqualified receivers (Me, the
enclosing type, or a bare name). A call qualified by a type or module name —
Helpers.Log(), the idiomatic way to reach a shared Module Sub — matched
nothing and produced no edge at all, so the caller was disconnected from the
method it invoked.
Map each declared type/module's short name to its owner key, and resolve a
qualified call against the receiver's owner (falling back to raw_calls for
cross-file partial-type merging). A call through a value receiver (a local
variable) still has no known owner and is left unresolved rather than
guessed (fail-closed).
(cherry picked from commit 1297c18f50)
Free (file-level) functions have been valid Solidity since 0.7, but the
extractor only descended into named type declarations (contract, library,
interface, abstract contract). A function declared at source-unit scope —
and every call made from its body — was dropped entirely, so a file of
free utility functions produced no nodes at all.
Walk source-unit function_definition nodes, emit each as a file-contained
callable node, and resolve an unambiguous same-file free-function call to a
calls edge. Member calls (Lib.f()) are parked as raw_calls for cross-file
resolution; calls that cross into contract scope are left unresolved rather
than guessed (fail-closed).
(cherry picked from commit d2e56e932f)
`enum_specifier` was missing from the C++ class_types, so an `enum` or
`enum class` produced no nodes at all: the enum type and every enumerator
vanished from the graph, even though struct/class specifiers right next to
them were extracted normally.
Add `enum_specifier` to the C++ class_types — its name and body sit on the
same `name`/`body` fields as struct_specifier (type_identifier +
enumerator_list) so the type gets a node and its body is walked — and add
`_cpp_extra_walk` to emit a node plus a `case_of` edge per `enumerator`.
Anonymous enums (`typedef enum { A, B } Flag`) carry no type name and are
skipped by the existing name guard rather than emitting a nameless node.
This is the C++ parity of Java's enum_constant (#1719), Swift, and Scala.
(cherry picked from commit 9cde6c2a7f)
`enum_definition` was missing from the Scala class_types, so a Scala 3
`enum` produced no nodes at all: the enum type, its cases, and any methods
declared in its body all vanished from the graph, and references to the
enum resolved to nothing.
Add `enum_definition` to the Scala class_types and `enum_body` to the
body fallbacks so the type gets a node and its body is walked, and add
`_scala_extra_walk` to emit a node plus a `case_of` edge per case. Cases
nest under an `enum_case_definitions` wrapper as `simple_enum_case`
(`case Red`) or `full_enum_case` (`case Add(x: Int)`); both carry the case
name as an `identifier` child. This is the Scala parity of Java's
enum_constant (#1719), Kotlin's enum_entry (#1738), and Swift.
Case constructor parameter types and per-case `extends` arguments are not
linked; the case node and its case_of edge are the fix for the dropped
members.
(cherry picked from commit 175af52419)
Member calls were only matched against the receiver's own type, so
this.start(), super.close() or worker.start() got no edge when the method
lives in a superclass. Walk up the extends chain and take the first
declaration. No edge if the chain leaves the project.
Fixes#3931
(cherry picked from commit a2da367fc7)
The enum body walk only emitted an enum's methods; its members — the
`container_field` nodes (`red`, `north = 0`) — were dropped, so an
`enum { red, green, blue }` produced a node for the enum with no members at
all, leaving it a leaf.
Emit a node plus a `case_of` edge per enum member. The handler is gated on
the `enum_declaration` parent so struct and union fields, which share the
`container_field` node shape, stay untouched. This brings Zig to parity with
the other languages that have enums: Java's enum_constant (#1719), Swift,
Scala, and Rust.
(cherry picked from commit 1e44311e22)