Commit Graph
1149 Commits
Author SHA1 Message Date
DavidHLP c96e06f0e2 fix: isolate local validation and guard empty extraction data
Signed-off-by: DavidHLP <lysf15520112973@163.com>
2026-11-15 22:44:34 -08:00
Martin Vogel 08ab4a09fe Merge pull request #2981 from DeusData/perf/linear-growth-sites
fix, perf: C# operator nodes, C increment writes and linear growth in extraction and eight language passes
2026-11-14 10:24:34 +01:00
Martin Vogel 835c806da3 perf(lsp): find imports and registrations by name in eight language passes
The per-language passes scanned the whole type registry per definition
and all of a file's imports per use, and Python copied its import arrays
on every add, so a file's pass grew with the square of its definitions or
imports. Rows are now found by name (lsp_name_rows.h) or through an
opt-in tail index on the registry, and every site falls back to the scan
it replaces when an allocation fails. No cap, budget or early exit is
added, and no lookup may miss what the scan found:
complexity_name_rows_answer_as_a_scan_does and
complexity_registry_tail_answers_as_a_scan_does compare both routes.

Counted work when the input doubles, before and after, per growth test
(all named complexity_*_is_linear or *_are_linear, counted through the
existing lsp_work.h steps):

  Python      import join 4.00x to 2.13x, wide from-import 4.00x to 1.95x
  Go          import uses, registration, generic registration 4.00x to 2.00x
  Java        import uses 3.25x, static imports 3.22x, class registration
              3.65x, short-name fallback 3.76x; now 1.55x to 2.00x
  Kotlin      import uses 3.48x to 2.04x, class registration 3.85x to 2.23x
  TypeScript  import uses 3.98x to 1.80x, class registration 3.78x to
              1.86x, JavaScript registry lookups 3.79x to 1.84x
  Rust        import uses 3.99x to 1.79x, registration 3.16x to 1.84x,
              derive registration 3.46x to 1.81x
  C#          registration 3.34x to 1.46x
  PHP         import uses 3.58x, short-name fallback 3.68x, method returns
              3.68x; now 2.00x

The two PHP method-return loops start at the lowest row of the existing
method iterator. TypeScript's registry is indexed once the file's
definitions are in, keeping first-registered answers.

No graph content changes: flask, django, helm, gitea, two Java subtrees
of elasticsearch, Exposed, nest, tokio, jellyfin and composer index
identically before and after on one worker. phpunit has no comparison:
it does not finish within 1,700 s on one worker with either binary.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 00:47:41 +01:00
Martin Vogel d5ff422922 perf(extract): linear flat labels, usage climbs, spawn checks and Go route bindings
Four extraction sites did work that grew with the square of the file.

Flat labels: NASM instructions and ObjectScript routine statements each
walked back over every earlier sibling for the label above them. A search
now stops at the sibling the previous search under the same parent started
from and takes what that search found, with one memo per ancestor level
for NASM's climb. Which label a statement gets is unchanged.

Usage classifiers: each identifier's binding, write and argument-label
classifiers climbed towards the root, so nesting d levels deep cost d per
identifier. A climb that reaches the root undecided now records the path
it settled, and the next climb stops where it meets it.

Spawn checks: every call's spawn check read all of its file's import
rows, on both call resolvers. The rows are indexed on the first question
between cbm_spawn_file_begin and cbm_spawn_file_end around each file's
call loop. Other rows, an over-long name or a failed allocation read the
rows as before, with the same answer.

Go route bindings: for every route call the receiver's binding was found
by walking back over all earlier statements in the block. A block's
bindings are now read once, sorted by name and source order in the file's
scratch arena; each question is a binary search for the last binding
before the asking statement.

Growth tests, counted work when the input doubles, before and after:
complexity_flat_preceding_label_is_linear 4.00x to 2.00x;
complexity_usage_classifiers_on_deep_nesting_are_linear 3.99x to 2.00x;
complexity_spawn_match_is_linear_in_a_files_imports 4.00x to 2.00x, with
complexity_spawn_file_index_answers_as_the_rows_do comparing both routes
across nine languages; complexity_go_route_bindings_are_near_linear 4.00x
to 2.00x (2.18x for group bindings), with
handles_go_group_binding_forms_*_issue686 pinning the binding forms on
both pipelines. No graph content changes: gitea, helm, flask, nest,
tokio, nccl and jellyfin index identically before and after. Each
remaining sibling or parent step still walks the parent's children
inside tree-sitter; that needs a syntax index.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 00:47:41 +01:00
Martin Vogel c2cbc64a9e fix(extract): give C# operators a node and record C increments as writes
Two extraction defects that lost or misattributed graph content.

C#: operator_declaration was no function kind, so `operator+` had no node
and every call in its body was attributed to the file: the constructor
call inside `operator+` produced `Vec(Module) CALLS Vec2`. The operator is
now a Method named by its token, spelled like C++'s `operator+` and
`operator true`, through the shared name resolver the def side and the
call scope both use. Overloads merge into one node. The matrix case
mkc_c2_csharp_operator_plus counted CALLS >= 2 and passed only through
that misattributed edge; it is now a green guard asserting the Method node
and the operator's own CALLS edge, and mkc_c2_csharp_operator_overloads
pins overloads, `operator -` and `operator true`. The `a + b` operator
site is still no CALLS edge.

C: the assignment node set held only assignment_expression, so `x++`,
`--x` and `c->n++` left no WRITES edge although the write resolver already
handles update_expression. The C set now includes it (GLSL shares the
set). pipeline_c_increment_writes pins WRITES for postfix and prefix forms
on a file-level variable and a struct member, next to a plain-assignment
control.

The C++ set is left alone on purpose: a bare C++ name can be an
implicit-this member, so a local counter's `i++` binds by name to an
unrelated member. On leveldb at least 29 of the 74 edges this would add
are such false bindings; on redis the C change adds 647 edges with at
least 18 of them false, below the rate of the existing assignment rule.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 00:47:41 +01:00
Martin Vogel 0a61c59471 perf(extract): linear struct field fold, C# file namespace and doc root
Three sites did work per definition that grew with the file.

The struct field fold scanned all of a file's definitions for every
struct; it now chains each owner's fields once (lookup probes 4.00x to
2.00x when the file doubles).

Every top-level C# class walked the compilation unit's children by index
to find a file-scoped namespace, and each index call steps over the
children before it; the namespace is now found once per file with a
cursor (sibling steps 7.99x to 2.00x).

The doc memo never refreshed an entry found as an ancestor, so a wide
root was evicted by its children's narrow lists and listed again every
few definitions; use now keeps it cached (3.99x to 2.00x).

The growth tests complexity_struct_field_fold_is_linear,
complexity_csharp_namespace_lookup_is_linear and
complexity_doc_lookup_keeps_a_wide_root_cached count work through new
seam-only counters (resolve_stats.h), never time; product builds compile
the counters out. No graph content changes: flask, helm, nccl and
jellyfin index identically before and after.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 00:47:41 +01:00
Martin Vogel eb44c04d4e Merge origin/main into feat/vendor-vba-grammar
Brings in #2974 (incl. the jsonnet scanner patch) and #2970. One conflict:
scripts/vendored-checksums.txt, where #2974 and the vba vendoring both
rewrite the MANIFEST.md line. Resolved by taking main's file and
regenerating it with scripts/security-vendored.sh --update; against main it
differs only in the MANIFEST.md line and the five vba lines, and the
integrity verify passes.

THIRD_PARTY.md, MANIFEST.md and tests/test_parse_coverage.c merged cleanly;
each equals main plus this branch's own change (identical patch-ids), and
test_parse_coverage.c has 76 TEST and 76 RUN_TEST entries (71 at the merge
base, +2 from main, +3 from this branch). The MANIFEST summary (164
grammars) and ABI line (9/78/77) match a recount from the tree.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 00:31:52 +01:00
Martin Vogel f649a27c7d fix(cs-lsp): collect using directives past 256 pending walk entries
The using-directive walk kept its pending nodes in a fixed 256-entry
stack and silently skipped every child it had no room for. Children are
pushed in source order, so a wide file lost its last subtrees: with 300
namespace blocks before it, the namespace holding `using static
System.Math;` was never walked and its unqualified `Sqrt` call bound to
nothing. The stack now starts inline and doubles on the file's arena.

Pinned by cslsp_using_after_many_namespace_blocks, which asserts the
C.X -> Math.Sqrt call behind 300 namespace blocks.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-13 18:07:17 +01:00
Martin Vogel e5b3972429 fix(grammar): give the jsonnet scanner per-parser state
Indexing go/grafana__loki produced a different graph from one run to the
next: each index reported one or two jsonnet files as parse_partial, a
different set every time, and indexing only its 68 jsonnet files reported
21-37 of them, with real definitions and their CALLS/DEFINES/IMPORTS/USAGE
edges missing. Parsed one at a time, every one of those files is clean,
and CBM_WORKERS=1 gave the same graph on every run.

The vendored jsonnet external scanner kept its state (inside a string,
and which quote) in three file-scope globals, so every indexing worker's
parser shared one copy. tree-sitter restores the scanner state right
before each scan and saves it right after; another thread's write in that
window changed the scan in flight, and a quoted string ran past its
closing quote. Its deserialize also ignored the zero-length call that
starts a parse, so a file ending inside an unterminated quote left that
state to every later parse in the process, and no later ||| text block
could be lexed.

The state now lives in the payload from ..._external_scanner_create(),
and deserialize resets it before reading. Lexing logic and the 3-byte
serialized state are unchanged. MANIFEST.md records the local patch next
to the properties scanner's, THIRD_PARTY.md notes it must be re-applied
on re-vendor, and scripts/vendored-checksums.txt is repinned.

Two single-threaded tests in parse_coverage pin it: a second parser run
from inside parser A's input callback, at the byte after A's opening
quote, must not break A's string; and a parse that ends inside a string
must not stop the next one from lexing a ||| block. Both fail on the
unpatched scanner. With the patch, 30 indexes of the 68 files and 5 of
the whole repo each give one result, with no jsonnet file partial.

lint-vendored-scanners (now part of lint-ci) rejects mutable file-scope
state in vendored scanners and the headers next to them. properties and
jsonnet both had it; haskell's and purescript's read-only cases are
whitelisted with their reasons.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-13 18:07:03 +01:00
Martin Vogel 56f4b91ff6 Merge origin/main into feat/vendor-vba-grammar
Brings in #2957 (sql became a self-maintained fork), #2959 and #2962.
Both sides added a self-maintained grammar fork, so every conflict keeps
both additions:

- MANIFEST.md summary: 164 grammars = 139 vendored-from-upstream + 20
  self-maintained (sql moved over on main, vba added here) + 5
  registry-disagreement; the ABI tally stays 9/78/77 (sql stayed ABI 15).
  The notes and the forks table carry both the sql and the vba rows.
- THIRD_PARTY.md: thirteen further self-maintained forks including sql and
  vba; main's sql paragraph, then this branch's tree-sitter-vba section.
- tests/test_parse_coverage.c: both test blocks and both sets of
  RUN_TEST registrations.
- scripts/vendored-checksums.txt: regenerated with
  security-vendored.sh --update; against main only the MANIFEST.md line
  and the five vba files differ.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-12 23:18:44 +01:00
Martin Vogel c3c56c6ddb chore(vendor): vendor the VB6/VBA tree-sitter grammar
Vendors harumiWeb/tree-sitter-vba (MIT, (c) 2026 harumiWeb) at
83c5c3c3c721 (tag v0.14.5, upstream HEAD), its vba dialect, as a
self-maintained fork in tools/tree-sitter-vba/. This is the precondition
for VB6/VBA extraction (#2564, ported after #1179); it registers no
language yet.

Why generated here: upstream does not track its generated parser (its
ADR 0002), so the fork carries upstream's grammar source in upstream's
layout with no local patch, and parser.c is generated in this repository
with tree-sitter-cli 0.25.10 (ABI 15), the generator every fork here
uses. Upstream's own copy is generated by 0.26.9.

Why this pin: v0.13.0 (the pin #2564 carried) exposes the same procedures
but misreads statements without an ERROR node. On the three corpora
below it yields 1,276 expression_statement nodes where v0.14.5 yields 56
(`Err.Raise a, b, c` after a label loses its callee), and it leaves an
ERROR at `Case obj Is Nothing`.

Why the vba dialect rather than upstream's vb6 one: measured with the
CLI on kellyethridge/VBCorLib @ 100acbbae0c0 (655 VB6 files),
Kr00l/VBCCR @ 4b86c5c2c075 (161 VB6 files, 70 .ctl) and upstream's 481
VBA examples, procedures outside ERROR nodes are 14,084/14,084,
12,385/1,552 and 8,104/6,573 (vba/vb6). vb6 rejects the PtrSafe/LongPtr
forms dual-target VB6 keeps inside #If VBA7 blocks and then loses whole
files; vba never sees fewer procedures in any file. vb6's parser.c is
also 75.8 MB against 48.3 MB.

Provenance by hash: common/define-grammar.js is upstream's blob
5e1f7d758ce1; vba/grammar.js minus its 40-line provenance header is
upstream's blob 9247dbbfe166. Two independent generations are
byte-identical, and identical to a generation from upstream's own layout
and tree-sitter.json. The generated node-types.json is upstream's
checked-in file byte-identical (500e635610), and the parse-table counts
equal upstream's own generated parser. Review: 0 non-ASCII bytes, 0
unmatched characters on full tokenization, one comment (the generator
stamp), no string literal with a space, no external scanner, no call
outside the tree-sitter macros. No upstream script, package hook or
binary was run or vendored.

- internal/cbm/vendored/grammars/vba/: the generated parser.c, the
  tree_sitter/ headers (byte-identical to copies already vendored) and
  upstream's MIT LICENSE byte-identical.
- internal/cbm/grammar_vba.c: compiles and links tree_sitter_vba. No
  CBMLanguage, extension or alias routes to it yet; extraction adds them
  under the vb6/vba names (vb and visualbasic mean VB.NET).
- MANIFEST.md (fork note with the measurements and known gaps, forks
  table, 164 grammars, ABI recount), THIRD_PARTY.md (fork list and a vba
  section), scripts/vendored-checksums.txt, and the FORKS entry in
  scripts/audit-license-provenance.py.
- README.md and the Chocolatey nuspec say 164 languages: the
  language-count contract defines the count as the vendored grammar
  directories.
- tests/test_parse_coverage.c: a dual-target VB6 class module (IDE class
  header, Declare in both #If VBA7 branches, Property Get/Let/Set,
  Implements, events, a label, bare calls) parses with no ERROR node and
  every bare call keeps its callee; a CRLF VB6 form parses clean; broken
  source is still flagged. The class case fails on v0.13.0 and on the vb6
  dialect.

Refs #721, #2564

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-12 21:35:36 +01:00
Martin VogelandKerf d9b22e0b7f fix(grammar): stop flagging valid SQLite migrations as partially parsed
Valid SQLite migration files were reported parse_partial because the
vendored SQL grammar (DerekStride/tree-sitter-sql @ 851e9cb257ba) rejects
SQLite syntax they use: PRAGMA, AUTOINCREMENT, a trigger's BEGIN ... END
body, a column named `key` after the first column, WITHOUT ROWID, an
unparenthesized trigger WHEN, INSERT OR IGNORE, and CREATE VIRTUAL TABLE
... USING fts5(...). Each became an ERROR node; the trigger's error region
in atuin's ai_session schema also swallowed the CREATE TABLE after it.

The `key` case is lexical: after a comma inside a column list the grammar
also accepts MySQL's `KEY name (cols)` index, so `key` lexes as that
keyword there and `key TEXT NOT NULL` became a malformed index.

Fix: sql becomes a self-maintained fork of the pin we already vendored,
following the pascal model. tools/tree-sitter-sql/ holds upstream's
grammar.js + grammar/ (blob-identical to the pin and to upstream main @
3c99273f9b32, where its corpus lives) and one patch,
patches/sqlite-dialect.patch, touching grammar/ only:
- PRAGMA [schema.]name [= value | (value)] (new pragma_statement)
- AUTOINCREMENT as keyword_auto_increment, upstream's own change
  (c042cde1e2a6, 2026-11-08, after our pin)
- `key` accepted as a column name; the type keywords that take no
  arguments are accepted as a MySQL index name so `KEY name (name)` stays
  an index
- WITHOUT ROWID
- a trigger body as the existing block node, after an optional
  unparenthesized WHEN (precedence keeps Postgres `WHEN (...) EXECUTE
  FUNCTION` trees unchanged)
- INSERT OR {ABORT | FAIL | IGNORE | REPLACE | ROLLBACK}
- CREATE VIRTUAL TABLE [IF NOT EXISTS] name USING module(args), aliased
  to create_table (new module_argument node), so the table is extracted
  as a Table like any other
Upstream node types keep their shape: upstream's 511 corpus cases pass
unchanged; test/corpus/sqlite.txt adds 11 (9 fail on the unpatched
grammar, 2 controls pass on both). The vendored scanner.c is kept as is
(it carries our start_tag leak fix 0e61867d9, now listed under the
MANIFEST's "Local source patches"; upstream fixed the same leak after our
pin in ee2f84f9b857).

Provenance: without the patch, tree-sitter-cli 0.25.10 regenerates
upstream's shipped parser.c byte-for-byte except line 1 (upstream's
generator stamp has no version), and grammar.json, node-types.json and
tree_sitter/*.h byte-identical. Patched: three generations are
byte-identical (parser.c SHA-256 3c64e5c4...7887); ABI 15; states 30,622
-> 31,081, symbols 770 -> 782; 0 non-ASCII bytes, no string literal with
a space, one comment, the same call-position identifiers as before. Node
types only gain entries (pragma_statement, module_argument, four
keywords; create_table gains a `module` field).

Proof, indexed from scratch with isolated caches (main 6d34ca15 vs this
change): dani-garcia/vaultwarden @ 58a980f8 migrations/sqlite (116
files) parse_partial 3 -> 0, graph identical (303 nodes, 446 edges);
atuinsh/atuin @ 2535161e *.sql (69 files) 19 -> 7: all 12 valid SQLite
files clean; the 7 left are the invalid `ALTER TABLE ... DROP INDEX`
down migration and the 2 MySQL + 4 Postgres files, same ranges as
before; graph +2 Table nodes (the fts5 table and the table the trigger
error swallowed), +2 DEFINES, +3 USAGE lineage edges. No newly flagged
file. Control: helm @ 9b88efd6 indexes to an identical graph (12,251
nodes, 39,561 edges).

Registered like pascal: MANIFEST.md fork rows + notes (ABI tally
recounted, unchanged), the audit FORKS map, THIRD_PARTY.md, vendored
checksums. LICENSE stays upstream's MIT byte-identical.

Tests: parse_coverage carries the two SQLite tests from #2246 as written
(sqlite_valid_migration_not_flagged, red before this change, and the
sqlite_malformed_still_flagged control) and adds `key` columns, WITHOUT
ROWID, a WHEN trigger with INSERT OR IGNORE plus an fts5 table (asserted
as a Table), PRAGMA forms, and two controls: MySQL's KEY index still
clean, and ALTER TABLE ... DROP INDEX still flagged.

Distilled from #2246.

Co-authored-by: Kerf <kerfern@hotmail.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-11 19:44:47 +01:00
Martin Vogel 6d34ca15bd Merge pull request #2948 from DeusData/feat/vendor-vbnet-grammar
chore(vendor): vendor the VB.NET tree-sitter grammar
2026-11-11 00:26:43 +01:00
Martin Vogel 35fd45702d Merge branch 'main' into fix/swift-in-scope-binding 2026-11-10 22:43:54 +01:00
Martin Vogel a8222606b2 fix(grammar): stop the VB.NET XML-literal scan at attribute lines
The vendored vbnet scanner lexes a whole VB XML literal as one external
token, and the parser offers it a '<' wherever a declaration or member
starts. There, in valid VB, '<' opens an attribute block
(`<Serializable()> _`), never an XML literal. The scanner nevertheless
took `<Serializable` for an element start and read the rest of the file
looking for a closing tag before giving up: O(rest of file) per
attribute, O(n^2) per file. Generated proxies and designer code put an
attribute on every member: 2,500 attributes in a 77 KB file advanced
38.5 M characters, and a 1.35 MB synthetic file took 21 s to parse.

The scan now fails at the first character well-formed XML cannot
contain: inside a tag, outside a quoted value, anything other than name
characters, blanks, '=', quotes, '/>', '>' and '<%='; in element text, a
'<' that starts no tag, closing tag, comment, PI or embedded expression,
and an '&' that starts no reference. No valid XML literal lexes
differently: parse trees are byte-identical before and after on all 25
sample and synthetic files tried, XML literals of every shape included.
The 1.35 MB file now parses in 0.08 s.

Residual, recorded in MANIFEST.md: an attribute without an argument list
(`<Fact>`) is a well-formed start tag, so its scan still runs until a
character that cannot be XML, or the end of the file.

The change is kept as tools/tree-sitter-vbnet/patches/
xml-literal-tag-syntax.patch (CodeGraph's scanner 8334fdb -> b3473d1)
and in MANIFEST.md's local-patch table. The new
complexity_vbnet_attribute_lexing_is_linear counts the bytes the lexer
pulls through a chunked TSInput for k and 2k attribute-decorated
classes: ratio 3.99 before the fix, 2.0 after.

Refs #1178, #1179

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-10 21:37:56 +01:00
Martin Vogel 970dd5656a chore(vendor): vendor the VB.NET tree-sitter grammar
Vendors govindbanura/tree-sitter-vbnet (MIT, (c) 2025 Govind Banura) at
538b7087bf80 (tag v0.1-beta, upstream HEAD) with CodeGraph's real-world
VB.NET patch (colbymchenry/codegraph docs/grammars/tree-sitter-vbnet.patch
at fe7542b6f6a4, MIT, (c) 2026 Colby Mchenry), as a self-maintained fork
in tools/tree-sitter-vbnet/. This is the precondition for VB.NET
extraction (#1179, folding in #2885); it registers no language yet.

Why this grammar: it is the licensed one. CodeAnt-AI/tree-sitter-vb-dotnet,
which #1179 was built on, carries no license and cannot be vendored.

Why the patch: upstream checks in grammar.js only and does not parse the
code VB.NET projects are made of. Unpatched, the Single literals in every
WinForms .Designer.vb (New SizeF(6.0!, 13.0!)) and body-less MustOverride
members are ERROR nodes. The 2026-10-06 revision of the patch is pinned
because it also keeps names that begin with a keyword whole: the earlier
revision (the one #2885 carried) turns `Sub NewItem()` into an ERROR and
`Public SharedCache As Integer` into a Shared field named Cache.

Provenance by hash: the patch file is byte-identical to CodeGraph's (blob
37918d81); upstream grammar.js at the pin is the patch's pre-image
(21c8523), and tools/tree-sitter-vbnet/grammar.js minus its 41-line
provenance header is the post-image (c9c1d85), as is scanner.c (8334fdb).
parser.c is generated here with tree-sitter-cli 0.25.10 (ABI 15); two
independent generations are byte-identical. No upstream script, package
hook or binary was run or vendored.

- internal/cbm/vendored/grammars/vbnet/: the generated parser.c,
  CodeGraph's external scanner.c (two stateless tokens), the tree_sitter/
  headers, upstream's MIT LICENSE byte-identical, and CodeGraph's MIT text
  as LICENSE-codegraph: the scanner and the patched rules are CodeGraph's
  work, so its notice has to ship with the binary too.
- internal/cbm/grammar_vbnet.c: compiles and links tree_sitter_vbnet. No
  CBMLanguage, extension or alias routes to it yet; extraction adds them,
  with `vb` and `visualbasic` meaning VB.NET (VB6 keeps its own name).
- MANIFEST.md (fork note, forks table, 163 grammars, ABI recount),
  THIRD_PARTY.md (fork list and a vbnet section; the stale "160
  pre-generated parsers" now reads 163), scripts/vendored-checksums.txt,
  and the FORKS entry in scripts/audit-license-provenance.py.
- README.md and the Chocolatey nuspec say 163 languages: the
  language-count contract defines the count as the vendored grammar
  directories.
- tests/test_parse_coverage.c: real VB.NET (a WinForms Designer partial
  class, Handles, Inherits/Implements, MustOverride, #Region, Property,
  keyword-prefixed names) parses with no ERROR node. The case fails on
  unpatched upstream (8 ERROR nodes) and on the earlier patch revision (1).

Refs #1178, #1179, #2885

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-10 21:20:25 +01:00
Martin Vogel 9f5923cf96 Merge origin/main into fix/registry-resolution
Brings the branch up to main (0d835c55). Two conflicts, both the
`drop_plain_call` expression in pass_calls.c and pass_parallel.c: main
appended the external-import-shadow and PHP receiver clauses where this
branch appended the #1128 same-module bound-receiver clause. Resolved as
main's clauses followed by `||` and the #1128 clause; clang-format then
wraps main's PHP line, which the added `||` pushed past the column limit.
No other change.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-10 20:02:42 +01:00
Martin Vogel 34c64bf8a1 feat(extract): record JS/TS receiver binding facts for imports and AMD
The same-module guard for #1128 needs to know, from the caller's own
source, whether a member call's receiver is bound to another module.
Two facts were missing:

- A JS/TS import statement that binds no local name (side-effect
  `import './x'`, a re-export, a bare or destructured `require('x')`,
  `require('x').y`) still records the path's last segment as its
  local_name, so `require('node:stream').Readable` made every `stream`
  parameter look import-bound. CBMImport.local_name_synthesized marks
  those stand-ins. A lazy `x = require('x')` and
  `const x = require('x').member` do bind that very name and stay
  unmarked. local_name itself is unchanged, so IMPORTS edges and the
  import map are untouched.
- AMD `define([...], function (dep) {...})` / `require([...], fn)` bind
  each factory parameter to the dependency at the same position. That
  binding is local to the factory and is not an import (no IMPORTS
  edge), so the unified walk carries it like the Python parameter
  bindings: the loader call notes its factory, the factory's frame binds
  the dependency parameters, the frame's pop unwinds them. The
  CommonJS-wrapper pseudo dependencies (`exports`, `module`, `require`)
  stay unbound. O(1) per node, no ancestor walk. The JS member-call
  branch reads it into CBMCall.receiver_is_amd_dependency.

Nothing reads either fact yet; the graph is unchanged by this commit.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-10 20:01:40 +01:00
Martin Vogel a9ae13e40a fix(swift): read the binding that is in scope at the call
A receiver's type came from every same-name binding of the enclosing
function, wherever in the function it was declared. When an inner
binding's type could not be inferred, the receiver counted as unknown
even where only an outer, declared binding was in scope, and the call
took the label match. In

    let semaphore: DispatchSemaphore = DispatchSemaphore(value: 0)
    if flag {
        let semaphore = identity(DispatchSemaphore(value: 0))
        semaphore.signal()
    }
    semaphore.wait()

the outer wait() got an edge to an unrelated project wait() (#2436).

Each Swift binding now records where it is in scope: from the end of
its declaration to the end of its block, where a parameter's block is
its function. Only the bindings in scope at the call count, and of
those the innermost block's, so a local shadows a same-name local of an
enclosing block or a parameter. `var request = try request.make()`
reads the parameter on its right-hand side and the new variable after
it. Bindings of the same block that disagree still select nothing, and
fields and module-level bindings are unchanged.

pipeline_swift_in_scope_binding_issue2436 (sequential and parallel)
covers the example, the shadowed-parameter idiom of Alamofire's
encoders and two sibling blocks; it fails without the change.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-10 19:32:03 +01:00
DavidHLP cdb7a293b0 fix(pipeline): exclude project identity from service patterns
Signed-off-by: DavidHLP <lysf15520112973@163.com>
2026-11-09 20:55:52 -08:00
DavidHLP f25f8b3dcd Merge branch 'main' into feat/issue-2061-swift-identity 2026-11-09 20:39:18 -06:00
Martin Vogel 0df1074162 Merge origin/main into fix/rust-grouped-imports-2922
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-09 23:21:40 +01:00
Martin Vogel 7ca9ea42f8 Merge origin/main into feat/issue-2061-swift-identity
Brings the branch up to date with main (e2a93e4ca): #2205 (daemon UI
setting on manual start), #2905 (Retrofit client HTTP_CALLS) and two
GitHub Actions version bumps. No conflicts.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-09 21:06:03 +01:00
Martin Vogel 102c56452a fix(swift): keep the label match for a constructor-typed receiver
A receiver typed only by its constructor call (`let x = Foo()`, also
through `try` / `await`) now narrows the label match the way a receiver
with an inferred initializer type already does: a member the type has
still wins, and when the type has no member with the call's name and
labels, the call keeps the label match instead of getting no edge. One
such site is Alamofire's Session.swift:1389, where `mutableState` is a
`Protected(...)` whose members the parser leaves as free functions.

This applies only to a type the project declares. A constructor of a
type the project does not know (DispatchSemaphore(), Task {...}) or only
extends (Data()) still gets no edge: on swift-nio and Alamofire a label
match for those receivers mostly lands on unrelated project methods,
for example `semaphore.wait()` on EventLoopFuture.wait. A name the
extractor reads as a constructor but that resolves to a project function
(`Foo.make()`) keeps the label match like an inferred call result.

Annotations and parameters still decide alone, and inferring an
initializer's type still never uses a label match. The extractor marks a
binding as `constructed` when its type comes from the initializer's
constructor call rather than from an annotation.

On swift-nio eabcc14f and Alamofire bda9ed57 this adds 947 and 166 call
edges and removes none. pipeline_swift_constructor_receiver_keeps_label_match_issue2061
(sequential and parallel) pins the fallback, a member that still wins,
and the annotated, parameter, unknown-type and extended-type cases.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-09 21:05:41 +01:00
kasheeesh08 7648e78b61 fix(rust): expand grouped use imports
Signed-off-by: kasheeesh08 <kashishhome123@gmail.com>
2026-11-07 22:50:19 +05:30
Martin Vogel aeeb2712d6 Merge origin/main into feat/issue-2061-swift-identity
Brings the branch up to date with main (612eee251). Two textual
conflicts, both where main added its Java external-call guard (#2667)
next to this branch's Swift candidate guard:

- src/pipeline/pass_calls.c: the registry lookup still runs only when
  the Swift candidates allow it, and now passes java_external.
- src/pipeline/pass_parallel.c: the registry fallback condition keeps
  both !java_external and count == 0.

No other file conflicted.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-05 01:49:25 +01:00
Martin Vogel 15906eb1f3 fix(swift): keep the first parse when masking directives reads less
The conditional-compilation retry always kept the masked re-parse. When
the dropped branch holds an `#error(...)` line inside a type body the
re-parse reads less of the file: Alamofire Protected.swift went from 3
to 14 unreadable lines and lost its Protected initializer.

The re-parse is now kept only when its error regions cover no more lines
than those of the first parse. Counting regions instead would reject
re-parses that split one large region into a few small ones; on
swift-nio that gave back 1,312 of the recovered lines.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-05 01:48:26 +01:00
Martin Vogel 8087c1c554 fix(swift): read a constructor type through try and await
`let socket = try ServerSocket(...)` and `let reader = try await
Reader(...)` left the variable untyped, so every member call on it went
to a label-only guess or was dropped. The initializer is now unwrapped
from `try` / `await` before its constructor type is read. Only a bare
type name counts there: `try Foo.make()` returns what make returns,
which the registry still infers from the call.

With the type in place the existing base-class and extension walk
applies: on swift-nio socket.close(), socket.bind(to:) and
socket.getLocalVsockAddress() in VsockAddressTest.swift resolve to
ServerSocket, BaseSocket and the BaseSocket extension in VsockAddress.swift.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-05 01:48:26 +01:00
Martin Vogel 49d6b46f52 Merge origin/main into fix/2723-retrofit-client-http-calls
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-05 00:24:44 +01:00
DavidHLP 1a6b2923c9 fix(swift): retain Sendable alias parameters in selectors
Signed-off-by: DavidHLP <lysf15520112973@163.com>
2026-11-04 06:29:56 -08:00
DavidHLP 6eddf54a13 fix(swift): resolve chains within SwiftPM target scope
Keep extension owners within visible targets and respect literal custom
SwiftPM roots, nested package boundaries and manifest invalidation.
Continue compatible call chains through declared return types and bounded
initializer inference. Recover conditional declaration ownership and
wrapped trailing closures, and preserve serial argument keywords.

Add extraction, registry and serial/parallel/incremental regressions.

Signed-off-by: DavidHLP <lysf15520112973@163.com>
2026-11-04 21:36:00 +08:00
Divakant Pandey ea533e0278 Merge branch 'main' of https://github.com/DeusData/codebase-memory-mcp into fix/2723-retrofit-client-http-calls
Signed-off-by: Divakant Pandey <divakant01@gmail.com>
2026-11-04 13:42:09 +05:30
Divakant Pandey c8c4b6c7db fix(extract): read Retrofit verbs only on interface methods (#2723)
Pippo and Rapidoid put the path in @GET("/x") on a controller class, and
those methods serve the route. Retrofit services must be interfaces, so
limit the client reading to Java and Kotlin interfaces.

Signed-off-by: Divakant Pandey <divakant01@gmail.com>
2026-11-04 13:41:55 +05:30
DavidHLP 38df8e5a69 fix(swift): scope extension owners by module
Signed-off-by: DavidHLP <lysf15520112973@163.com>
2026-11-04 15:02:29 +08:00
DavidHLP 05c7ba7515 Merge upstream main into Swift declaration identity
Signed-off-by: DavidHLP <lysf15520112973@163.com>
2026-11-03 18:14:27 -08:00
DavidHLP d33c6ac0ea fix(swift): resolve members declared in cross-file extensions
Include matching extension owners in typed Swift method and initializer lookup. Preserve owner metadata for incremental indexing and cover three-file resolution in sequential, parallel, and incremental runs.

Refs DeusData#2061

Signed-off-by: DavidHLP <lysf15520112973@163.com>
2026-11-03 18:07:40 -08:00
Martin Vogel d7d2e23c88 Merge origin/main into java-external-gate
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-04 00:05:36 +01:00
Martin Vogel 97f8da2cb7 Merge origin/main into java-external-gate
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-03 18:09:34 +01:00
Martin Vogel dedd429215 Merge origin/main into fix/swift-init-extraction
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-03 18:09:19 +01:00
Divakant Pandey a031122a4d fix(extract): emit HTTP_CALLS for Retrofit interface methods (#2723)
Retrofit's @GET/@POST/... share their names with the JAX-RS verbs, so
every annotated client method became a served Route with a HANDLES edge,
and any path without a leading slash collapsed onto "/". JAX-RS verbs are
marker annotations; a verb that carries an argument is a Retrofit request.
Record its path as client_route_path and emit HTTP_CALLS to the Route
instead. Relative paths are rooted, full URLs kept; constants, templates
and concatenations have no static value and produce no edge.

Signed-off-by: Divakant Pandey <divakant01@gmail.com>
2026-11-03 16:36:43 +05:30
Martin Vogel b8c5ec77c5 Merge origin/main into java-external-gate
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-03 03:46:43 +01:00
Martin Vogel 08b84e4011 Merge origin/main into fix/php-inline-html-2000
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-03 01:40:29 +01:00
Martin Vogel 8ae04f4bd1 Merge pull request #2424 from mvanhorn/fix/1642-python-constructor-calls-init
fix(python): resolve ClassName() calls to __init__
2026-11-03 01:17:11 +01:00
Martin Vogel 6d5cb97b6f Merge origin/main into fix/swift-init-extraction
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 22:00:45 +01:00
Martin Vogel e87a9ff47e Merge origin/main into fix/1642-python-constructor-calls-init
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 18:51:12 +01:00
Martin Vogel 94b36e82df Merge origin/main into java-external-gate
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 18:25:02 +01:00
Martin Vogel a508219299 Merge origin/main into feat/ruby-lsp-per-file
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 18:09:59 +01:00
Martin Vogel ff74ab0982 Merge origin/main into fix/php-inline-html-2000
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 18:09:51 +01:00
Martin Vogel 5808426aca Merge origin/main into java-external-gate
Brings the branch up to main (a5b248f4); it was 670 commits behind.

One conflict, in src/pipeline/pass_calls.c: main (d4273ae9) moved the
LSP-target lookup of resolve_single_call into calls_emit_lsp_target and
the registry fallback into calls_registry_resolution. The Java gate of
this branch now lives in those helpers, unchanged in effect:

- resolve_single_call computes java_external once, as before, and passes
  it to both helpers;
- calls_emit_lsp_target looks a Java lsp_external callee up strictly by
  QN with no tail match, as the branch did inline;
- calls_registry_resolution skips the name guess for such a call, next
  to the Rust and PHP vendor skips.

pass_parallel.c, pass_lsp_cross.c, lsp_resolve.h, Makefile.cbm and the
test registrations merged without conflicts.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 02:39:51 +01:00
Martin Vogel b2edaef43c Merge origin/main into fix/swift-init-extraction
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 02:38:00 +01:00