2948 Commits
Author SHA1 Message Date
safishamsiandClaude Opus 4.8 2ce70ce17d fix(global): isolate a malformed repo entry instead of discarding all (#5020)
Follow-up to #5025. The landed guard raised on any non-dict repo value, so a
single malformed entry backed up the whole manifest and dropped every tracked
repo. Keep the whole-file backup only for an unrecoverable shape (non-dict root
or repos map); when repos is a dict, drop just the malformed entries, keep the
valid repos, and report which went. Matches the per-entry isolation of #5024.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-07 22:33:44 +00:00
azizur100389 1192efc639 fix(global): recover from malformed manifest objects
Refs #5020.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
(cherry picked from commit b424a2f049)
2026-11-07 22:31:59 +00:00
azizur100389 204b50854d fix(reflect): preserve legacy null source fields
Keep source-less annotations while discarding malformed non-string paths. Refs #5019.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
(cherry picked from commit 44a7ca59c1)
2026-11-07 22:31:45 +00:00
azizur100389 bf1e19dce9 fix(reflect): isolate malformed learning overlay entries
Refs #5019.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
(cherry picked from commit 344f2ae53e)
2026-11-07 22:31:45 +00:00
azizur100389 cd54401097 fix(ingest): reserve URL capture names exclusively
Refs #5018.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
(cherry picked from commit de8345aa15)
2026-11-07 22:31:44 +00:00
azizur100389 4feadeda0d fix(watch): refresh JS/TS imports after resolver input changes
Refs #5017.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
(cherry picked from commit 84ca430505)
2026-11-07 22:31:44 +00:00
azizur100389 c66ccae853 fix(watch): rebuild the full corpus when graph.json is missing
Refs #5016.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
(cherry picked from commit 4f0d5eaa1a)
2026-11-07 22:31:43 +00:00
Peter Neumann 2394fd3f98 fix(query,serve): stop flagging fresh subfolder builds as pre-#1504
`graphify update sub` run from sub's parent stores source_file relative
to the build cwd (sub/pkg/mod.py, #2603) while ids are minted relative
to the scan root (pkg_mod). graph_has_legacy_ids derived the expected
stem from the stored path (sub_pkg_mod), so the real id matched the old
one-parent form and every query/MCP load of a freshly built graph told
the user to rebuild with `graphify extract --force`, which changes
nothing.

Read the cwd->scan-root offset from the relative .graphify_root marker
(new legacy_id_source_prefix) and strip it before deriving the stem.
Absolute, ".", and parent-escaping markers mean no offset, so behavior
for root-anchored graphs is unchanged and genuine legacy ids are still
reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TGb7YtZeBXGNQMw6JjuqZu
(cherry picked from commit f5ee99de8f)
2026-11-07 22:31:35 +00:00
ayushcodes10 67c139e403 Add regression tests for CloudFormation intrinsic tag tolerance
Covers a SAM style template using nested Equals and Ref tags
extracting its structural nodes instead of failing the whole file,
plus a control confirming a python object tag alongside an
intrinsic tag still raises rather than executing.

(cherry picked from commit 4e2b26b211)
2026-11-07 22:31:35 +00:00
ayushcodes10 d458e272b9 Tolerate CloudFormation intrinsic tags in the YAML extractor
CloudFormation and SAM templates spell their intrinsic functions as
short local tags such as Ref, Sub, GetAtt and Equals. SafeLoader has
no constructor for any of them, so loading such a template raised a
constructor error and the whole file produced zero nodes, even
though nothing about the tag itself is unsafe. Composing the node
tree never hit this, since composing never resolves a tag into a
value, only constructing the actual document did.

Added a SafeLoader subclass with a multi constructor registered on
the bare exclamation mark prefix that builds a plain scalar,
sequence or mapping from the tagged node's own shape, exactly as if
the tag were absent, and never evaluates the intrinsic itself. Every
built in safe tag keeps its own constructor unchanged, since those
are registered under the full yaml.org tag namespace rather than a
bare local tag, so a python object tag still raises exactly as
before.

(cherry picked from commit e018cc2f38)
2026-11-07 22:31:35 +00:00
Shaikh Fardin 444c164cfe fix(extract): hash ambiguous Python import placeholders from root-relative data
`_suppress_ambiguous_python_imports` mints a node-less
`ambiguous_python_import_<sha1>` target for an import that more than one
scanned module could satisfy. The hash included the edge's `source_file`
and `source` id as they are at that point in the pipeline, which is
before relativization: `source_file` is still the absolute path and the
importer id is derived from it. The same commit built in two directories
therefore produced different placeholder ids, so `graph.json` was not
reproducible across checkouts and community detection could differ.

Hash the scan-root-relative `source_file` (POSIX form) with the module
name and source location, and drop the path-derived `source` id. These
already identify the import site uniquely, and the existing
`while target in node_ids` guard still prevents a collision with a real
node.

Adds a regression test that builds the same tree in two checkout
directories and asserts identical placeholder edges; it fails without
this change.

Fixes #5044

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit ff047dfea7)
2026-11-07 22:31:34 +00:00
safishamsiandClaude Opus 4.8 b81d8e51da docs(changelog): open 0.9.104 for the Solidity/C#/query/watch/cache batch
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-07 17:23:05 +00:00
safishamsiandClaude Opus 4.8 6271f3ed40 chore(cache): combine the batch into one AST schema bump to 40
#5058, #5060, #5062, #5054 and #5056 each change per-file Solidity or C#
extraction output and each bumped _AST_CACHE_SCHEMA to 40 on their own. Landed
together in one release window they share a single bump; this folds their
descriptions into one chained schema-40 comment over the prior 39 so a warm
cache re-runs the affected Solidity and C# extractions exactly once.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-07 17:22:22 +00:00
rohit-jsfreaky 85ad8daa1e fix(csharp): credit calls in accessors, indexers and operators to that member
A C# property's accessor bodies, an indexer and a user-defined operator
or conversion were never walked, so every call made inside them was lost.
On Dapper, AutoMapper and Newtonsoft.Json (Roslyn answer key) that is 144
call links made from property/indexer accessors and 186 from conversion
operators, none found.

- A property's `get`/`set` bodies and an expression body (`int P =>
  F();`) are walked with the existing property node as the caller. An
  auto-accessor has no body and an initializer runs in the constructor,
  so neither adds calls. Only the declaration that owns the property
  node is walked: when the id is already another member's (an explicit
  `IFoo.Name` property spelled like a method `Name()`), its calls are
  dropped instead of being credited to that member.
- An indexer is a `this[]` node beside the properties (`defines`,
  context `field`), id `_make_id(type_id, "this")`, salted per
  signature (including an explicit interface) and away from a member
  spelled `This`.
- An operator or conversion is a `.operator +()` / `.operator int()`
  node owned through `method`; its id always carries a hash of the
  signature, since several conversions share one parameter list.
- A property/indexer counts as owned by its type for caller lookups
  (in-file unqualified calls, `this.`/`base.` member calls, the
  partial-type own-type preference), like a method. It is never a call
  target by name, and `operator` is kept out of the member-call index.
- No existing node id moves (checked on all three projects).
- AST cache schema 40.

Calls TO properties, indexers and operators are not linked: in these
projects they are about 3,500 property get/set links (more than half
to auto-properties), 27 indexer and 60 conversion links, against 0
user-defined binary operator calls. Linking them needs member-access
typing and a decision on the relation, so it is left out.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 0e6806a93b)
2026-11-07 17:21:33 +00:00
rohit-jsfreaky c3b6cfbd9f fix(csharp): make constructors nodes and link new/base/this to the overload by arity
A C# constructor had no node. Calls in its body were credited to the
type (#4246), calls in `: base(...)`/`: this(...)` arguments were never
walked, and `new X(a, b)` could only point at the type, never at the
overload it runs. On Dapper, AutoMapper and Newtonsoft.Json (Roslyn answer
key) 151 call links made from constructors were all lost and none of the
130 constructor initializers was linked.

- Each constructor (instance, static, and a type's primary constructor)
  is a node owned by its type through a `method` edge, labeled
  `.TypeName()` with metadata kind "constructor" plus arity/signature.
  The id is `_make_id(type_id, TypeName)`, the one a method named after
  the type would get; other signatures are salted like method overloads
  (#4584), a static constructor is its own "static" signature, and if a
  member spelled like the type in another case (`foo()` in `Foo`)
  already owns that id the constructor takes a salted one. No existing
  node id changes (checked on all three projects).
- Body and initializer calls belong to the constructor.
- `new X(...)` sites and initializers are recorded in raw_calls with no
  callee (so every name-keyed consumer skips them and the id passes
  remap their caller). A tail C# pass links the constructor whose
  parameter count fits, next to the existing edge to the type.
  `: this(...)` uses the own type, `: base(...)` the single resolvable
  base. Two fitting overloads, an unresolved base, or a type the caller
  did not bind give no edge.
- Constructors are left out of every name-keyed call index (in-file
  label map, global label index, member-call index, overload index,
  interface dispatch), so a constructor can never be picked for an
  ordinary call or shadow its type.
- AST cache schema 40.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 10332b79f5)
2026-11-07 17:20:08 +00:00
rohit-jsfreaky ebef2af2b9 fix(solidity): link a call attached by using A for T to the function
`using SafeCast for uint256; x.toUint48()` and `using EnumerableSet for
EnumerableSet.AddressSet; _set.add(a)` call the library function with
the receiver as its first argument, but the extractor parked
`x.toUint48` as a qualified call on a type named `x`, which never
exists, so no such call got an edge. On OpenZeppelin v5.4.0, 0 of the
228 calls solc resolves through a `using` directive were linked.

Record the directives in scope: a contract's own (`using` is not
inherited since 0.7), the file-level ones, and the `global` ones on a
type's declaration, as `using` metadata on the contract and file nodes,
and give library and free functions their `first_param_type`. The
resolver binds `recv.f(args)`, when the receiver's declared type is
known (the receiver typing of the previous commit, a base contract's
state variable or the return type of `g` in `g().f()`), to a function
`f` that a directive whose target is `*` or that type attaches, with
args + 1 parameters and the receiver's type as its first. The type must
match exactly, including user-defined value types and library structs
(`Trace208` inside Checkpoints reads as `Checkpoints.Trace208`, as a
caller writes it). An operator binding (`using {eq as ==} for T`)
attaches no member.

Fail closed: no edge when the receiver's type is unknown, a directive's
library name is ambiguous, or more than one function fits.

OpenZeppelin v5.4.0 (solc 0.8.28 AST as the answer key): using-for calls
0/228 -> 180/228; solmate: 0/10 -> 6/10. No other kind changes. Most of
the rest are chained calls (`slot.asBoolean().tload()`), calls written
inside a `?:` that tree-sitter parses as the member's object, and 7
calls made inside `_name` functions that share a node with their
`name` counterpart (the `_name` / `name` id merge), which land on that
merged node until the id merge is fixed.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 7bd9be0bee)
2026-11-07 17:19:52 +00:00
rohit-jsfreaky 8f3ce12426 fix(solidity): link a call on a typed receiver to the type's member
`IERC20 token; token.transfer(to, v)`, `IERC20(a).transfer(..)` and
`Ownable(x).owner()` got no edge: the extractor parked `token.transfer`
as a qualified call on a type named `token`, which never exists, and a
call on a conversion as a bare member call the shared pass drops. On
OpenZeppelin v5.4.0, 0 of the 74 such calls solc resolves were linked.

Bind `recv.f(..)` by name and arity through the receiver's declared
contract or interface type and that type's C3 linearization, the lookup
the compiler does. The type comes from the receiver typing the previous
commit adds, or from a base contract's state variable (`hevm.prank()`)
or the return type of `g` in `g().f()`. An interface method links to the
interface's declaration; no implementer is guessed. A type may be
imported through a file that re-exports it (`import {IERC20} from
"../ERC20.sol"`, the usual OpenZeppelin form), searched only when the
file declares and directly imports no type of that name.

Fail closed: no edge when the receiver is untyped, its type is not
exactly one visible contract/interface, the name/arity matches two
overloads, or a public state variable of that name (a getter) is found
first.

OpenZeppelin v5.4.0 (solc 0.8.28 AST as the answer key): typed calls
0/74 -> 71/74; solmate: 0/725 -> 716/725. No other kind changes. The 3
calls left on OpenZeppelin are made inside `_installModule` and
`_uninstallModule`, which share a node with `installModule` /
`uninstallModule` (the `_name` / `name` id merge), so they land on that
merged node until the id merge is fixed.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 752eaaf5fa)
2026-11-07 17:16:54 +00:00
rohit-jsfreaky 76d8179218 refactor(solidity): type the receiver of a member call
Read the declared type of `recv` in `recv.f(..)` and park the call as a
`member` raw call carrying that type, so a later pass can bind it through
the receiver's contract type or the `using` directives in scope. Nothing
binds `member` calls yet, so no edge changes.

A receiver is typed from a parameter, return variable or local of the
calling function (a name declared with two different types is ambiguous
and stays untyped), a state variable of the calling contract, an element
of a typed mapping or array, a field of a struct declared in the same
file, a conversion (`IERC20(a)`, `uint256(x)`, `payable(a)`) or a few
builtins (`msg.sender`, `keccak256(..)`, `abi.encode(..)`). The type is
normalized (`uint` -> `uint256`, whitespace) and a struct, enum or value
type declared in a contract is qualified with that contract's name, so
`Trace208` inside library Checkpoints and `Checkpoints.Trace208` in a
caller compare equal. A type name (`Lib.f()`) is not a typed receiver and
keeps its qualified-call path.

What only the cross-file pass can know is left to it: a state variable
node carries its `declared_type` and a function with one return value
its `returns` type, and `g(..).f()` records the call `g` it is the result
of. resolve_solidity_inherited_calls gains the helpers the binding passes
share: `receiver_types` (the extractor's reading, a base contract's state
variable, or the return type of `g`), `visible_types` (optionally through
re-exporting imports: `import {IERC20} from "./ERC20.sol"`) and a cached
`linearization`.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit abe5429cf5)
2026-11-07 17:15:50 +00:00
rohit-jsfreaky 122cede129 fix(solidity): keep _name and name apart in node ids
make_id strips a leading `_` (and folds case), so in one contract
`_grantRole(bytes32,address)` and `grantRole(bytes32,address)` minted
ONE id. add_node kept the first declaration and dropped the second: the
`_` function vanished from the graph, and every call it makes, and every
call to it, landed on its public twin. OpenZeppelin v5.4.0 has 38 such
pairs (`_grantRole`, `_transferOwnership`, `_safeTransferFrom`, ...),
which made 104 of graphify's `calls` edges ones the compiler does not
have.

Apply the rule C# got in #4415 (and Python in #3302): group the members
of a contract (functions, modifiers, events, errors, state variables,
structs, enums), the file's free functions and the file's types by the
id they would get, and run each through `_underscore_salted_nid`. The
one public name keeps the plain id and every other spelling of the
group is salted, so the outcome does not depend on declaration order. A
name without a colliding sibling keeps its id, so only the `_` spelling
of a clashing pair gets a new one.

OpenZeppelin v5.4.0 (solc 0.8.28 AST as the answer key): 3907 -> 3945
nodes, 38 new ids (all salted `_` functions), 0 existing ids changed;
wrong `calls` edges 104 -> 0; compiler-resolved calls found: same
803 -> 887, emit 119 -> 146, revert 403 -> 423, inherited 268 -> 279,
super 173 -> 185, library 205 -> 209. solmate has no such pair and is
unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 94a08d1d6d)
2026-11-07 17:14:26 +00:00
Vaibhav Gupta 1bfdcfffd2 fix(cache): keep stat-index keys root-relative under Windows long-path roots (#5035)
Since 99b8da78 (#4925), file_hash() and the word-count cache pass an
os_long_path() root to _ensure_stat_index(), which stored it as
_stat_index_anchor. On Windows that is the extended-length spelling
"\\?\C:\...", while the in-memory keys go through _normalize_path() and
drop the prefix. os.path.relpath() treats "\\?\C:" and "C:" as different
mounts and raises ValueError, so _flush_stat_index() kept every key
absolute; on load, relative keys were re-anchored with the prefix and no
longer matched the in-memory keys. A copied or moved corpus therefore lost
its stat-index hits, the portability #2199 added.

Normalize the anchor the same way as the keys. _normalize_path() is a
no-op off Windows, so other platforms are unchanged.

The three existing tests in tests/test_stat_index_portability.py fail on
Windows before this change and pass after it; CI runs on ubuntu-latest
only, which is why the regression was not caught there.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit fc7a6bda8b)
2026-11-07 17:14:18 +00:00
Bortlesboat 43360efb0c fix(cache): keep the \\?\ long-path spelling out of cache identity
99b8da7 and ff8ddf5 (#4925, #4937) open files through os_long_path(), but
on Windows its \\?\ spelling also leaked into cache identity.

file_hash() and cached_word_count() bound the stat index to the prefixed
root, so the plain cache_root that extract() passes read as a second root.
Every Windows `graphify update` that re-extracts warned "stat index
switched" (#3989) and flushed mid-run, and since no key was relative to the
prefixed anchor, stat-index.json was written with absolute keys and a moved
checkout re-hashed every file (#2199). The walked-parent match compared a
plain path with the prefixed root and never matched, so under a junctioned
or symlinked scan root an in-root alias took its target's salt and digest
(#2832), and the out-of-root salt carried a //?/ prefix. _normalize_path()
also stripped only \\?\, so the UNC form \\?\UNC\server\share became a
relative key that the flush pruned, and a corpus on a network or WSL share
always wrote an empty stat index.

Bind the index to the normalized root as before #4925, normalize the
resolved path and root before they become keys, salts or comparisons, and
map \\?\UNC\ back to \\. File I/O still goes through os_long_path(). CI
runs on Linux, where both helpers are the identity, so this only showed on
Windows.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 49616eb09c)
2026-11-07 17:14:17 +00:00
Deepjyoti-Sarmah 5212304ff8 test(watch): characterize the inotify overflow boundary
(cherry picked from commit 56bb24b39f)
2026-11-07 17:14:11 +00:00
Deepjyoti-Sarmah b0a9d775d1 test(watch): pin the event filter and fallback contract
(cherry picked from commit eb1914c087)
2026-11-07 17:14:11 +00:00
Deepjyoti-Sarmah a4db00821c fix(watch): keep read-only events out of the inotify mask (#5033)
(cherry picked from commit a5135ede7f)
2026-11-07 17:14:11 +00:00
Deepjyoti-Sarmah a4d4b03bc1 refactor(watch): detect watchdog event_filter support
(cherry picked from commit 7d94277bb4)
2026-11-07 17:14:11 +00:00
Deepjyoti-Sarmah f67daeba58 refactor(watch): extract the change-only event filter
(cherry picked from commit 52aacbb099)
2026-11-07 17:14:11 +00:00
Vaibhav Gupta 53ef377a36 fix(query): keep a same-label seed when it is the only match for a query term (#5027)
`_pick_seeds` caps seeds at one per normalized label so homonymous
symbols (dozens of `GET` handlers) cannot flood the BFS (#1766). The
per-term guarantee loop (#1445) applied the same cap, so a node that is
`best_seed_by_term[t]` was dropped whenever a higher-scoring node with
the same label was already seeded. When `t` is not part of that label,
the node won `t` through its source path, rationale or attributes, and
the seeded twin may not match `t` at all. The term was then left with no
seed, breaking the docstring's "at least one seed per distinct query
term" guarantee. Example: two `PreToolUse` classes in different plugins,
where only one path contains the query term `alpha`.

Narrow the cap in the per-term loop: skip a same-label winner only when
`term` is a substring of the shared normalized label. Then the seeded
twin matches `term` through that label (the same `t in norm_label` test
the scorer uses), so the term is already covered. #1766 still holds: a
second `GET` cannot be added for the term `get`. The first loop is
unchanged; a node it skips that is the only match for a term is now
added by the per-term loop.

Tests: the issue's 3-node repro (fails before the fix), and a degree
tie-break case where a second `GET` wins the term `get` per term. That
case is still capped, and it fails if the cap is removed entirely. The
existing #1766 per-term test cannot catch that, because its per-term
winner is already the first-loop seed.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 65c0d29225)
2026-11-07 17:14:10 +00:00
Yi-111-a 955c65de1e test: compare pending-queue paths as Path objects for Windows (#5039)
(cherry picked from commit 7ac78f83b1)
2026-11-07 17:14:04 +00:00
ayushcodes10 83ca144577 Normalize the source open mock through os_long_path before comparing
The hashing code opens the source file through paths.os_long_path,
which on win32 prepends the extended length backslash backslash
question mark backslash marker so a long path survives open. The
denied source mock compared that prefixed string against the plain
fixture path as ordinary Path objects, which never match on Windows
since neither Path equality nor resolve strips that marker. The mock
never raised, so the source failure branch silently exercised the
readable file case instead of the intended permission error, while
the sibling manifest branch already compared through resolve and
passed.

Normalize both sides through the same os_long_path helper the
source itself uses before comparing, so the two forms agree on every
platform.

(cherry picked from commit ff45f7049c)
2026-11-07 17:14:04 +00:00
ayushcodes10 499137470d Write the TS unicode fixture as UTF8 regardless of platform default
The regression test wrote its fixture through write_text with no
encoding, so it silently depended on the platform's default text
encoding. On a Windows machine whose default code page cannot encode
the accented character the fixture uses, the write itself raises
before the TypeScript extractor is ever called, failing the test for
a reason that has nothing to do with extraction.

Pass encoding equals utf8 explicitly so the fixture writes the same
way on every platform.

(cherry picked from commit 469904a0ce)
2026-11-07 17:14:03 +00:00
safishamsiandClaude Opus 4.8 16218bfc80 test(install): serialise the second wheel builder with an inline lock (#4603)
#4664 locked the test_wheel_packaging builder but not _build_wheel_names in
test_install_references, which also runs python -m build against the shared
build/ dir. Add an inline per-checkout flock (same mechanism) so two concurrent
runs on one checkout cannot collide; a cross-module import does not resolve
under pytest's import mode.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
v0.9.103
2026-11-05 13:02:18 +00:00
safishamsiandClaude Opus 4.8 c051a96ff3 chore: bump AST cache schema to 39 for the markdown namespace/member mentions (#4695)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-05 12:16:47 +00:00
viwe-monai 03838fe3af fix(markdown): recognise backslash namespaces and Type::member code-span mentions (#4610)
_code_span_mention accepted only the dotted and path-qualified forms, so the
separators other languages' docs write were dropped before the resolver saw
them: App\Services\Mailer (PHP namespaces) and Mailer::send() (PHP, Rust, C++
type-qualified members).

Both are now qualifier separators the way '.' already is, with Foo::CONST and
Foo::class left out (no node to land on) and a bare namespace root (App\)
dropped as the non-mention it is. A PSR-4 namespace root maps to the scan
directory and has no path segment, so when no candidate accounts for the whole
chain the resolver drops the leading qualifiers a candidate cannot account for,
falling back to the unique bare-name match; a qualifier that does match keeps
discriminating, so Mailer::send() still picks the right send().

(cherry picked from commit 8d6c3af9dd)
2026-11-05 12:16:21 +00:00
Oleksii Tumanov 17cf53666e feat(tree): cap directory children while retaining full totals
Apply max_children to single and merged directory roots after computing
complete descendant totals. Keep the existing file-symbol limit unchanged.

Refs #4766

AI-Assistance: OpenAI Codex
(cherry picked from commit 266865ab19)
2026-11-05 12:15:09 +00:00
safishamsiandClaude Opus 4.8 79cfb37fe0 test(install): serialise the second wheel builder under the shared lock (#4603)
#4664 locked the test_wheel_packaging builder but not _build_wheel_names in
test_install_references, which also runs python -m build against the shared
build/ dir. Reuse the same _wheel_build_lock so two concurrent runs on one
checkout cannot collide.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-05 12:14:38 +00:00
wanjinhao1 63cf60dd22 Fix #4603: stage fake install bundles in a temp package root, lock wheel builds
Assisted-by: AI coding agent (author: wanjinhao1)
(cherry picked from commit 60140356c0)
2026-11-05 12:12:04 +00:00
huangpz6 4c16a79817 test(hooks): isolate ambient venv and PATH in _detect_run
The emitted detector prefers an active virtualenv and the first python on PATH. Running the suite through uv run exposes the project .venv through both VIRTUAL_ENV and PATH, so the uv-tool machine fixture resolved to the project interpreter and test_shebang_parse_requires_leading_hash_bang failed locally. Scrub the venv variables and rebuild PATH from the stub bin plus os.defpath.

Co-Authored-By: TRAE <noreply@trae.ai>
(cherry picked from commit 6ead523c44)
2026-11-05 12:11:30 +00:00
Pratik Dhanave 892c452d8c test(reflect): characterize _is_stale across changed/unchanged/vanished sources
Add three characterization tests pinning the existing, correct behavior of
the learning-overlay staleness check (graphify/reflect.py::_is_stale) directly
at the helper level:

- unchanged source (stored fingerprint still matches) -> fresh (False)
- changed source content -> stale (True)
- vanished / unresolvable source path -> stale (True), the deliberate
  over-flagging safe direction for a re-verify hint

They use the writer's own _code_fingerprint to seed the stored fingerprint,
documenting that writer and reader agree on an unchanged file. No behavior
change.

(cherry picked from commit e80a50f2d9)
2026-11-05 12:11:27 +00:00
Wyatt Au d76b102905 docs: note the context-local semantics for spawned workers
(cherry picked from commit 83557a73f2)
2026-11-05 12:11:26 +00:00
Wyatt Au e93821ff3c fix: make the ambient scan root thread-isolated via ContextVar
_ACTIVE_SCAN_ROOT was a module global. Extraction runs concurrently
(ThreadPoolExecutor in tests, process pools in production), and
overlapping set/restore pairs in _safe_extract_with_xaml_root
interleaved: the second call saved the first one's root and restored it
last, leaving the ambient root set after extract() returned. Nine tests
downstream failed in any non-default order
(#4602, diagnosis by Deepjyoti Sarmah).

Replace the global with a contextvars.ContextVar: every thread (and
async task) gets its own value, so save/restore pairs nest correctly by
construction and the set/return-previous API is unchanged.

Proves the old failure: tests/test_scan_root_contextvar.py asserts each
thread sees its own root at the race window. under the global both
threads read the last setter's value, and the loser of the restore race
leaked the winner's root. Fails on the global, passes with the fix.

Fixes #4602

(cherry picked from commit 2c51667211)
2026-11-05 12:11:26 +00:00
ayushcodes10 d329bcdfdb Add regression tests for the unclassified share warning
Covers detect() directly: the warning fires once both the absolute
floor and the fraction threshold are crossed, and stays silent just
under either one on its own, a tiny sliver of unsupported files in a
large corpus, or a small corpus where two stray files already look
large by percentage alone. Also covers watch's own rebuild function,
one of the console paths that carries the warning through, and
GRAPH_REPORT.md's Corpus Check section printing or omitting the line
depending on whether detect() set it.

(cherry picked from commit 76d1d49174)
2026-11-05 12:11:24 +00:00
ayushcodes10 918b4b7558 Warn loudly when most of a corpus has no extractor
A file graphify cannot classify, no supported extension or shebang,
was already named in the console output and counted in
GRAPH_REPORT.md, added by an earlier fix. That is the right behavior
for the common case: a stray Dockerfile or license file is routine
and the existing count already covers it.

It reads as equally routine when the share is large instead, a
repository whose real business logic lives in a language graphify
does not parse at all. The graph still looks complete, since nothing
distinguishes "a handful of boilerplate files" from "most of the
codebase" in that same plain count, and a user has no reason to
suspect their graph is structurally incomplete.

detect() now compares the unclassified count against the total files
actually seen and sets a separate warning field once both an
absolute floor and a fraction threshold are crossed, so a tiny repo
with one stray unsupported file never trips it. The three places
that already reported the plain count, graphify extract, graphify
update and watch's rebuild path, and GRAPH_REPORT.md's Corpus Check,
all print this new warning right alongside the count when it fires,
and stay exactly as before when it does not.

(cherry picked from commit b0726d56ca)
2026-11-05 12:11:24 +00:00
Vivek1898 8316033ce0 fix(install): write the pi project skill to .pi/skills, where Pi reads it
graphify install --project --platform pi used the user-scope shape .pi/agent/skills inside the project. Pi only reads project skills from .pi/skills, so the skill never loaded and nothing said why. Give pi the explicit project path the other platforms already have.

Fixes #5011

(cherry picked from commit 8a911d2a9d)
2026-11-05 12:11:23 +00:00
safishamsiandClaude Opus 4.8 2b955d3b68 test: cold-start the stat index before every test (autouse)
#4801 made _rebuild_code's no-change gate read the process-wide stat index, so
across the full suite a warm index left by an earlier test (thousands of roots
hashed in one process) could serve a stale hash and make a rebuild skip
re-extraction - failing watch/reconcile tests nondeterministically depending on
ordering. Add an autouse conftest fixture that resets the stat index to its cold
init state before each test (#3989: cross-root callers in one process must use a
fresh process; a real update/extract always does). Product behavior unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-04 23:09:50 +00:00
safishamsiandClaude Opus 4.8 80b9a4caf4 chore: release 0.9.103 with the extractor, resolution, hooks and perf batch
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-04 20:51:08 +00:00
safishamsiandClaude Opus 4.8 d944c3f074 chore: combined AST cache schema 38 for the C#, Solidity and YAML extractor fixes
#5003 (C# preprocessor blanking), #5005/#5001 (Solidity library + emit/revert/
require linking) and #4995 (YAML << merge precedence) each change per-file
extractor output; fold them into one schema-38 entry so warm caches re-run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-04 20:50:20 +00:00
rohit-jsfreaky b3d967519f fix(solidity): link Lib.f() library calls to the function they name
A dotted call `Lib.f(..)` was parked as a bare member call, which the shared
cross-file pass drops, and Solidity has no member pass of its own, so no
library call got a `calls` edge, not even `Lib.f()` inside Lib itself.

Park `Recv.f(..)` (a plain identifier receiver) as a `qualified` call, the
kind `revert Errors.Err()` already uses, and bind it through the one library
or contract of that name the caller's file declares or imports directly
(named, whole-file or `{A as B}` import), then the member by arity. Fail
closed when the name or (name, arity) is ambiguous; a value receiver
(`token.transfer()`) names no type and gets no edge. Free functions resolve
qualified calls too, `require(c, Lib.Err(..))` binds the error, and
`!Lib.f(x)` (parsed by the grammar as `(!Lib).f`) reads its real receiver.
Node ids are unchanged; AST cache schema 38 -> 39.

OpenZeppelin v5.4.0 vs solc 0.8.28 (unique caller/target pairs): library
0 -> 199 of 232, contract-qualified 0 -> 6 of 6, revert 401 -> 403; other
kinds unchanged. Remaining library misses are same-arity overloads (out of
scope), a call inside a modifier argument, and an existing `_f`/`f` node-id
collision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 28f882c5f5)
2026-11-04 20:49:27 +00:00
rohit-jsfreaky 206169981c fix(solidity): link emit, revert and require to the event or error they name
`emit E(..)` and `revert Err(..)` are statements, not call_expressions, so the
body walk skipped them and no function ever linked to the event or error it
uses. Bind them as calls by (name, arity): in the caller's own contract, through
the linearized bases (an interface's event, a base's error), or as `Lib.Err`
through a type the file declares or imports. Fail closed when ambiguous.
`require(c, Err(..))` is a plain call of the error and now resolves too.
OpenZeppelin v5.4.0 vs solc 0.8.28: revert 0 -> 386 of 403, emit 0 -> 116 of 119;
other call kinds unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 9a1632d4b2)
2026-11-04 20:49:08 +00:00
Pratik Dhanave 8317212754 fix(yaml): give earlier map precedence in a << merge sequence
A `<<: [*a, *b]` sequence merge was resolving keys to the LAST map in the
sequence, but the YAML merge spec (and PyYAML's safe_load / flatten_mapping)
give the EARLIER map precedence. _mapping_pairs fed the sources forward into a
last-write-wins dict, so for a key defined in both anchors the later anchor's
value and line won instead of the earlier one's.

Feed the merge sources in reverse, mirroring PyYAML's flatten_mapping (which
reverses the submerge), so the earliest map keeps the final value/line.

Regression test asserts services.web.common resolves to the first anchor's
mapping (L2), matching yaml.safe_load, not the second anchor's (L5).

(cherry picked from commit 55bff8985f)
2026-11-04 20:49:07 +00:00
rohit-jsfreaky 52a7acb602 fix(extract): blank C# preprocessor directives and #if branches that derail parsing
tree-sitter-c-sharp parses `#if`/`#elif`/`#else`/`#endif` with every branch
in place. Its error recovery around a directive can close the enclosing class
early, so every later member became a class-less node: it lost its `Type.`
owner, its field/receiver typing and same-class resolution, and its calls
were lost or wrong (e.g. `Writer.Flush -> Buffer.Append` was missing).

Before parsing, extract_csharp now blanks every directive line (including
#region, #pragma, #nullable and #define). The first branch of each #if group
is always kept. A later #elif/#else branch is kept as well, so members that
exist only there stay in the graph (#2631). It is blanked only when keeping
it would derail the parse:
- its `{}` or `()` do not net to zero on their own
  (`class A : B {` #else `class A {`), or
- it declares a member (name + arity) that a kept branch of the same group
  already declares (`void Write(Span<char>)` #else `void Write(string)`
  sharing one body).
Nested groups are decided first. The rewrite keeps the byte length the same
(removed bytes become spaces, CR/LF kept), so every remaining byte keeps its
line and column. A `#` line inside a comment or a multi-line string is not
treated as a directive.

Measured against the Roslyn answer key on Newtonsoft.Json, Dapper and
AutoMapper: 5544/7349 links (75.4%, was 70.8%), and 264 wrong `calls` edges
(was 288). No kind loses recall except `ctor` (-4): five `new JValue(...)`
calls inside JValue. Those methods now correctly belong to JValue, and the
graph keeps one edge per node pair, so the JValue -> method edge replaces
the calls edge. Keeping only the first branch scores 5545 but drops #else-only
members.

Bumps the AST cache schema to 38 so cached C# extractions re-run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit e1668ed0c6)
2026-11-04 20:48:49 +00:00