Skip to content

refactor(compile): split native-manifest parsing out of resolve.rs (unblock lint)#1948

Closed
proggeramlug wants to merge 1 commit into
mainfrom
worktree-split-resolve-rs
Closed

refactor(compile): split native-manifest parsing out of resolve.rs (unblock lint)#1948
proggeramlug wants to merge 1 commit into
mainfrom
worktree-split-resolve-rs

Conversation

@proggeramlug
Copy link
Copy Markdown
Contributor

Summary

crates/perry/src/commands/compile/resolve.rs had grown to 2168 lines, over the 2000-line check_file_size.sh cap and without an allowlist entry — so the lint required gate was red on main and on every open PR (e.g. #1940). This splits it back under the cap.

What changed

Extracts the self-contained native-library manifest parsing family out of resolve.rs into a new sibling module resolve/native_manifest.rs:

  • has_perry_native_library / has_perry_native_module
  • parse_native_library_manifest + its ABI / POD / backend / target-config descriptor parsers
  • the optional_* / parse_optional_* field helpers, per-arch target-key + prebuilt-path resolution
  • validate_abi_version / PERRY_FFI_ABI_VERSION

The module/import resolution logic (resolve_import & friends) and find_perry_workspace_root stay in resolve.rs. The moved symbols are re-exported from resolve.rs so all callers (compile.rs, collect_modules.rs, lock_scan.rs, the native_library sibling, and the test module) keep reaching them via the resolve:: path.

Pure refactor — no behavior change.

Result

File Before After
resolve.rs 2168 851
resolve/native_manifest.rs 1346
  • ./scripts/check_file_size.shOK: no Rust source files exceed 2000 lines.
  • cargo build --release -p perry → green
  • cargo test --release -p perry resolve:: → 41 passed, 0 failed
  • cargo fmt --all -- --check → clean

resolve.rs had grown to 2168 lines (over the 2000-line file-size CI cap,
without an allowlist entry), turning the `lint` gate red on main and on
every open PR.

Extract the self-contained `perry.nativeLibrary` / `nativeModule` manifest
parsing family — `has_perry_native_library`, `has_perry_native_module`,
`parse_native_library_manifest` and its ABI / POD / backend / target-config
descriptor parsers, the per-arch target-key + prebuilt-path helpers, and
`validate_abi_version` — into a new sibling module `resolve/native_manifest.rs`.
The symbols are re-exported from `resolve.rs` so all callers keep reaching
them via the `resolve::` path; no behavior change.

resolve.rs: 2168 -> 851 lines; native_manifest.rs: 1346 lines. Both under
the cap. `cargo test -p perry resolve::` (41 tests) passes.
@proggeramlug
Copy link
Copy Markdown
Contributor Author

Closing as redundant — superseded by #1925 (fix(node:stream): consolidate destroy state), which already extracted the native-library manifest parsing out of resolve.rs (into resolve/native_library.rs) and re-exported it.

On current main (1f2dca2) resolve.rs is 848 lines and the file-size gate passes, so this split is no longer needed. The lint breakage that motivated this PR is resolved on main; the camera PR (#1940) just needs a rebase onto current main to pick it up.

@proggeramlug proggeramlug deleted the worktree-split-resolve-rs branch May 27, 2026 07:00
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