feat(driver): add explicit source provider boundary - #247
Conversation
Add a Wright-owned entry and invocation-context seam for provider-backed OPY workflows. Preserve canonical Workshop handoff, structured provider failures, and explicit artifact provenance without a native fallback. The current LPP v1 cannot carry an entry target, so protocol entry/project loading remains a follow-up before wiring the concrete LPP adapter. Refs #243
Teakowa
left a comment
There was a problem hiding this comment.
Major — crates/wright-driver/src/source_provider.rs (SourceCompilation)
The product seam cannot carry the source provenance required by #243. It returns diagnostics + canonical Workshop text + locale only, while Loaded::provenance collapses every provider result to ProviderArtifact and all Wright findings become <provider-artifact>. #243 explicitly owns the canonical Workshop + truthful source-provenance contract that #246 is supposed to consume, so #246 would have to redesign this public seam instead of only wiring lint/analyze. Add the approved provenance/unmapped contract to the boundary before merging.
Major — crates/wright-driver/src/session.rs (load_from_source_provider)
Provider-backed OPY stdin is silently converted into a filesystem entry named <stdin>. input::resolve reads the actual stdin text, but SourceTarget discards it and the provider receives ${cwd}/<stdin>, so this path can never represent the user's source. The approved #243 seam is entry-based; reject provider-backed stdin explicitly with a structured diagnostic rather than fabricating an entry path.
Major — crates/wright-driver/src/session.rs (load_from_source_provider Workshop handoff)
Errors while parsing provider-returned canonical Workshop are passed to workshop_diag(error, resolved). workshop_diag stamps Workshop spans with resolved.display, which is the original OPY entry, so a malformed/generated Workshop artifact is falsely reported at OPY source coordinates. Attribute canonical-artifact parse/validation failures to the provider artifact/unmapped provenance instead of the authored OPY path.
Carry explicit mapped or unmapped provenance through the provider boundary and attribute unmapped canonical-artifact diagnostics to the artifact identity. Reject provider-backed stdin before input resolution so the provider never receives a fabricated entry path. Add regression coverage for provenance, artifact diagnostics, and stdin refusal. Refs #243
Teakowa
left a comment
There was a problem hiding this comment.
Major — crates/wright-driver/src/source_provider.rs (SourceProvenance / SourceCompilation)
The previous provenance finding is only partially fixed. Mapped is a flag, but the seam still carries no mapping from canonical Workshop file/span identities to authored OPY source identities/ranges. Consequently resolve_finding_span_paths treats a Mapped provider artifact as if its Workshop file ids already referred to the original source tree, which the boundary cannot establish. #243 requires sufficient truthful provenance for Wright-owned findings where mapping is supported. Carry the actual mapping contract (or keep the result explicitly unmapped); do not expose a Mapped state that cannot be consumed truthfully.
Remove the unimplemented mapped provenance state so the provider seam cannot claim canonical Workshop spans map to authored OPY ranges without carrying real mapping data. Refs #243
Summary
Validation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --all-targets --all-featurescargo test -p wright-driver --test source_provider -- --nocapturegit diff --checkScope
This implements the Wright-owned boundary for #243. The concrete LPP adapter is intentionally not included: current LPP v1 cannot carry an entry target, and protocol entry/project loading remains tracked by language-provider-protocol#16. Follow-up provider resolution and workflow wiring remain in #244, #245, and #246.
Refs #243