Files
codebase-memory-mcp/tests
Martin Vogel 9b5139d73d fix(python): bound the function-local walks at the symbol's own file
A package __init__.py can define a function whose QN equals a submodule's
(poetry: layouts/__init__.py `def layout` is the QN prefix of every symbol in
layouts/layout.py). The prefix walks that recognise a def declared inside a
function body accepted that other file's function as the enclosing def, so
class Layout and its methods read as locals of layout(): they left the
short-name index and the import symbol fallback, and the answer depended on
which file registered first (discovery order on a full index, node-id order on
an incremental one).

Every walk now stops at the symbol's own module:
- registration (pass_definitions.c, pass_parallel.c, and the incremental seed)
  passes the defining file's symbol prefix length,
  cbm_pipeline_fqn_symbol_prefix_len, computed without allocating, to
  cbm_registry_add_lang_in_module; cbm_registry_add_lang keeps its signature and
  does no local detection;
- cbm_registry_resolve_lexical stops at the caller's module QN;
- the import fallback's local test only counts an enclosing def in the same file.

Also moves the #1548 registry tests out of the test they had been inserted into.

Tests: registry_python_local_bound_at_own_file_issue1548 (both registration
orders), fqn_symbol_prefix_len_matches_fqn_compute,
pipeline_python_init_function_shares_submodule_qn{,_parallel}_issue1548 (src/
layout: the import and calls onto Layout survive, then again after an
incremental re-index).

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-18 03:41:31 +02:00
..
2026-10-11 16:57:48 +02:00