Skip to content

refactor: separate package discovery from solving - #2241

Merged
Yu-zh merged 2 commits into
mainfrom
Yu-zh/separate-package-discovery
Sep 21, 2026
Merged

Yu-zh merged 2 commits into
mainfrom
Yu-zh/separate-package-discovery

Conversation

@Yu-zh

@Yu-zh Yu-zh commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Package-selection helpers currently require ResolveOutput even when they only inspect module and package declarations. Introduce DiscoveredProject and separate discovery from package dependency solving for normal and single-file projects. Declaration-only helpers now accept this type; ResolveOutput owns it alongside the existing single dependency graph.

Capture the coverage setting during discovery so source injection and graph solving stay consistent. The existing resolution entry points still complete both phases before command selection and planning, preserving command behavior and dependency-error ordering. This extracts a prerequisite from #2220; conditional-import behavior stays in that feature PR.

Add a regression test demonstrating that package selection works on declarations with an unresolved import, which is rejected when solving the graph. Existing snapshots are unchanged.

Validation

  • cargo test --locked -p moonbuild-rupes-recta: 99 passed.
  • Focused moon tests: 58 unit tests and 15 integration tests passed, covering planner snapshots, package selection, prebuild watch paths, coverage, alias/cycle diagnostics, package-tree output, and single-file resolution.
  • Actual execution verified with Wasm projects and scripts. C/native checks used dry-runs only.
  • cargo clippy --workspace --exclude moonrun --locked --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check and git diff --check

Metadata

  • Tests added/updated for bug fixes or new features
  • Compatible with Windows/Linux/macOS (no platform-specific behavior changes)

@semanticdiff-com

semanticdiff-com Bot commented Sep 21, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  crates/moon/src/cli/tree.rs  65% smaller
  crates/moon/src/cli/info/imp.rs  64% smaller
  crates/moon/src/rr_build/mod.rs  59% smaller
  crates/moon/src/cli/run.rs  59% smaller
  crates/moonbuild-rupes-recta/src/lib.rs  59% smaller
  crates/moon/src/cli/prove.rs  47% smaller
  crates/moon/src/cli/test.rs  43% smaller
  crates/moon/src/cli/check.rs  41% smaller
  crates/moonbuild-rupes-recta/src/build_lower/mod.rs  33% smaller
  crates/moonbuild-rupes-recta/src/compile/mod.rs  33% smaller
  crates/moon/src/cli/info.rs  25% smaller
  crates/moonbuild-rupes-recta/src/resolve/mod.rs  17% smaller
  crates/moon/src/filter.rs  12% smaller
  crates/moon/src/cli/build.rs  0% smaller
  crates/moon/src/cli/bundle.rs  0% smaller
  crates/moon/src/cli/doc.rs  0% smaller
  crates/moon/src/cli/tool/build_binary_dep.rs  0% smaller
  crates/moon/src/watch/prebuild_output.rs  0% smaller
  docs/dev/reference/modules-packages.md Unsupported file format

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-21T06:26:08.849141Z 4a21497 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Yu-zh
Yu-zh merged commit 6d52bff into main Sep 21, 2026
12 checks passed
@Yu-zh
Yu-zh deleted the Yu-zh/separate-package-discovery branch September 21, 2026 07:39
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.

1 participant