Skip to content

style: cargo fmt backlog from the CI-allowlist outage#5260

Merged
proggeramlug merged 2 commits into
mainfrom
fix/ci-fmt-backlog
Jun 16, 2026
Merged

style: cargo fmt backlog from the CI-allowlist outage#5260
proggeramlug merged 2 commits into
mainfrom
fix/ci-fmt-backlog

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What

cargo fmt --all over 12 files that landed unformatted on main during the CI-allowlist outage this morning. Pure rustfmt reflow — semantics-preserving (mostly wrapping long crate::UnimplementedDecision::DeferToRuntimeError(…) match arms). Code-only; no version bump / changelog (maintainer to fold in at merge).

Why

The Tests workflow was in startup_failure from ~02:43 UTC on 2026-06-16: ci(test): add sccache (#5221) referenced mozilla-actions/sccache-action, which wasn't on the repo's selected allowed-actions list, so every Tests run failed at startup before any job — including lint — could run. Several PRs (#5206, #5230, #5235, …) squash-merged in that window with unformatted Rust, making cargo fmt --all -- --check fail on the merge ref of every open PR (e.g. #5250) even when the PR head was clean.

The allowlist was fixed separately (mozilla-actions/sccache-action@* added), restoring Tests startup.

Note — separate blocker

lint also has a File size limit step (2000-line cap). crates/perry/src/commands/compile/collect_modules.rs is 2002 lines on main (also merged unformatted/oversized during the outage) and trips it. That's independent of formatting and needs its own fix (split the file or allowlist it) — not included here.

Summary by CodeRabbit

  • New Features

    • Improved JS/TS module import discovery during compilation, including better handling of relative/absolute specifiers and support for node: submodules via a minimal runtime surface.
  • Refactor

    • Reformatted “unimplemented API” handling and related lowering logic without changing runtime behavior.
    • Restructured module collection/wasm asset stubs formatting without changing behavior.
  • Tests

    • Updated several assertions and predicates for readability (no expectation changes).
  • Style

    • Broad code formatting cleanups across multiple modules.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Introduces import-resolution and module-classification helpers (env_defines_for_lowering, collect_js_module_imports, ResolvedImport, lexical-vs-canonical resolution) in a new import_helpers.rs module. Updates collect_modules.rs to use these helpers. Applies cargo fmt --all reflow across 10 other Rust source and test files without changing logic or behavior.

Changes

Import Helper Utilities

Layer / File(s) Summary
Environment and import discovery
crates/perry/src/commands/compile/collect_modules/import_helpers.rs
env_defines_for_lowering filters process.env.* compile-time defines into perry_hir::EnvDefine format; collect_js_module_imports scans source with cached regexes for static import/export ... from and dynamic import(...) calls, resolves relative/absolute specifiers to filesystem paths, and returns a deduplicated canonical-path list.
Import resolution and Node.js submodules
crates/perry/src/commands/compile/collect_modules/import_helpers.rs
ResolvedImport struct holds canonical path, source-visible path, and ModuleKind; lexical-vs-canonical resolution helpers (cached_resolve_import_with_lexical_base, cached_resolve_import_from_base, source_visible_resolved_path) handle symlinks and canonical discrepancies; known_node_submodule_key maps node: specifiers to Perry runtime submodule keys.

Module Collection Integration

Layer / File(s) Summary
Imports and module structure
crates/perry/src/commands/compile/collect_modules.rs
Narrows perry_hir import to ModuleKind only (drops Expr/Stmt), limits std::path to PathBuf only, reorders internal module declarations so test cfg precedes wasm_asset, reformats import_helpers use block, and rewraps dynamic-import error-location path logic.

rustfmt Reflow

Layer / File(s) Summary
rustfmt reflow across all source and test files
crates/perry-hir/src/eval_classifier.rs, crates/perry-hir/src/lower/expr_call/module_class_static.rs, crates/perry-hir/src/lower/expr_call/native_module.rs, crates/perry-hir/src/lower/expr_call/nested_namespace.rs, crates/perry-hir/src/lower/expr_member.rs, crates/perry-hir/tests/export_var_uninitialized_lowering.rs, crates/perry-hir/tests/unimplemented_api_check.rs, crates/perry-runtime/src/buffer/header.rs, crates/perry-stdlib/src/readline.rs, crates/perry/src/commands/compile/collect_modules/wasm_asset.rs, crates/perry/src/commands/lower_diagnostic.rs
Multi-line argument lists, let assignments, match arms, closures, and assert! calls reflowed by rustfmt; no values, conditions, control flow, or logic changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PerryTS/perry#5232: Implements the cooked-mode flowing data delivery via STDIN_DATA_FLOWING in readline.rs — the same conditional and js_readline_has_active logic this PR reformats.
  • PerryTS/perry#5241: Adds the uninitialized export var lowering regression tests in export_var_uninitialized_lowering.rs — the same test predicates and assertions this PR reformats.

Poem

🐇 A rabbit hops through module rows,
With import helpers, knowledge flows,
Then rustfmt tidies line by line,
Paths resolve—where symlinks twine,
The warren's structure clean and fine! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the PR's main objective: applying cargo fmt formatting to files that were merged unformatted during the CI allowlist outage.
Description check ✅ Passed The PR description includes a clear summary of what (cargo fmt on 12 unformatted files), why (CI outage caused lint to skip), and notes the file-size limit blocker separately. However, it does not explicitly follow the template's bullet-list Changes section or test-plan checklist structure.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-fmt-backlog

Comment @coderabbitai help to get the list of available commands and usage tips.

cargo fmt --all over 12 files that merged unformatted on main while the
Tests workflow was in startup_failure (the sccache action #5221 wasn't on
the repo's allowed-actions list, so every Tests run failed at startup and
the lint gate never ran). Pure rustfmt reflow, semantics-preserving.
@proggeramlug proggeramlug changed the title style: cargo fmt backlog from the CI-allowlist outage (v0.5.1176) style: cargo fmt backlog from the CI-allowlist outage Jun 16, 2026
…ules

collect_modules.rs was 2002 lines — 2 over the lint file-size cap (it
crossed the line during the CI-allowlist outage when the gate wasn't
running). Move the cohesive import-helper cluster (env_defines_for_lowering,
collect_js_module_imports, ResolvedImport + the cached_resolve_*/
source_visible_resolved_path resolvers, known_node_submodule_key) into a
new collect_modules/import_helpers.rs submodule. Pure code-move, no behavior
change; collect_modules.rs is now 1787 lines. 25 collect_modules tests pass.
@proggeramlug proggeramlug merged commit b5c9da1 into main Jun 16, 2026
14 of 15 checks passed
@proggeramlug proggeramlug deleted the fix/ci-fmt-backlog branch June 16, 2026 11:08
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