ucn 5.1.1 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,7 @@ three. The text block is the whole response on every surface.
41
41
 
42
42
  Persistent indexes live in a per-user, project-keyed cache rather than the analyzed repository. Set `UCN_CACHE_DIR` to override the cache root; CLI `--no-cache` bypasses persistence and `--clear-cache` removes the current project's cache. Legacy `<project>/.ucn-cache` directories are migrated on first use.
43
43
 
44
- Supported source families are JavaScript/TypeScript/TSX, Python, Go, Rust, Java, C, C++, C#, and HTML inline JavaScript/event handlers. C/C++ uses `compile_commands.json` when available to classify headers and resolve include paths. Recoverable preprocessor branches contribute AST-proven source facts, so a single selected configuration does not silently erase definitions or calls; UCN still cannot prove which branch a particular build activates. This is portable AST analysis, not a compiler build; macros, templates, generated code, reflection, and external dependency semantics can remain unverified.
44
+ Supported source families are JavaScript/TypeScript/TSX, Python, Go, Rust, Java, C, C++, C#, and HTML inline JavaScript/event handlers. C/C++ uses `compile_commands.json` when available to classify headers and resolve include paths. Recoverable preprocessor branches contribute AST-proven source facts, so a single selected configuration does not silently erase definitions or calls; disagreeing conditional macro identities stay visible as unverified. C++ resolution uses namespace ownership, static overload shape (including arrays), and macro-parameter requalification. C# resolution uses declared property/field receiver types plus overload and hiding discipline. This is portable AST analysis, not a compiler build; macros, templates, generated code, reflection, and external dependency semantics can remain unverified.
45
45
 
46
46
  `repo` readiness is task-specific. Its headline is navigation readiness;
47
47
  refactor, deletion, semantic recall, and the sampled evidence mix are separate
@@ -59,6 +59,12 @@ For caller-bearing `show`, `impact`, `trace`, `tests`, and `check` views:
59
59
  - `WARNING` identifies unreadable, unparsed, or partially indexed files, and lists unsupported-language occurrence sites (file:line plus the line text) so nothing grep would show is hidden. `usages` and `tests` carry the same disclosure as a note.
60
60
  - `FILTERED` means query options hid evidence.
61
61
 
62
+ When the selected definition is a property/getter/setter, `impact` adds a
63
+ separate `PROPERTY ACCESS SITES` band. Confirmed reads/writes have receiver
64
+ identity; matching attribute syntax with an unresolved receiver stays
65
+ unverified. These are change dependencies, not fabricated caller edges, so
66
+ the caller `ACCOUNT` remains a call-shaped partition.
67
+
62
68
  An observed-text zero is not semantic zero or safe-delete proof. Numeric evidence values are ordinal ranking weights, not probabilities.
63
69
 
64
70
  When a plain name selects more than one definition, action-oriented commands
@@ -101,7 +107,7 @@ definition as an implicit repository-wide target.
101
107
 
102
108
  ## Deletion protocol
103
109
 
104
- Treat `deadcode` as a candidate generator. Before deletion, inspect `usages`, `impact`, `entrypoints`, `api`, and `repo --sections=health --deep`; then corroborate with the compiler/type checker and tests. Computed dispatch such as `handlers[key]()` is a reported blind spot; registry members reached by a modeled computed receiver are withheld. Unknown decorators/annotations and member-assigned event handlers are also withheld by default because they can be the registration itself. All remaining candidates are still review-only. Never delete solely from `deadcode` or an observed-text-zero result.
110
+ Treat `deadcode` as a candidate generator. Before deletion, inspect `usages`, `impact`, `entrypoints`, `api`, and `repo --sections=health --deep`; then corroborate with the compiler/type checker and tests. Computed dispatch such as `handlers[key]()` is a reported blind spot; registry members reached by a modeled computed receiver are withheld. Statically named reflection such as `getattr(obj, "run")` is positive liveness evidence, so every matching member spelling is withheld; recognized dynamic reflection is counted and warned because it cannot be attributed to one member. Unknown decorators/annotations and member-assigned event handlers are also withheld by default because they can be the registration itself. All remaining candidates are still review-only. Never delete solely from `deadcode` or an observed-text-zero result.
105
111
 
106
112
  `usages` includes comment/string/docstring occurrences in an `OTHER TEXT` section unless
107
113
  `--code-only` is set. This is a literal-name inventory, not exact target
@@ -114,9 +120,24 @@ rejected, and unsupported advanced syntax should be handed to ripgrep.
114
120
  call candidates. Calls proved to belong to another same-name target are
115
121
  disclosed separately and excluded from the activity total.
116
122
 
117
- `plan` always includes the selected declaration plus indexed call/import/export
118
- previews. Read `changeSummary`, and manually review any edit marked
119
- `needsReview`; the command previews changes but does not apply or compile them.
123
+ For `plan --rename-to`, the selected declaration is only the starting point.
124
+ When the index proves the relationship, the rename unit closes over
125
+ overload/signature groups, base and override declarations, Rust trait slots,
126
+ Go interface slots and their satisfiers, exact call and value-reference tokens,
127
+ imports/exports, Python `__all__` strings, and module-attribute references.
128
+ Exact token/expression spans keep a foreign same-named occurrence on the same
129
+ line unchanged. Open external interfaces, incomplete ownership, unresolved
130
+ dispatch, or an inexact token route to `needsReview` instead of a synthesized
131
+ edit. Comment/string occurrences in indexed source appear in `reviewItems` and
132
+ are never rewritten automatically; the result also tells you to search
133
+ documentation, configuration, generated files, and unsupported languages for
134
+ the old spelling. Read `changeSummary` and every review item. `plan` previews
135
+ only: it does not modify files, run a compiler, or prove runtime compatibility.
136
+
137
+ For `deps --cycles`, `eager` means every edge executes at module scope.
138
+ `deferred` means at least one Python edge is function-local, so the chain is
139
+ not an unconditional import-time cycle; it remains visible because invoking
140
+ that function during initialization can still matter.
120
141
 
121
142
  ## Efficient use
122
143
 
@@ -22,17 +22,17 @@ structural or code-only search.
22
22
 
23
23
  | Command | Purpose |
24
24
  |---|---|
25
- | `impact [handle]` | Show direct symbol impact when given a handle; without one, analyze the Git diff. |
25
+ | `impact [handle]` | Show direct symbol impact when given a handle; accessor targets include receiver-tiered property reads/writes as a separate dependency band. Without a handle, analyze the Git diff. |
26
26
  | `tests <handle\|file>` | Find statically linked direct tests. Set `--depth=N` for transitive affected tests. Empty results are not runtime coverage proof. |
27
27
  | `check [handle]` | Validate confirmed call-site arity for a symbol; without one, run the composed pre-commit diagnostic. |
28
- | `plan <handle>` | Preview `--rename-to`, `--add-param`, or `--remove-param` edits, including the selected declaration and indexed call/import/export sites. Review `changeSummary` and `needsReview`. |
28
+ | `plan <handle>` | Preview `--rename-to`, `--add-param`, or `--remove-param` edits. For renames, the proven closure can include overload/signature groups, inheritance/trait/Go-interface slots, accessor reads/writes, exact call/reference tokens, imports/exports, Python `__all__` strings, and module-attribute references. Source comments/strings are explicit `reviewItems`; non-source files get a search handoff. Open ownership or method sets stay `needsReview`; the command never applies or compiles edits. |
29
29
 
30
30
  ## Repository and architecture
31
31
 
32
32
  | Command | Purpose |
33
33
  |---|---|
34
34
  | `repo` | Repository orientation. Select `summary,files,stats,health` with `--sections`; `--deep` includes readiness evidence. Skipped unsupported source is listed with a grep/language-tool handoff. |
35
- | `deps <file>` | File dependency graph. Use `--direction=imports\|importers\|both`, `--detailed`, or `--cycles`. |
35
+ | `deps <file>` | File dependency graph. Use `--direction=imports\|importers\|both`, `--detailed`, or `--cycles`. Python cycles are classified as eager or function-local/deferred without dropping either kind. |
36
36
  | `api [file]` | Static exported/public surface for a project or file. |
37
37
  | `entrypoints` | Framework, route, task, test, and runtime entry points. |
38
38
  | `endpoints` | Server/client HTTP surface; `--bridge` adds advisory matching. |
@@ -41,7 +41,7 @@ structural or code-only search.
41
41
 
42
42
  | Command | Purpose |
43
43
  |---|---|
44
- | `deadcode` | Conservative unreferenced-symbol candidates for review. Modeled computed-dispatch members, unknown decorated/annotated callables, and member-assigned event handlers are withheld by default. |
44
+ | `deadcode` | Conservative unreferenced-symbol candidates for review. Statically named reflection targets, modeled computed-dispatch members, unknown decorated/annotated callables, and member-assigned event handlers are withheld by default. Recognized dynamic reflection is counted and warned because it cannot be attributed. |
45
45
  | `audit-async` | Potential missing-await sites in JavaScript/TypeScript/Python and C#. MCP spelling: `audit_async`. |
46
46
  | `stacktrace <text>` | Advisory stack-frame parsing and source lookup. |
47
47
 
@@ -84,4 +84,4 @@ Omit the target for the current project. A target may be a file, directory, or q
84
84
 
85
85
  ## Language notes
86
86
 
87
- Supported source families are JavaScript/TypeScript/TSX, Python, Go, Rust, Java, C, C++, C#, and HTML inline JavaScript/event handlers. C/C++ consumes `compile_commands.json` when present for header-language and include-path context, and retains AST-proven facts across recoverable preprocessor branches. UCN remains portable AST analysis: it does not run a compiler, preprocessor, Roslyn, or an LSP during normal queries, and it does not assert which conditional branch a build activates.
87
+ Supported source families are JavaScript/TypeScript/TSX, Python, Go, Rust, Java, C, C++, C#, and HTML inline JavaScript/event handlers. C/C++ consumes `compile_commands.json` when present for header-language and include-path context, and retains AST-proven facts across recoverable preprocessor branches. C++ call identity uses namespace ownership, static overload shape (including arrays), and macro requalification; disagreeing conditional macro definitions remain visible as unverified. C# uses declared property/field receiver types and overload/hiding discipline. UCN remains portable AST analysis: it does not run a compiler, preprocessor, Roslyn, or an LSP during normal queries, and it does not assert which conditional branch a build activates.
package/README.md CHANGED
@@ -39,6 +39,8 @@ It's deliberately lightweight:
39
39
 
40
40
  - **No required background process** - the CLI parses on demand, answers, and
41
41
  exits. MCP stays warm only when you choose to run it.
42
+ - **No HTTP or network stack** - MCP uses a local, dependency-free stdio
43
+ transport; UCN never opens a port.
42
44
  - **No language servers, no compilation** - tree-sitter does the analysis
43
45
  without building the project.
44
46
  - **No config** - point it at a directory and ask.
@@ -200,7 +202,7 @@ ACCOUNT, CONTRACT, and WARNING lines survive the cut.
200
202
  Don't take the tiers on faith. Release gates re-derive UCN's answers from real
201
203
  compilers and language servers on a ten-repository board of pinned production
202
204
  codebases, and publishing is blocked unless they pass. The latest full
203
- release-board run (2026-08-11):
205
+ release-board run (2026-08-24):
204
206
 
205
207
  | Repository | Pinned commit | Oracle | Caller precision | Caller recall | Callee prec / recall | Command checks |
206
208
  |---|---|---|---:|---:|---:|---:|
@@ -211,16 +213,16 @@ release-board run (2026-08-11):
211
213
  | [ripgrep](https://github.com/BurntSushi/ripgrep) | [`82313cf9`](https://github.com/BurntSushi/ripgrep/commit/82313cf95849bfe425109ad9506a52154879b1b1) | rust-analyzer | 100% | 100% | 100% / 100% | 100% |
212
214
  | [clap](https://github.com/clap-rs/clap) | [`d3e59a9a`](https://github.com/clap-rs/clap/commit/d3e59a9ab214910b9dad02921b7ef42c6400de9b) | rust-analyzer | 100% | 100% | 100% / 100% | 100% |
213
215
  | [javapoet](https://github.com/square/javapoet) | [`b9017a95`](https://github.com/square/javapoet/commit/b9017a9503b76e11b4ad4c1a9f050e2d29112cb0) | JDT LS | 100% | 100% | 100% / 100% | 100% |
214
- | [newtonsoft-json](https://github.com/JamesNK/Newtonsoft.Json) | [`4f73e743`](https://github.com/JamesNK/Newtonsoft.Json/commit/4f73e74372445108d2c1bda37b36e6f5e43402e0) | Roslyn | 99.4% | 100% | 100% / 100% | 100% |
216
+ | [newtonsoft-json](https://github.com/JamesNK/Newtonsoft.Json) | [`4f73e743`](https://github.com/JamesNK/Newtonsoft.Json/commit/4f73e74372445108d2c1bda37b36e6f5e43402e0) | Roslyn | 100% | 100% | 100% / 100% | 100% |
215
217
  | [cjson](https://github.com/DaveGamble/cJSON) | [`c859b25d`](https://github.com/DaveGamble/cJSON/commit/c859b25da02955fef659d658b8f324b5cde87be3) | clangd | 100% | 100% | 100% / 100% | 100% |
216
- | [fmt](https://github.com/fmtlib/fmt) | [`e424e3f2`](https://github.com/fmtlib/fmt/commit/e424e3f2e607da02742f73db84873b8084fc714c) | clangd | 99.6% | 100% | 100% / 100% | 100% |
218
+ | [fmt](https://github.com/fmtlib/fmt) | [`e424e3f2`](https://github.com/fmtlib/fmt/commit/e424e3f2e607da02742f73db84873b8084fc714c) | clangd | 100% | 100% | 100% / 100% | 100% |
217
219
 
218
220
  On the same run: **zero** in-scope oracle call edges missing from the answer
219
221
  (the release gate) on every repository, **zero** false-dead `deadcode` claims
220
222
  in the oracle-visible sample, **8,000 / 8,000** cross-command consistency
221
223
  comparisons in agreement, **10 / 10** repositories inside the performance
222
- budget (slowest median cold build 15.4K lines/second by wall time, worst query
223
- p95 73.8 ms, highest peak RSS 771 MB), and 3,383 automated tests with no
224
+ budget (slowest normalized median cold build 17.4K lines/second by wall time,
225
+ worst query p95 83.0 ms, highest peak RSS 908.5 MB), and 3,609 automated tests with no
224
226
  failures or skips. The same gates run in CI (the scheduled
225
227
  [Eval workflow](https://github.com/mleoca/ucn/actions/workflows/eval.yml) and
226
228
  every release tag), and `npm run trust:gate` reproduces the release board
@@ -234,10 +236,11 @@ external population. Unverified precision is reported separately and is
234
236
  intentionally much lower on dispatch-heavy code: those entries are review
235
237
  candidates, never confirmed claims.
236
238
 
237
- Beyond the publish gate, a scheduled board re-checks 22 pinned repositories
239
+ Beyond the publish gate, a scheduled board re-checks 24 pinned repositories
238
240
  across every supported oracle language (zod, express, hono, zustand, fastify,
239
- rich, click, grpc-go, chi, cursive, gson, jsoup, and friends), plus a rotating
240
- fresh-repo arm of codebases the engine was never tuned on. Repositories that
241
+ rich, click, attrs, grpc-go, chi, cursive, itertools, gson, jsoup, and
242
+ friends), plus a rotating fresh-repo arm of codebases the engine was never
243
+ tuned on. Repositories that
241
244
  expose a gap stay on the board; they don't get removed to keep a table pretty.
242
245
  These are measured results on pinned code, not a claim of universal program
243
246
  understanding or identical performance on every machine.
@@ -284,7 +287,7 @@ SIGNATURE CHANGE:
284
287
 
285
288
  CHANGES NEEDED: 12
286
289
  Files affected: 5
287
- Definition 1, calls/references 7, imports 4, exports 0; manual review required for 0 of these changes
290
+ Definition 1, calls 7, references 0, text dependencies 0, imports 4, exports 0; manual review items 0
288
291
 
289
292
  BY FILE:
290
293
 
@@ -299,8 +302,21 @@ cli/index.js (2 changes)
299
302
  ... (more changes in core/discovery.js, core/cache.js, core/project.js, test/integration.test.js)
300
303
  ```
301
304
 
302
- Anything `plan` can't represent safely is marked `needsReview` instead of
303
- being silently rewritten. Before committing, point the same machinery at your
305
+ For a rename, `plan` closes the change over every relationship the index can
306
+ prove: overload/signature groups, base and override declarations, Rust trait
307
+ slots, Go interface slots and their satisfiers, exact call and value-reference
308
+ tokens, imports/exports, Python `__all__` strings, and module-attribute
309
+ references. Accessor renames also follow receiver-proven property reads and
310
+ writes. It edits exact token or expression spans, so another same-named call
311
+ on the same line is not swept up accidentally.
312
+
313
+ Open external interfaces, incomplete ownership, unresolved dispatch, or an
314
+ inexact token are marked `needsReview` instead of receiving a synthesized
315
+ edit. Comments and strings in indexed source appear as separate review items
316
+ and are never rewritten automatically; documentation, configuration,
317
+ generated files, and unsupported languages get an explicit exact-text search
318
+ handoff. `plan` previews changes; it does not modify files or replace the
319
+ compiler and test suite. Before committing, point the same machinery at your
304
320
  Git diff:
305
321
 
306
322
  ```bash
@@ -396,7 +412,10 @@ Three claims, and every one is re-checked against rust-analyzer in CI: a
396
412
  default-audit claim with an oracle-visible reference fails the build. Notice
397
413
  what it *didn't* claim: exported API that external code may call,
398
414
  framework-registered symbols, and anything whose name appears in files UCN
399
- couldn't parse. `deadcode` is deliberately a candidate generator. Before
415
+ couldn't parse. A literal reflection target such as `getattr(obj, "run")`
416
+ also withholds matching member names from deletion candidates; recognized
417
+ dynamic reflection is counted and warned because it cannot be attributed.
418
+ `deadcode` is deliberately a candidate generator. Before
400
419
  deleting, corroborate with `usages`, `impact`, `api`, and your compiler and
401
420
  tests.
402
421
 
@@ -414,6 +433,11 @@ ucn entrypoints --type=http # runtime and framework roots
414
433
  ucn endpoints --bridge --unmatched # server routes with no client, and vice versa
415
434
  ```
416
435
 
436
+ Cycle output separates eager import-time loops from Python chains containing
437
+ a function-local/deferred edge. Deferred chains stay visible—they are not
438
+ unconditional import-time cycles, but can still fail if invoked while modules
439
+ are initializing.
440
+
417
441
  `endpoints --bridge` matches server routes to client requests across
418
442
  languages: Express/Fastify/Koa/NestJS/Next.js, Flask/FastAPI, Spring/JAX-RS,
419
443
  Go net/http (Gin/Echo/Chi/Fiber), axum/actix-web, and ASP.NET on the server
@@ -518,10 +542,13 @@ evidence.
518
542
  - **C** - functions, structs, macros, includes, calls, entry points, API
519
543
  analysis.
520
544
  - **C++** - C coverage plus classes, methods, constructors, inheritance,
521
- namespaces, overloads, templates, typed field receivers.
545
+ namespaces, overloads, templates, typed field receivers, static array-shape
546
+ selection, and macro requalification. Conditional macro disagreement stays
547
+ visible as unverified.
522
548
  - **C#** - namespaces, classes/interfaces/records, fields/properties,
523
- attributes, overload-aware calls, async flow, top-level programs, .NET stack
524
- frames, ASP.NET/HttpClient endpoints.
549
+ attributes, declared property/field receiver types, overload and hiding
550
+ discipline, async flow, top-level programs, .NET stack frames, and
551
+ ASP.NET/HttpClient endpoints.
525
552
  - **HTML** - inline JavaScript and `on*` event handlers.
526
553
 
527
554
  For C and C++, a `compile_commands.json` improves header-language,
@@ -0,0 +1,183 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const { codeUnitCompare } = require('./shared');
5
+
6
+ // Descriptors/properties are consumed through reads and writes, not only
7
+ // call syntax. Keep this vocabulary shared by impact and refactoring so the
8
+ // two commands cannot disagree about whether a selected symbol is an accessor.
9
+ const ACCESSOR_KINDS = new Set([
10
+ 'property', 'setter', 'deleter', 'get', 'set',
11
+ 'static get', 'static set', 'override get', 'override set',
12
+ 'static override get', 'static override set',
13
+ ]);
14
+
15
+ function isAccessorDefinition(definition) {
16
+ return !!definition && (ACCESSOR_KINDS.has(definition.type) ||
17
+ ACCESSOR_KINDS.has(definition.memberType));
18
+ }
19
+
20
+ function ownerName(definition) {
21
+ if (definition.className) return definition.className;
22
+ if (!definition.receiver) return null;
23
+ return String(definition.receiver)
24
+ .replace(/^[*&]\s*/, '')
25
+ .replace(/^mut\s+/, '')
26
+ .replace(/<.*$/, '')
27
+ .trim() || null;
28
+ }
29
+
30
+ function bareTypeName(value) {
31
+ if (!value) return null;
32
+ return String(value)
33
+ .replace(/^(?:typing\.)?(?:Optional|Annotated|Final)\s*\[/, '')
34
+ .replace(/[<[(].*$/s, '')
35
+ .split(/\.|::/).pop()
36
+ .replace(/[?*&\s]/g, '') || null;
37
+ }
38
+
39
+ function typeMatchesOwner(index, typeName, contextFile, owner, ownerFile) {
40
+ const bare = bareTypeName(typeName);
41
+ if (!bare || !owner || bare !== owner) return false;
42
+ const resolved = index._resolveClassFile?.(bare, contextFile);
43
+ if (resolved) return path.resolve(resolved) === path.resolve(ownerFile);
44
+ const ownerDefs = (index.symbols.get(owner) || []).filter(symbol =>
45
+ ['class', 'struct', 'interface', 'trait', 'record'].includes(symbol.type));
46
+ return ownerDefs.length === 1 &&
47
+ path.resolve(ownerDefs[0].file) === path.resolve(ownerFile);
48
+ }
49
+
50
+ function insideSelectedAccessorBody(index, name, definition, file, line) {
51
+ return (index.symbols.get(name) || []).some(candidate =>
52
+ isAccessorDefinition(candidate) &&
53
+ candidate.file === definition.file &&
54
+ candidate.className === definition.className &&
55
+ file === candidate.file &&
56
+ line >= candidate.startLine &&
57
+ line <= (candidate.endLine || candidate.startLine));
58
+ }
59
+
60
+ /**
61
+ * Find reads/writes that may consume a selected accessor. Confirmed entries
62
+ * require receiver identity (`self`/`this` in the owner or a Python instance
63
+ * field whose constructor assignment proves the owner type). Everything else
64
+ * remains visible in the unverified tier; accessor identity is never guessed
65
+ * from the spelling alone.
66
+ */
67
+ function findAccessorReferences(index, name, definition, options = {}) {
68
+ if (!isAccessorDefinition(definition)) return null;
69
+ const owner = ownerName(definition);
70
+ if (!owner) return null;
71
+
72
+ const confirmed = [];
73
+ const unverified = [];
74
+ const excluded = [];
75
+ // Use the parser's raw occurrence records rather than usages()' public
76
+ // line-oriented inventory. A line can contain two same-spelled member
77
+ // accesses with different receivers; collapsing them by file+line would
78
+ // make a rename edit one token while silently losing the other.
79
+ const refs = [];
80
+ for (const [file, entry] of index.files) {
81
+ if (!index.matchesFilters(entry.relativePath, options)) continue;
82
+ let content;
83
+ let occurrences;
84
+ try {
85
+ content = index._readFile(file);
86
+ if (!content.includes(name)) continue;
87
+ occurrences = index._getCachedUsages(file, name);
88
+ } catch { continue; }
89
+ if (!occurrences) continue;
90
+ const lines = content.split('\n');
91
+ for (const usage of occurrences) {
92
+ if (usage.usageType !== 'reference') continue;
93
+ refs.push({
94
+ ...usage,
95
+ file,
96
+ relativePath: entry.relativePath,
97
+ content: lines[usage.line - 1] || '',
98
+ });
99
+ }
100
+ }
101
+
102
+ for (const ref of refs) {
103
+ const rel = ref.relativePath || path.relative(index.root, ref.file);
104
+ const shaped = {
105
+ file: rel,
106
+ absoluteFile: ref.file,
107
+ line: ref.line,
108
+ expression: (ref.content || '').trim(),
109
+ ...(Number.isInteger(ref.column) && { column: ref.column }),
110
+ ...(ref.receiver && { receiver: ref.receiver }),
111
+ };
112
+
113
+ // A backing-store attribute inside the selected getter/setter body
114
+ // often has the same spelling (`self._local.value`). It is not a
115
+ // consumption of the descriptor being queried.
116
+ if (insideSelectedAccessorBody(index, name, definition, ref.file, ref.line) &&
117
+ !['self', 'cls', 'this'].includes(ref.receiver)) {
118
+ excluded.push({ ...shaped, reason: 'accessor-definition-body' });
119
+ continue;
120
+ }
121
+
122
+ const enclosing = index.findEnclosingFunction(ref.file, ref.line, true);
123
+ const receiver = ref.receiver || null;
124
+ if (receiver && ['self', 'cls', 'this'].includes(receiver) &&
125
+ enclosing?.className === owner && enclosing.file === definition.file) {
126
+ confirmed.push({
127
+ ...shaped,
128
+ callerName: enclosing.name,
129
+ resolution: 'same-class-accessor',
130
+ tier: 'confirmed',
131
+ });
132
+ continue;
133
+ }
134
+
135
+ let receiverType = ref.receiverType || null;
136
+ if (!receiverType && receiver && enclosing?.className) {
137
+ receiverType = index.getInstanceAttributeTypes(
138
+ ref.file, enclosing.className)?.get(receiver) || null;
139
+ }
140
+ if (receiverType && typeMatchesOwner(
141
+ index, receiverType, ref.file, owner, definition.file)) {
142
+ confirmed.push({
143
+ ...shaped,
144
+ callerName: enclosing?.name || null,
145
+ receiverType,
146
+ resolution: 'receiver-field-type',
147
+ tier: 'confirmed',
148
+ });
149
+ continue;
150
+ }
151
+ if (receiver && typeMatchesOwner(index, receiver, ref.file, owner, definition.file)) {
152
+ confirmed.push({
153
+ ...shaped,
154
+ callerName: enclosing?.name || null,
155
+ receiverType: receiver,
156
+ resolution: 'type-qualified-accessor',
157
+ tier: 'confirmed',
158
+ });
159
+ continue;
160
+ }
161
+
162
+ unverified.push({
163
+ ...shaped,
164
+ callerName: enclosing?.name || null,
165
+ ...(receiverType && { receiverType }),
166
+ reason: receiverType ? 'receiver-type-mismatch' :
167
+ receiver ? 'receiver-type-unresolved' : 'nested-receiver-unresolved',
168
+ tier: 'unverified',
169
+ });
170
+ }
171
+
172
+ const sort = (a, b) => codeUnitCompare(a.file, b.file) || a.line - b.line;
173
+ confirmed.sort(sort);
174
+ unverified.sort(sort);
175
+ excluded.sort(sort);
176
+ return { owner, confirmed, unverified, excluded };
177
+ }
178
+
179
+ module.exports = {
180
+ ACCESSOR_KINDS,
181
+ isAccessorDefinition,
182
+ findAccessorReferences,
183
+ };
package/core/analysis.js CHANGED
@@ -18,6 +18,7 @@ const { isTestFile } = require('./discovery');
18
18
  const { computeReachability, symbolKey } = require('./entrypoints');
19
19
  const { getLanguageAdapter } = require('../languages');
20
20
  const { projectComputedDispatch } = require('./ast-analysis');
21
+ const { findAccessorReferences } = require('./accessors');
21
22
 
22
23
  // JS/TS test framework helpers — calls to these bracket a test case.
23
24
  // Used to flag call sites whose enclosing function is an arrow callback
@@ -1235,6 +1236,40 @@ function impact(index, name, options = {}) {
1235
1236
  });
1236
1237
  }
1237
1238
 
1239
+ // Accessors are consumed through reads/writes. They are intentionally a
1240
+ // separate dependency band rather than fake caller edges: the caller
1241
+ // oracle and conservation account remain call-shaped, while impact no
1242
+ // longer hides the normal use form of a property/getter/setter.
1243
+ let propertyAccesses = findAccessorReferences(index, name, def, {
1244
+ includeTests: true,
1245
+ exclude: options.exclude,
1246
+ });
1247
+ if (propertyAccesses) {
1248
+ const accessByFile = new Map();
1249
+ for (const site of propertyAccesses.confirmed) {
1250
+ if (!accessByFile.has(site.file)) accessByFile.set(site.file, []);
1251
+ accessByFile.get(site.file).push(site);
1252
+ }
1253
+ propertyAccesses = {
1254
+ owner: propertyAccesses.owner,
1255
+ confirmedCount: propertyAccesses.confirmed.length,
1256
+ unverifiedCount: propertyAccesses.unverified.length,
1257
+ totalCandidates: propertyAccesses.confirmed.length +
1258
+ propertyAccesses.unverified.length,
1259
+ byFile: [...accessByFile.entries()]
1260
+ .sort((a, b) => codeUnitCompare(a[0], b[0]))
1261
+ .map(([file, sites]) => ({ file, count: sites.length, sites })),
1262
+ unverifiedSites: propertyAccesses.unverified,
1263
+ excluded: {
1264
+ total: propertyAccesses.excluded.length,
1265
+ byReason: propertyAccesses.excluded.reduce((out, site) => {
1266
+ out[site.reason] = (out[site.reason] || 0) + 1;
1267
+ return out;
1268
+ }, {}),
1269
+ },
1270
+ };
1271
+ }
1272
+
1238
1273
  // Apply top limit if specified (limits total call sites shown)
1239
1274
  const totalBeforeLimit = filteredSites.length;
1240
1275
  if (options.top && options.top > 0 && filteredSites.length > options.top) {
@@ -1276,6 +1311,12 @@ function impact(index, name, options = {}) {
1276
1311
  }
1277
1312
  }
1278
1313
 
1314
+ const affectedFiles = new Set([
1315
+ ...Array.from(byFile.keys()),
1316
+ ...(propertyAccesses?.byFile || []).map(group => group.file),
1317
+ ...(propertyAccesses?.unverifiedSites || []).map(site => site.file),
1318
+ ]);
1319
+
1279
1320
  return {
1280
1321
  function: name,
1281
1322
  file: def.relativePath,
@@ -1286,6 +1327,11 @@ function impact(index, name, options = {}) {
1286
1327
  totalCallSites: totalBeforeLimit,
1287
1328
  shownCallSites: filteredSites.length,
1288
1329
  unverifiedSites,
1330
+ ...(propertyAccesses && {
1331
+ propertyAccesses,
1332
+ totalDependencySites: totalBeforeLimit + propertyAccesses.confirmedCount,
1333
+ affectedFiles: affectedFiles.size,
1334
+ }),
1289
1335
  account: impactAccount,
1290
1336
  hasEntrypoints: !!impactReachable && impactReachable.size > 0,
1291
1337
  callerHistogram,
@@ -181,6 +181,108 @@ function computedReceiver(callee) {
181
181
  return node?.type === 'identifier' ? node.text : null;
182
182
  }
183
183
 
184
+ const STRING_LITERAL_NODES = new Set([
185
+ 'string', 'string_literal', 'raw_string_literal',
186
+ 'interpreted_string_literal', 'verbatim_string_literal',
187
+ ]);
188
+
189
+ function literalStringValue(node) {
190
+ if (!node || !STRING_LITERAL_NODES.has(node.type)) return null;
191
+ const content = (node.namedChildren || []).find(child =>
192
+ child.type === 'string_content' || child.type === 'interpreted_string_literal_content');
193
+ if (content) return content.text;
194
+ const raw = String(node.text || '');
195
+ const first = raw.search(/["']/);
196
+ if (first < 0) return null;
197
+ const quote = raw[first];
198
+ const triple = raw.slice(first, first + 3) === quote.repeat(3);
199
+ const width = triple ? 3 : 1;
200
+ if (!raw.endsWith(quote.repeat(width))) return null;
201
+ const value = raw.slice(first + width, -width);
202
+ // Escaped/interpolated member names are not a stable static spelling.
203
+ if (value.includes('\\') || value.includes('{') || value.includes('$')) return null;
204
+ return value;
205
+ }
206
+
207
+ function callShape(node) {
208
+ if (!['call', 'call_expression', 'invocation_expression',
209
+ 'method_invocation'].includes(node.type)) return null;
210
+ const callee = node.childForFieldName('function') ||
211
+ node.childForFieldName('name') || node.namedChild(0);
212
+ const args = node.childForFieldName('arguments') ||
213
+ (node.namedChildren || []).find(child =>
214
+ ['argument_list', 'arguments', 'bracketed_argument_list'].includes(child.type));
215
+ return callee && args ? { callee, args: args.namedChildren || [] } : null;
216
+ }
217
+
218
+ /**
219
+ * Extract recognized reflection operations and classify whether their member
220
+ * target is a stable literal. Literal targets are positive liveness evidence;
221
+ * dynamic targets cannot identify one member but must still be disclosed by
222
+ * deletion-oriented commands.
223
+ */
224
+ function reflectionSites(content, language) {
225
+ try {
226
+ const syntaxHints = {
227
+ python: ['getattr', 'setattr', 'hasattr', 'delattr'],
228
+ javascript: ['Reflect.'],
229
+ typescript: ['Reflect.'],
230
+ tsx: ['Reflect.'],
231
+ go: ['MethodByName', 'FieldByName'],
232
+ java: ['getMethod', 'getDeclaredMethod', 'getField', 'getDeclaredField'],
233
+ csharp: ['GetMethod', 'GetProperty', 'GetField'],
234
+ }[language];
235
+ if (!syntaxHints || !syntaxHints.some(hint => content.includes(hint))) {
236
+ return [];
237
+ }
238
+ const parser = getParser(language);
239
+ if (!parser) return [];
240
+ const tree = safeParse(parser, content);
241
+ const sites = [];
242
+ walkNamed(tree.rootNode, node => {
243
+ const call = callShape(node);
244
+ if (!call) return true;
245
+ const callee = String(call.callee.text || '');
246
+ let argIndex = null;
247
+ let kind = null;
248
+ if (language === 'python' &&
249
+ ['getattr', 'setattr', 'hasattr', 'delattr'].includes(callee)) {
250
+ argIndex = 1;
251
+ kind = callee;
252
+ } else if (['javascript', 'typescript', 'tsx'].includes(language) &&
253
+ /^(?:globalThis\.)?Reflect\.(?:get|set|has|deleteProperty)$/.test(callee)) {
254
+ argIndex = 1;
255
+ kind = callee.split('.').pop();
256
+ } else if (language === 'go' &&
257
+ /\.(?:MethodByName|FieldByName)$/.test(callee)) {
258
+ argIndex = 0;
259
+ kind = callee.split('.').pop();
260
+ } else if (['java', 'csharp'].includes(language) &&
261
+ /(?:^|\.)(?:getMethod|getDeclaredMethod|getField|getDeclaredField|GetMethod|GetProperty|GetField)$/.test(callee)) {
262
+ argIndex = 0;
263
+ kind = callee.split('.').pop();
264
+ }
265
+ if (argIndex == null || !call.args[argIndex]) return true;
266
+ const name = literalStringValue(call.args[argIndex]);
267
+ sites.push({
268
+ ...(name && /^[A-Za-z_$][\w$]*$/.test(name) && { name }),
269
+ kind,
270
+ line: node.startPosition.row + 1,
271
+ expression: node.text,
272
+ dynamic: !name || !/^[A-Za-z_$][\w$]*$/.test(name),
273
+ });
274
+ return true;
275
+ });
276
+ return sites;
277
+ } catch (_) {
278
+ return [];
279
+ }
280
+ }
281
+
282
+ function literalReflectionSites(content, language) {
283
+ return reflectionSites(content, language).filter(site => !site.dynamic);
284
+ }
285
+
184
286
  /**
185
287
  * Find direct computed dispatch calls such as handlers[name](). Literal keys
186
288
  * are excluded because they retain a statically visible member name.
@@ -276,4 +378,6 @@ module.exports = {
276
378
  computeAstComplexity,
277
379
  computedDispatchSites,
278
380
  projectComputedDispatch,
381
+ reflectionSites,
382
+ literalReflectionSites,
279
383
  };
package/core/cache.js CHANGED
@@ -617,7 +617,38 @@ function clearAllCaches() {
617
617
  // object they patch (`console.log = fn` → 'console') — so the builtin-global
618
618
  // exclusion can see cross-file that a project def rebinds the global's
619
619
  // member (fix #286a); impl-kind symbols leave the bindings table (#286b).
620
- const CACHE_FORMAT_VERSION = 173;
620
+ // v177: C++ `template <>` full-specialization defs persist isSpecialization
621
+ // (fix #299A — identity closure with the primary template), and C++
622
+ // argument-position calls through a local callable variable record kind
623
+ // 'expr' instead of call:NAME (fix #299B shadow guard).
624
+ // v178: extendsGraph entries persist the defining symbol's startLine so
625
+ // scope-aware consumers can pick the right def when several same-name
626
+ // classes live in one file — function-local test subclasses (fix #300,
627
+ // attrs-measured); Go range VALUE variables are typed from the container's
628
+ // element type (declared fields/params/vars/literals — `for _, route :=
629
+ // range r.routes` types route as Route; fix #300, mux-measured), changing
630
+ // persisted call-record receiverTypes.
631
+ // v179: Go unnamed interface parameters are retained in paramsStructured;
632
+ // old caches report zero-arity interface methods and break rename closure.
633
+ // v183: Go calls persist exact spans, builtin-new receiver types, indexed
634
+ // multi-return assignment targets, and lexical-closure result hints for exact
635
+ // chain/tuple flow; Rust macro-token calls retain compiler-declared closure
636
+ // parameter receiver types, and Rust functions retain generic trait bounds.
637
+ // v184: Python constructor-result records no longer retain a receiverType
638
+ // inferred from an uppercase name that is value-bound in the lexical scope
639
+ // (fix #304). Reject v183 calls shards so stale false receiver evidence
640
+ // cannot survive an engine upgrade.
641
+ // v185: C# deep member receivers retain their root+field path instead of a
642
+ // false terminal receiverType copied from the root variable (fix #305).
643
+ // v188: C++ call records retain enclosing macro-argument positions and macro
644
+ // symbols retain AST-derived parameter qualification/forwarding effects, so
645
+ // replacement-list requalification cannot masquerade as lexical calls
646
+ // (fix #306).
647
+ // v189: Python import records retain function-local/deferred scope so cycle
648
+ // reporting can classify import-time vs lazy edges from fresh and cached
649
+ // indexes; C# properties retain property identity instead of masquerading as
650
+ // ordinary fields for accessor impact/refactoring.
651
+ const CACHE_FORMAT_VERSION = 189;
621
652
 
622
653
  /**
623
654
  * Save index to cache file