Skip to content

fix: analyze include roots as fragments - #166

Draft
evanbrobertson wants to merge 1 commit into
masterfrom
fix/fragment-root-analysis
Draft

fix: analyze include roots as fragments#166
evanbrobertson wants to merge 1 commit into
masterfrom
fix/fragment-root-analysis

Conversation

@evanbrobertson

Copy link
Copy Markdown
Contributor

Closes #158.

What changed

  • classify an explicitly opened .i root as an include fragment across the shared pipeline, CLI, and LSP
  • reclassify only includer-dependent unresolved names as external while preserving qualified class and literal RUN workspace misses
  • withhold LINT0002, LINT0005, and LINT0006 when their whole-compilation-unit counts are unavailable
  • keep parse, preprocessing, schema-backed, type, and other locally provable diagnostics active
  • expose the reduced coverage through the CLI and analyze envelope
  • add shared parity coverage for root-file identity, including explicit browser capability handling

Why

An .i file is a textual fragment. When opened directly, declarations, imports, scopes, reads, and writes supplied by its includer are absent. Treating that fragment as a complete compilation unit produced large waves of false undefined-symbol, unused-variable, and dead-store findings in the editor.

The root cause was not a different lint implementation in the LSP: every client shares the same pipeline, but the editor can feed that pipeline an .i as a root while directory discovery deliberately feeds the CLI only complete root extensions.

Impact

Directly opened include fragments now provide useful but explicitly reduced diagnostics. The same .i expanded through a .p, .w, .cls, or .v remains part of an ordinary complete-unit analysis with all rules enabled.

On the reported include, the merge-base produced 57 false lint findings (44 undefined symbols, 5 unused variables, and 8 dead stores); this branch produces none. A deterministic sample of 50 include roots fell from 684 findings to one locally provable type mismatch. An A/B over 10,482 ordinary roots produced byte-identical JSON and stderr, confirming that complete-unit behavior did not move.

Verification

  • cargo fmt --all -- --check
  • cargo check --workspace --all-targets
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace
  • deterministic merge-base versus candidate corpus A/B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lint: an include fragment analyzed as a root reports every symbol its includer supplies as undefined

1 participant