Skip to content

refactor(moonutil): convert package DSL directly to MoonPkg - #2238

Merged
peter-jerry-ye merged 2 commits into
mainfrom
Yu-zh/direct-dsl-package
Sep 21, 2026
Merged

peter-jerry-ye merged 2 commits into
mainfrom
Yu-zh/direct-dsl-package

Conversation

@Yu-zh

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

Copy link
Copy Markdown
Contributor

moon.pkg conversion currently reconstructs a MoonPkgJSON before producing MoonPkg, coupling DSL conversion to the legacy JSON package schema. Decode the normalized DSL fields directly into MoonPkg, while retaining the existing Dsl representation and the separate converter for moon.pkg.json.

Normalize declarations and legacy option overrides in one helper, then read the resulting map immutably. Field decoding deserializes borrowed values and preserves option aliases, type checks, and duplicate-field errors. Share package-kind resolution, formatter defaults, import warnings, and rule validation between the two converters.

Compatibility tests compare package values, supported-target declaration metadata, and warnings across equivalent DSL and JSON inputs.

Validation:

  • cargo test --locked -p moonutil: 293 passed; one existing ignored doctest.
  • test_moon_pkg_normalizes_import_blocks: actual Wasm execution and generated-C dry-run coverage.
  • cargo clippy -p moonutil --locked --all-targets --all-features -- -D warnings.
  • cargo fmt --all -- --check and git diff --check.

@semanticdiff-com

semanticdiff-com Bot commented Sep 20, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  crates/moonutil/src/moon_pkg/parser.rs  29% smaller
  crates/moonutil/src/package.rs  9% smaller
  docs/dev/reference/modules-packages.md Unsupported file format

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 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-20T08:40:33.053659Z 398265e Draft marked ready
ℹ️ 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 marked this pull request as draft September 20, 2026 07:07
@Yu-zh
Yu-zh marked this pull request as ready for review September 20, 2026 08:37
@Yu-zh
Yu-zh force-pushed the Yu-zh/direct-dsl-package branch from 398265e to 89baf09 Compare September 21, 2026 04:01
@peter-jerry-ye
peter-jerry-ye merged commit 5074ba8 into main Sep 21, 2026
12 checks passed
@peter-jerry-ye
peter-jerry-ye deleted the Yu-zh/direct-dsl-package branch September 21, 2026 04:13
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