You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b3baebb
Browse filesBrowse the repository at this point in the historyBrowse files
fix(elixir): record the qualifier a reference was written under
Elixir writes every qualified reference as a `dot` node: `Keyword.get` is
dot(alias "Keyword", identifier "get"). The usage extractor kept only the
identifier half. The qualifier was destroyed before resolution ever saw it, so
the usage arrived at the registry as the bare name "get", receiver_chain_admits
returned true at its bare-name early return, and every receiver-chain
protection was bypassed by construction.
That is how an unrelated local `get/1` became the target of a `Keyword.get`
reference, and how adding one unrelated file could re-point an already-resolved
edge: with one candidate the bare name resolved by unique_name, and a second
same-named candidate anywhere in the tree flipped the strategy to proximity
scoring, which picks by path distance. is_member_access already recorded that a
selector was there; it never recorded what it named.
CBMUsage gains `receiver`, NULL when the reference is unqualified. The pipeline
composes "<receiver>.<ref_name>" before resolving, and the edge property still
reports ref_name, so nothing downstream sees a renamed reference.
Scoped to Elixir on purpose. A receiver fed to the registry changes which
candidate a usage binds to, and selector shape is a per-grammar claim.
result_compact.c relocates the new string with the rest. Every arena-owned
string a CBMUsage points at has to be relocated: the pipeline composes a
qualified name from `receiver` before resolving, so a stale pointer corrupts
silently. It resolves a reference built from whatever bytes the old arena's
memory now holds, and the result is a valid-looking USAGE edge onto an
arbitrary same-suffixed function, different on every run of the same input.
Measured by building a product binary from the incremental re-link commit and one from this
commit,
indexing the same 970-file Elixir lib tree with each into its own sandbox
(`cli index_repository --mode full`), and diffing the `edges` rows out of the
two SQLite stores. A USAGE site is keyed by (source qualified_name, callee),
which is stable across both builds:
USAGE edges 31,844 -> 25,664
USAGE sites present before and gone after 6,245
USAGE sites present after and not before 0
surviving sites whose target changed 1,025
Nothing new appears, 6,245 bindings that the bare name alone justified are
withdrawn, and 1,025 of the survivors move to a different target. A qualified
reference that named a module the project does not define now resolves to
nothing instead of to a same-named local function.
The incremental re-link commit's product binary is byte-identical to the
resolution commit's on this toolchain, so the "before" column is equally the
value at resolution.
tests/test_extraction.c: elixir_usage_records_receiver pins the recorded
qualifier. extract_compact_relocates_every_usage_string walks every arena-owned
pointer on every CBMUsage after cbm_result_compact and asserts each one lands
inside the surviving arena block, so a field added later and not relocated
fails the test.
Its content dependency is the resolution commit, whose receiver-chain guard is
what the recorded qualifier feeds.
Signed-off-by: Chad <4307099+BobbieBarker@users.noreply.github.com>
0 commit comments