Skip to content

Remove the now-unreachable retained-source validation fallback in session.rs #626

Closed

Description

@e54-bot

#583 added a recovery fallback to the provider-artifact load in crates/wright-driver/src/session.rs: when program.validate() fails while retained member sources are attached, the session re-parses the artifact without retained text, re-applies the source map, re-validates, and downgrades to a source-map-span-overflow warning so the load still serves.

#624 / #625 bumped workshop-rs to 1.16, whose Program::set_file_source prunes provenance spans that do not resolve in the attached document. With that in place the fallback's recovery path is unreachable:

  • SourceMap::apply writes spans only into program.provenance (crates/workshop-rs/src/program/source_map.rs).
  • set_file_source attaches the member text and calls prune_spans_outside for that file — exactly the spans that could fail the source audit (crates/workshop-rs/src/program.rs).
  • Program::validate() → to_wir() copies surviving provenance spans onto WIR nodes; check_span in crates/workshop-rs/src/wir/validate.rs is the only source-dependent check (byte_range), and it only fires on a span pruning already removed. Spans on files with no retained source skip the audit.
  • Any remaining validate() failure is source-independent, so the unretained re-parse fails identically and the branch can only re-surface the same error — never recover.

Empirically: overwatch-ai-pve, the corpus project that used to emit the warning, now loads with diagnostics: 0 on check/lint/analyze/compile; the metrics baseline was updated in #625.

Scope

Delete the unretained re-parse + source-map-span-overflow block in session.rs and return the validation error directly; sweep git grep source-map-span-overflow for the test/doc mentions the warning leaves behind.

Refs #583, #624, #625

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2rustPull requests that update rust code

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions