Skip to content

Code Analysis Resolver Design

Tu Shaokun edited this page Nov 6, 2026 · 1 revision

Resolver design research

Research snapshot: 2026-11-06. This note supports the Code Analysis goal: help people and AI investigate code and changes with inspectable source evidence. It records implementation lessons and experiments, not an approved replacement roadmap. All linked Archify fixes remain Drafts.

What the comparisons establish

Question Evidence Design consequence
Which file does this reference name under its actual loading mode? Node import/require controls and #1219 Preserve the mode of each reference; a project-wide condition set cannot answer every call site.
Is that file a type declaration or an executable implementation? Nineteen pinned dependency-cruiser/chalk references, #1220 Keep type and implementation semantics explicit; check the selected source boundary after fallback.
Can that parent package actually expose this child? CPython and four adapted Pyright cases, #1216 Resolve parent components before descendants, with ordered search roots and namespace portions.
Is this Java declaration unique in the intended source set? Guava JRE/Android comparison Combined inventories do not establish build visibility. Retain ambiguity until the source-set context is selected.

Success includes removing an incorrect edge. The Python follow-up corrected five authored probes and two adapted upstream cases while preserving every import record in three real-repository controls. The JavaScript follow-up changed targets even when the total resolved count stayed constant. Counts alone would miss both distinctions.

Lessons from maintained analyzers

dependency-cruiser. At e6517db02e169f3db5c838bb1565ebd0fefeb452, resolution uses enhanced-resolve. Its configuration template and option reference make resolution policy configurable. Reuse the lesson that context must be recorded. Do not treat its output as a Node oracle without matching the configured conditions. Archify's current mode correction could reuse the TypeScript API already present, avoiding another resolver dependency.

Pyright. At 3afce1fa9c668e051f9f762c5e9d7b43d0494933, its import-resolution guide distinguishes workspace roots, extra paths, stubs and interpreter environments. Its nested namespace regressions supply useful positive and negative examples. Archify reused the parent-path principle within its existing captured root/src model; it did not adopt environment discovery or stub semantics. Full reproduction

JavaParser Symbol Solver. Source inspection at 0bd717a2d2286e9c37bdd4ae645c5f0264e1ac45 shows JavaParserTypeSolver searching from a supplied source root. CombinedTypeSolver returns the first solved result in the supplied solver order. The inference for Archify is that wiring in a solver does not remove the need to choose a build/source-set context. No JavaParser runtime benchmark was performed, and no solver or JDK dependency was added. Automatically choosing whichever Guava tree happens to come first would lose the ambiguity already identified by the JDK/source comparison.

Keep improvement checks tied to the question

For each investigation, retain the source revision, analysis configuration and extraction identity, then freeze the answer from an independent source or execution before comparing analyzer output. Record wrong bindings, missing relationships and explicit unknowns separately. A correct file edge does not establish a callback target, runtime reachability, service-provider choice or complete change impact.

Run changed examples alongside controls that should remain unchanged. Check the normal CLI and distributed artifact as well as internal functions. A dependency update needs negative controls too: the conditional-null experiment found that TypeScript 6.0.3 fixes one boundary but regresses a Node array-fallback fixture, so that upgrade was not adopted.

The next investigation is whether the existing local JS/TS call-evidence experiment helps answer real cross-file source questions correctly. Reuse its frozen source questions, review what Labs now covers, and explicitly score unsupported dispatch and wrong bindings. This does not authorize a claim of a complete call graph or an automatic runtime impact analysis, and it does not require new UI.

Validation records

Clone this wiki locally