Commit Graph
5611 Commits
Author SHA1 Message Date
Martin Vogel d1986a2e45 fix(semantic): allocate slow-path import-map keys through the memory core
The semantic pass builds a file's import map from its extracted imports
or, when the file extracted none, from the IMPORTS edges another pass drew
for it (the slow path). The slow path copied each key with cbm_strndup,
which is libc strndup, while free_import_map releases every key with
cbm_free. In the product build cbm_free is mi_free, and on macOS the
mimalloc global override is off, so the key was a foreign block.

An Ansible playbook is such a file: it extracts no imports, and the
Ansible pass gives it IMPORTS edges for its roles and includes. On macOS
the index worker crashed in the semantic pass (SIGSEGV in mi_free, or
SIGBUS in mi_usable_size) on every repository of 50 files or fewer
holding a role or an include, for example these two files:

  site.yml    "- hosts: all\n  tasks:\n    - include_tasks: other.yml\n"
  other.yml   "- debug:\n    msg: hi\n"

and on any repository indexed with one worker (kubespray). The same pass
runs for the frozen test-impact index and for changed files on the
incremental route.

The slow-path key is now allocated with cbm_alloc under the semantic
class, like the fast path's cbm_mem_strdup keys.

The test suite never saw the crash: the test build backs the memory core
with the C runtime allocator, where cbm_free is free. The new test
indexes a playbook with a role and an include once, to warm what the
process builds once and keeps (the pretrained token table), then takes
the semantic class's live block and byte counts around a second,
identical full index and an incremental re-index after an edit, and
requires them to end where they started. The memory core counts only the
blocks it hands out, so a key it takes back without having handed it out
leaves the class below its start on every platform, independent of the
allocator, of where the string landed and of what ran before the test.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-18 18:06:51 +01:00
Martin Vogel 08a7a586a4 Merge pull request #2975 from lev-os/fix/514-alias-dotted-basename
fix(514): keep dotted alias imports and non-JS alias imports on their module
2026-11-18 01:19:23 +01:00
Martin Vogel f267c48163 Merge branch 'main' into fix/514-alias-dotted-basename 2026-11-17 23:34:50 +01:00
Martin Vogel 649eb5e9c9 Merge pull request #2360 from htarnacki/fix/scala-package-aware-imports
feat(scala): parse import selectors and resolve package-aware imports (#2153)
2026-11-17 23:34:26 +01:00
Martin Vogel 4a8ae8d9e3 Merge branch 'main' into fix/514-alias-dotted-basename 2026-11-17 22:10:44 +01:00
Martin Vogel 98910f9eda Merge origin/main into fix/scala-package-aware-imports
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-17 22:10:21 +01:00
Martin Vogel abd37003cd Merge pull request #2972 from dannyward630/fix/csharp-local-function-call-attribution-2964
fix(csharp): attribute local function calls to methods
2026-11-17 22:06:57 +01:00
Martin Vogel c58ee04854 Merge pull request #2992 from DeusData/fix/test-subprocess-tree-rss-one-tree
test(subprocess): sample one process tree idle and loaded
2026-11-17 22:06:35 +01:00
Martin Vogel e6980cd60b Merge pull request #2547 from Zhuoxi2000/fix-haskell-escaped-char-swallow
fix(haskell): stop escaped char literals at the closing quote (#2439)
2026-11-17 22:06:27 +01:00
Martin Vogel cdfdf26483 Merge pull request #2989 from DeusData/fix/pkgmap-keep-manifest-candidate-order
fix(pkgmap): keep one manifest's candidates in its parser's order (regression from #2974)
2026-11-14 23:03:40 +01:00
Martin Vogel f854641dcb Merge pull request #2988 from DeusData/fix/ci-slowest-suites-and-cpu-line
ci(test): fix the slowest-suites table on uutils sort; print CPU and SHA support
2026-11-14 14:52:16 +01:00
Martin Vogel 15292e2b25 test(subprocess): sample one process tree idle and loaded
subprocess_tree_rss_measures_contained_descendants compared two
independently spawned process trees, one idle and one whose descendant
touched 128 MiB, and required the loaded total to be at least 96 MiB
above the idle total. Two separate trees need not start from the same
footprint. On the hosted Windows CLANG64 leg they did not: the loaded
tree measured only 78 MiB above the idle one (167 MiB vs 245 MiB), and
the test failed on two unrelated PRs within two days (#2965 on
889170ca, #2975 run 43499140720). The diagnosis that the two separate
trees are the cause comes from #2965.

The test now samples ONE tree twice, and every wait in the handshake is
a blocking pipe read instead of a poll of a ready file:

- The test creates two pipes, "up" (tree to test) and "down" (test to
  tree): FIFOs in its private temporary directory on POSIX, named pipes
  named after that directory's unique leaf on Windows. The
  __cbm_rss_tree_root role connects both as its first action and starts
  one __cbm_rss_tree_hold descendant that inherits the connected ends
  (fork on POSIX, an explicit two-handle inherit list on Windows); the
  root then drops its own copies.
- The descendant writes 'I'; the test takes the idle sample and writes
  'L'; the descendant touches every page of a 192 MiB load and writes
  'R'; the test takes the loaded sample and closes its ends, which
  releases the descendant to free the load and exit.
- A descendant that dies closes its ends, so the waiting read returns
  end-of-file instead of blocking. No handshake step has a sleep, a poll
  interval or a deadline.

The floor stays at 96 MiB and is now half the load: the root does not
grow between the two samples, so a probe that counts only the root
misses the floor by 96 MiB, and a probe that counts the descendant
clears it with 96 MiB to spare. The two member-fault tests use the same
handshake and keep their assertions. Production code is unchanged.

Evidence:
- macOS arm64, ASan: subprocess suite 60 passed, 2 skipped (the
  Windows-only Job Object probes); the rewritten test passed 20 of 20
  consecutive runs, idle 43 MiB and loaded 259 MiB in every run.
- Binding: with the macOS probe temporarily limited to the root process,
  the test fails at the floor assertion (idle 33 MiB, loaded 33 MiB);
  restoring the probe returns the suite to green.
- Linux arm64 container, gcc ASan: subprocess suite 60 passed,
  2 skipped; the rewritten test passed 20 of 20 consecutive runs, idle
  462 MiB and loaded 654 MiB in every run.
- Windows: both changed files compile with -fsyntax-only -Wall -Wextra
  -Werror under llvm-mingw for x86_64 and aarch64.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 14:03:21 +01:00
Martin Vogel bf190e9e14 Merge pull request #2971 from potto007/fix/abandoned-request-cancellation
fix(mcp): stop cache scans on request cancel
2026-11-14 13:19:39 +01:00
Martin Vogel 56a0857f10 Merge pull request #2984 from DeusData/dependabot/github_actions/softprops/action-gh-release-3.0.4
build(deps): Bump softprops/action-gh-release from 3.0.3 to 3.0.4
2026-11-14 13:08:56 +01:00
Martin Vogel a4364704a8 Merge origin/main into fix-haskell-escaped-char-swallow
Brings the branch up to main 1ec2f2623. Conflicts were the grammar
bookkeeping only:

- THIRD_PARTY.md: main's thirteen self-maintained forks (sql, vba added)
  plus haskell make fourteen; the haskell paragraph sits between pascal
  and main's new sql paragraph; main's tree-sitter-vba section is kept.
- MANIFEST.md summary: main's 164 grammars with haskell moved from
  vendored-from-upstream to self-maintained: 138 + 21 + 5 = 164,
  recounted from the tree (164 grammar dirs, 164 parser.c, ABI
  9/78/77). haskell stays only in the self-maintained forks table.
- scripts/vendored-checksums.txt: regenerated with
  scripts/security-vendored.sh --update.

scripts/audit-license-provenance.py merged cleanly: the haskell FORKS
row sits alphabetically between dotenv and javascript, next to main's
sql and vba rows.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 12:54:21 +01:00
Martin Vogel 8ccdcbc9b2 fix(pkgmap): keep one manifest's candidates in its parser's order
cd318253e made the package map independent of worker scheduling by
sorting every candidate of a package name by depth and path before the
first-wins insertion. That also reordered the candidates of ONE manifest:
a pyproject.toml pushes src/<name> first and <name> second, the first had
always won, and after the sort the shallower second one did, for every
Python package. Imports that used to bind their own package then fell to
the same-name fallback: in flask, `from flaskr import create_app` in
examples/tutorial bound the celery example's create_app.

The dispatcher now stamps each entry with the manifest that yielded it and
its position among that manifest's entries, and the merge orders by package
name, the manifest's depth and path, and that position. Different manifests
are still ordered by the repository, not by the run; one manifest's entries
keep the order its parser chose.

ei_pkgmap_one_manifest_keeps_its_candidate_order hands a pyproject.toml and
a sibling's to the merge in both worker orders;
ei_python_example_project_import_binds_its_own_package indexes the flask
shape and checks the import's target file. Both fail without this change.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 11:50:12 +01:00
Martin Vogel 1ec2f2623d Merge pull request #2985 from DeusData/dependabot/github_actions/vmactions/freebsd-vm-1.6.0
build(deps): Bump vmactions/freebsd-vm from 1.5.9 to 1.6.0
2026-11-14 11:13:21 +01:00
Martin Vogel d6d9440fb0 ci(test): fix the slowest-suites table on uutils sort; print CPU and SHA support
The "8 slowest suites" summary in scripts/run-tests-parallel.sh sorted with
`sort -t= -k6 -rn`. uutils sort (Rust coreutils, shipped as sort on newer
runner images) reads the attached form -t= as -t with an inline "=value",
an empty separator, and exits with "separator must be exactly one character
long: ''", leaving the table empty. Pass the separator as its own argument,
which GNU, BSD and uutils sort all parse alike. Informational only: the
script has no set -e and its exit status is unchanged.

scripts/test.sh's environment line now also names the CPU and whether it
has SHA-256 instructions (x86 sha_ni / ARMv8 sha2), the signal
src/foundation/sha256.c uses to choose its hardware or portable backend.
A sanitized runner fingerprints its own large image on that path, so which
CPU a hosted job drew decides how long those fingerprints take. The helper
lives in scripts/env.sh (cpu_summary, opted into via print_env --cpu, so
build.sh, lint.sh and repro.sh print exactly what they did); it reads
/proc/cpuinfo or lscpu on Linux/MSYS2 and sysctl on macOS, reports
"unknown" for anything unreadable, and never fails the caller.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 10:35:55 +01:00
Martin Vogel 58fff72275 Merge origin/main into fix/csharp-local-function-call-attribution-2964
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 10:31:14 +01: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 8c1d141c88 Merge origin/main into fix/abandoned-request-cancellation
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 10:18:46 +01:00
Martin Vogel ea6ad878b7 Merge pull request #2969 from DeusData/feat/vendor-vba-grammar
chore(vendor): vendor the VB6/VBA tree-sitter grammar
2026-11-14 10:17:15 +01:00
Martin Vogel 2172281df3 Merge origin/main into fix/scala-package-aware-imports
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 10:15:49 +01:00
dependabot[bot] 7c98f4a372 build(deps): Bump vmactions/freebsd-vm from 1.5.9 to 1.6.0
Bumps [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) from 1.5.9 to 1.6.0.
- [Release notes](https://github.com/vmactions/freebsd-vm/releases)
- [Commits](https://github.com/vmactions/freebsd-vm/compare/c46abacb49f09938ca4e1702d15d836285d694cc...811efaaac0668df8bfb8308c3ec997b5ab50037b)

---
updated-dependencies:
- dependency-name: vmactions/freebsd-vm
  dependency-version: 1.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-14 05:43:29 +00:00
dependabot[bot] 06d8d7af40 build(deps): Bump softprops/action-gh-release from 3.0.3 to 3.0.4
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 3.0.3 to 3.0.4.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/efb35369e0ad2afab669f228072c1b0d510eae64...8a0cd651e5b2365bd640854a3fa5dfc70e4875f3)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: 3.0.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-14 05:43:25 +00:00
Martin Vogel b62a2ffaf9 Merge pull request #2977 from DeusData/fix/registry-receiver-gate
fix(registry): refuse name-only member calls nothing ties to the receiver
2026-11-14 02:18:32 +01:00
Martin Vogel 9f29545327 Merge origin/main into fix/csharp-local-function-call-attribution-2964
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 02:00:59 +01:00
Martin Vogel 0e086c28a2 fix(csharp): keep top-level and extension-member local functions on their nodes
Calls in a C# local function now attribute to the enclosing function
(#2964). Two local_function_statement shapes are graph nodes of their own
and must keep the scope QN that node carries:

- a top-level local function (top-level statements) is a module-level
  Function node. Returning NULL for it moved its calls to the Module
  node, and a local function nested in it lost its caller as well.
- a C# 14 extension block member parses as a local function in the body
  of a constructor named `extension`, which the def extractor lifts onto
  the type as a method (#2071). Inheriting the nodeless `extension` scope
  moved its calls to the File node.

Both fall through to the shared resolver again, so their QNs match the
def side. cbm_csharp_is_extension_block is exported from extract_defs.c
so the two extractors share one predicate.

Refs #2964

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 02:00:16 +01:00
Martin Vogel 65d4c7be47 Merge pull request #2978 from DeusData/distill/2374-trace-possible-callees
feat(mcp): list possible override callees in trace_path (opt-in)
2026-11-14 01:56:55 +01:00
Martin Vogel d961310805 fix(mcp): stop the not-found project listing on request cancel
A project-name miss runs two cache scans: the internal-name fallback,
which this branch already polls, and the project listing in the
not-found error, which opens every database again until its 4 KiB name
buffer is full. A hook from a directory with no index runs that listing
once per ancestor it probes, so an abandoned request kept opening
databases after the fallback had stopped (#2796).

collect_db_project_names now polls project_scan_should_stop before each
database like the other cache scans, and build_project_list_error takes
the request's server (NULL in verify_project_indexed, which has none in
scope). A cancelled listing answers with the bare reason instead of a
partial list. The name-miss regression test now counts both scans and
asserts that the cancelled reply carries no listing.

Refs #2796

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 01:27:11 +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 334bad2e41 refactor(path-alias): allocate through the memory core
path_alias.c had 40 raw allocator sites outside the memory core. Every
allocation and its free now go through cbm_alloc/cbm_free in one class,
and the two cbm_strndup copies the file freed itself come from a
core-backed helper. cbm_path_alias_resolve keeps strdup, because
pass_pkgmap.c and the tests free its result with free(); the baseline
drops from 40 to 1. No behaviour changes.

The nearest-ancestor test built its collection with calloc/strdup and
freed it through cbm_path_alias_collection_free; it now frees what it
built with the allocator it used.

Checked under the production allocator, where a block freed by the wrong
side crashes: nest (34 tsconfig files with paths) and immich index
identically to before, and a synthetic project with an extending nested
tsconfig stays identical through full, fallback and incremental reindex
steps.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 00:47:41 +01:00
Martin Vogel 6d838982cb test(cli): pin that an archive over the decompression limit is refused
The in-process updater refuses a tar.gz that inflates past 500 MiB, but no
test reached that refusal, and the limit had no seam. A test-only setter,
in the block that already holds the extractor under
CBM_CLI_ENABLE_TEST_API, lowers the limit, so
cli_update_refuses_an_archive_over_the_decompression_limit sees a 1 MiB
archive refused over a 64 KiB limit and accepted under the real one. With
the check removed the test fails on its refusal assertion.

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 0e4d160a4b Merge pull request #2966 from alejo2005001-commits/docs/contributing-stale-test-ref
docs(contributing): replace stale tests/test_httplink.c reference
2026-11-14 00:34:28 +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 4c52fb4e1a Merge origin/main into fix/scala-package-aware-imports
Brings in main up to 09bd6bb1 (#2967 FreeBSD peer pid, #2974 graph
variation and content loss fixes).

Resolutions:
- scripts/memory-core-baseline.txt (textual conflict): both sides
  lowered counts in the same hunk. pass_parallel.c keeps this branch's
  29 (arena QNs); pass_pkgmap.c takes main's 80 (#2974 dropped one raw
  free in cbm_pkgmap_build; this branch's pass_pkgmap.c additions add
  no raw site). Both values re-derived by scanning the merged tree with
  scripts/lint-memory-core.py; the lint passes.
- src/pipeline/pass_pkgmap.c (auto-merged): main's deterministic
  manifest order in cbm_pkgmap_build and this branch's Scala package
  index sit in separate functions; the merged file is main plus this
  branch's change unchanged (same per-file patch-id).
- tests/test_edge_imports.c, tests/test_pipeline.c (auto-merged): both
  sides' new tests are kept and registered; main's new tests call no
  function this branch re-signed. Same per-file patch-id as this
  branch's change.

Every other file equals main.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 00:17:43 +01:00
Martin Vogel d68f491a85 Merge pull request #2970 from DeusData/fix/test-impact-gap-matching
fix(test-impact): a parse gap names only reached functions, variables, macros
2026-11-14 00:15:52 +01:00
Martin Vogelandlorenzozanee 784b13f2ee fix(mcp): scope possible_callees to the page and to dispatching calls
Follow-up to the include_overrides proposal (the previous commit), with
the September review applied:

- possible_callees is computed for the outbound rows the page requests,
  so pages stay exactly-once and the list is bounded by limit;
- implementations are found with one per-node OVERRIDE query
  (cbm_store_find_edges_by_target_type) and followed transitively with a
  visited set, so C.m is listed for a call to A.m when C : B : A; the walk
  stops at 5000 nodes per response and says so (possible_callees_truncated);
- under max_output_tokens the section yields before any other field or
  graph row and the response reports possible_callees_omitted;
- the tree format renders it as a tree table;
- the list lives in CBM_DYN_ARRAYs and a failed lookup marks it
  incomplete instead of failing the trace, so src/mcp/mcp.c keeps its raw
  allocator baseline;
- the tool description keeps "Rows keep qn/hop with explicit totals,
  relations, and continuations.".

Two rules beyond the review. Only callables are contracts or
implementations: OVERRIDE edges now also link tfvars values and kustomize
overlays. And a contract lists implementations only when a traced call
reaches it through an instance receiver: a super()/base call is bound to
the parent and a call on a constructed object or a type runs the declared
method itself (Django: 1,075 super() calls reach overridden methods).

include_overrides joins the cursor identity only when set: without it a
cursor is the token main mints, so the default output stays
byte-identical to main and cursors already handed out stay valid.

Main's topology/deploy/run modes stay in the schema. Eight tests replace
the single combined assert: the shape and the unchanged default, a
two-level hierarchy, include_tests and non-callable filtering, the tree
table, paging, the budget, static calls, and the cursor identity.

Co-authored-by: lorenzozanee <wyz0707@proton.me>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 00:14:27 +01:00
lorenzozanee a540bffb58 fix(mcp): expose possible override targets in trace_path
Signed-off-by: lorenzozanee <wyz0707@proton.me>
2026-11-14 00:14:27 +01:00
Martin Vogel ff1fa7d554 fix(registry): gate only the languages measured above the bar
The receiver gate now runs from an explicit per-language allowlist set by
measurement instead of applying to every language not exempted:

- full gate: Go, C++, C#, Lua, Tcl, Groovy, Elixir;
- suffix_match-only: Scala, Rust, PHP;
- off: everything else (Java, Kotlin, Swift, Ruby, Objective-C, Dart, C,
  Python, the JS/TS family, Perl, and every unmeasured language).

Each language was measured on a pinned corpus with fresh seeds and hand-read
samples of the refused CALLS; a language is gated only where the share of
refused edges that were wrong is at least ~85% (Rust 88% for suffix_match,
80% for unique_name, so suffix-only; PHP 30/30 suffix, 60% unique; Elixir
30/30 and 24/25). Rust removes 4,503 false CALLS on meilisearch, PHP 938 on
koel, Elixir 1,885 on plausible; off languages are byte-identical.

Also new C/C++ evidence: a candidate whose owner type the caller's own module
declares binds (`Widget w(n); w.get_id()`), which fixes the cpp/S3
lsp_resolution_probe case the full C++ gate refused in the previous commit.

registry_receiver_gate_runs_by_measured_language replaces the JVM-only test
and pins full, suffix-only and off languages, including an unmeasured one.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 00:14:04 +01:00
chidev 57205dcf51 fix(514): do not read a spelled module extension twice on an alias import
The alias resolver removes a spelled module extension. The module-name
helper then read the next dotted part as another extension, so
~/tokens.css.ts reached tokens.css and ~/worker.task.mjs.ts reached
worker.task.mjs when both files exist. What is left after the resolver
removed a spelled extension is now the whole file stem.

Refs #514

Signed-off-by: chidev <chicagowebdev@gmail.com>
2026-11-13 14:10:35 -06:00
chidev 31de63afb5 fix(514): keep a question mark in a folder name out of the query cut
An alias import of ~/dir?name/file was cut at the question mark and
reached src/dir.ts. Only a question mark in the file name starts a
bundler query. The dotted-alias test now also checks the Module label.

Refs #514

Signed-off-by: chidev <chicagowebdev@gmail.com>
2026-11-13 12:57:54 -06:00
Martin Vogel 09bd6bb14c Merge pull request #2974 from DeusData/fix/graph-variation-and-content-loss
fix: two causes of run-to-run graph variation and three silent content losses
2026-11-13 19:51:20 +01:00
chidev 2dffaf033f fix(514): keep non-JS alias imports on their module
A path-alias import of a dotted TypeScript file (~/cats/cat.service)
must keep the dotted name, but an alias import of a non-JS file
(~/styles/globals.css, ~/styles.css?url) must still drop its extension,
as it does on main. Keeping every extension sent the CSS imports away
from their module nodes.

The alias branch of cbm_pipeline_resolve_module now decides from the
file path, because filename dots and path separators both become dots
in a qualified name:

- an explicit JS/TS or JSON extension names its module;
- a module at exactly the imported path wins (styles.css, also beside
  styles.css.ts or styles/css.ts);
- else a dotted-name module at that path plus a module extension wins
  (theme.css.ts imported as ~/theme.css);
- else the extension drops, as on main.

A bundler ?query and a #fragment are cut before the extension is read.
The shared alias resolver in path_alias.c is back to main's behaviour,
so doc links keep the file identity they had.

Refs #514

Signed-off-by: chidev <chicagowebdev@gmail.com>
2026-11-13 11:19:44 -06: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 c69cc84974 fix(pipeline): keep surfaces and unresolved-call capture on non-UTF-8 source
yyjson's strict writer refuses a whole document over one byte that is not
UTF-8, and source text can be in any encoding. Two pipeline documents carry
it: the per-file LSP surface and the unresolved-call detail. One such byte
made surface_row_build fail the whole job, so the repository lost every
surface row and each later incremental run declined to a full rebuild
(no_surface_rows). It also latched unresolved-call capture off for the rest
of the run.

Add cbm_json_write_text to foundation/json_writer.h. A valid document is
written exactly as before, so surface shas and details do not change. Only a
refused document is written again with the flags the layout writer already
uses (#2907): each undecodable byte becomes an escaped U+FFFD.

Pinned by pipeline_non_utf8_source_keeps_surfaces_and_unresolved_capture (a
latin-1 byte in a string-named TS method and in a Python __all__ entry) and
json_write_text_keeps_valid_documents_and_repairs_refused_ones.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-13 18:07:13 +01:00
Martin Vogel 71e1659dec fix(graph-buffer): fail edge insertion when the primary array cannot grow
cbm_gbuf_insert_edge ignored a failed cbm_da_push: it registered the edge in
the dedup and secondary indexes and returned a positive id while the primary
array, which the dump and free read, did not hold it. A retry then hit the
dedup entry and appeared to succeed, so the edge was lost and leaked. Compare
the count around the append; on failure free the edge and return 0 before any
index registration.

Pinned by gbuf_edge_append_oom_is_not_success, which fails the edge array's
first growth through a new test-only, one-shot, class-filtered realloc failure
hook (cbm_mem_test_fail_next_realloc, compiled only with CBM_MEM_TEST_API in
the test and TSan flag sets).

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-13 18:07:08 +01:00