Skip to main content

Module benchres

Module benchres 

Source
Expand description

Differential resolution benchmark (SCC-126): how much does LSP resolution improve on the native resolver? For each fixture repo in benchmarks/tasks.json the benchmark:

  1. indexes a fresh copy (in-process, cmd_index --quiet),
  2. snapshots the native state: native_resolved RESOLVED call edges and native_external EXTRACTED call edges to external_api entities,
  3. runs the pyright LSP pass (start_pyright + resolve_call_definitions, the same loop scc resolve --lsp uses),
  4. diffs the store afterwards: lsp_upgrades = edges that were EXTRACTED before and are RESOLVED now (matched on the preserved evidence id), lsp_unresolved = EXTRACTED edges remaining, agreement = native RESOLVED edges left untouched,
  5. records resolution conflicts (SCC-125) as drift findings.

Gate: upgrades > 0 across the corpus and unresolved / external < min_agreement (default 0.30 — at most 30% of external call candidates may stay unresolved).

Structs§

ExternalCallEdge
One native EXTRACTED call edge captured before the LSP pass.
RepoResolution
Differential numbers for one repository.
ResolutionSummary
Corpus totals plus per-repo table.

Constants§

DEFAULT_MIN_AGREEMENT
Default maximum allowed fraction of external call candidates that remain unresolved after the LSP pass. Default unresolved-ratio limit. Corpus externals are mostly third-party packages no LSP resolves without installs, so the default gate is conflicts-only (ratio limit 1.0 = never fails on third-party imports); the benchres fixture test exercises the strict ratio gate on an upgradeable repo.

Functions§

check_gate
The resolution benchmark gate (SCC-126): at least one upgrade across the corpus, and fewer than min_agreement (default 0.30) of external call candidates left unresolved.
collect_external_edges
Collect every EXTRACTED calls edge currently in the store, with the evidence-derived callee/line needed for conflict records.
diff_repo
Full differential for one fixture repo: index, run the LSP pass, diff, and persist resolution-conflict drift findings. Skips the LSP pass gracefully when pyright is not installed.
diff_upgrades
Diff the post-LSP store against pre-LSP EXTRACTED edges: every RESOLVED edge whose evidence id matches a captured EXTRACTED edge is an upgrade. Returns (source file, upgrade record) pairs.
print_summary
run_resolution_benchmark
Run the differential resolution benchmark over every repo referenced in benchmarks/tasks.json and apply the gate.