fix(opy): converge project preprocessing composition - #164
Conversation
Teakowa
left a comment
There was a problem hiding this comment.
Major — crates/opy-rs/src/preprocess.rs:393
display_path canonicalizes/collapses .. components, so distinct overlay imports can be registered under the same HIR path. The existing alias_include_paths_are_distinct_imports case (shared.opy vs dir/../shared.opy) now produces two file IDs both named shared.opy, even though the overlays may contain different source. That breaks the cross-file provenance AC. Preserve a stable path identity that does not merge distinct imported sources.
Major — crates/opy-rs/src/preprocess.rs:761
resolve_script resolves the script against the definition file but stores the original declared path in ScriptMacro. Runtime errors therefore attribute a nested macro such as modules/nested/scripted.opy -> scripts/add.js only to scripts/add.js; two definition directories using the same relative script name become indistinguishable. The pinned OverPy reference stores the resolved getFilePaths(..., basePath)[0] path. Store/use the resolved project-relative path for runtime/diagnostic provenance.
Addresses review feedback on #164
Summary
__script__macro files relative to their definition file and honor open-document overlaysFixes #161
Validation
cargo fmt --all -- --checkcargo clippy --locked --workspace --all-targets --all-features -- -D warningscargo test --locked --workspace --all-targets --all-featurespython3 -m unittest discover -s compatibility/tests