Skip to content

feat(cli): --include-dependencies upgrades and validates the import closure#27

Merged
banteg merged 13 commits into
masterfrom
issue-23-include-dependencies
Jul 16, 2026
Merged

feat(cli): --include-dependencies upgrades and validates the import closure#27
banteg merged 13 commits into
masterfrom
issue-23-include-dependencies

Conversation

@charles-cooper

Copy link
Copy Markdown
Member

co-authored by claude opus 4.8

This adds opt-in --include-dependencies (with --upgrade-closure as an alias) so resolved .vy and .vyi dependencies join the migration batch and are cross-validated against the upgraded closure. Dependency results participate in --check, --diff, and report schema v2, but dependency sources are never written in place. --write with closure upgrades is rejected until a closure destination is supplied, and import-layout conflicts are reported as usage errors.

Stacked on: issue-23-overlay-closure-mode. This is part of the stacked series implementing issue #23.

Tests: CLI and engine unit tests, real-compiler integration tests, and the full test suite are green.

Extract the validation BFS (_walk_validation_sources) and overlay-root
computation (_overlay_roots) so one traversal both copies overlay sources
and returns the resolved import closure. Add public ImportClosure +
resolve_import_closure, split materialize_target_overlay out of
target_overlay (writes into a caller-owned root), and make
engine.candidate_sources public. Fix _copy_project_configs recursion when
the destination is nested under the project root.

Foundation for opt-in dependency-closure upgrade (#23); exposes the
resolved closure needed by #22.
Add a keyword-only include_dependencies flag to target_overlay and
materialize_target_overlay. In closure mode the full import closure --
including external configured-search-path dependencies -- is materialized
import-root-relative (e.g. <root>/snekmate/utils/math.vy), overlay.paths
maps every closure member, and source_roots becomes the import roots so
target compiles resolve strictly against the materialized tree. A
destination-collision ledger dedupes identical bytes and raises
OverlayLayoutConflictError on genuine ambiguity; the default path stays
byte-identical to prior behavior.

Foundation for --include-dependencies (#23).
…losure

Add opt-in --include-dependencies (alias --upgrade-closure). Resolved
.vy/.vyi closure members become dependency-role migration requests in the
shared batch; the engine runs the shared target overlay in closure mode so
dependencies cross-validate against each other's upgraded bytes. Dependency
sources are structurally excluded from the migration plan and never written
in place. Report schema v2 adds files[].role and a top-level closure block;
--check/--diff cover dependencies; --write with --include-dependencies exits
4 until a closure destination exists; import layout conflicts exit 4. A
read-only dependency source no longer crashes the final-newline retry.

Part of opt-in dependency-closure upgrade (#23).
@banteg
banteg changed the base branch from issue-23-overlay-closure-mode to master July 16, 2026 19:53
@banteg
banteg merged commit 039ffba into master Jul 16, 2026
3 checks passed
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.

2 participants