Skip to content

fix(lint): unbreak the 2000-line file-size gate on main - #7830

Merged
proggeramlug merged 3 commits into
mainfrom
fix/pre-scan-file-size
Aug 11, 2026
Merged

fix(lint): unbreak the 2000-line file-size gate on main#7830
proggeramlug merged 3 commits into
mainfrom
fix/pre-scan-file-size

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What

lint has been red on main since the 2026-08-11 batch: two files crossed the 2000-line cap that scripts/check_file_size.sh enforces.

file before after landed in
crates/perry-hir/src/lower/pre_scan.rs 1985 2011 #7828
crates/perry-runtime/src/gc/layout.rs 1982 2023 #7809 → 2010, #7812 → 2023

pre_scan.rs is my own regression from #7828 — CLAUDE.md warns about exactly this cap ("adding a long doc comment can trip it") and I did not run the script before pushing.

The split

Both are pure code moves. No logic changes, no behaviour changes.

pre_scan_weakref_localslower/pre_scan/weakref_locals.rs (1653 lines left behind). It is the cohesive unit to carve out: one of the file's three top-level pre-scans, owning its own five local sets, and the one #7828 grew.

LayoutSlotMask (enum + its whole impl) → gc/layout/slot_mask.rs (1807 lines left behind). One self-contained data type with its methods. Its visibility widens from pub(super) to pub(in crate::gc) purely because the type now sits one module deeper and layout_tables.rs / hot_tls.rs still name it — the reachable set is identical.

Validation

  • scripts/check_file_size.shOK: no Rust source files exceed 2000 lines. (was exit 1 on both files)
  • cargo check -p perry-hir -p perry-runtime clean; zero warnings introduced (the 19 that cargo check prints are pre-existing and all in files this PR does not touch)
  • cargo fmt --all -- --check clean
  • test_gap_proxy_local_name_collision_7775.ts (the fix(hir): a local named like a proxy local is not a proxy #7828 test whose code moved) still matches Node byte-for-byte

Summary by CodeRabbit

  • Refactor
    • Improved internal handling of weak-reference analysis and garbage-collection layout operations.
    • Maintained existing application behavior while improving code organization and maintainability.
  • Documentation
    • Added a changelog entry confirming compliance with the 2,000-line source-file size limit.

Two files crossed the cap in the 2026-08-11 batch and `lint` has been red
on `main` ever since:

  crates/perry-hir/src/lower/pre_scan.rs   1985 -> 2011  (#7828)
  crates/perry-runtime/src/gc/layout.rs    1982 -> 2023  (#7809, #7812)

Both are pure code moves, no logic change:

* `pre_scan_weakref_locals` and its doc comment move to
  `lower/pre_scan/weakref_locals.rs` (1653 lines left behind). It is the
  cohesive unit — one top-level pre-scan with its own five local sets —
  and it is where #7828 added the lines.

* `LayoutSlotMask` (the enum and its whole `impl`) moves to
  `gc/layout/slot_mask.rs` (1807 lines left behind). Its visibility widens
  from `pub(super)` to `pub(in crate::gc)` because the type is now one
  module deeper and `layout_tables.rs` / `hot_tls.rs` still name it; the
  reachable set is unchanged.

`scripts/check_file_size.sh` passes.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f918164b-9a9c-4e42-9cc1-3b498849671e

📥 Commits

Reviewing files that changed from the base of the PR and between a0e4505 and 8028773.

📒 Files selected for processing (1)
  • changelog.d/7830-file-size-gate.md

📝 Walkthrough

Walkthrough

The PR moves the weak-reference pre-scan and GC slot-mask implementations into dedicated Rust modules. It preserves existing behavior and internal access through re-exports. It also adds a changelog entry for the file-size lint gate.

Changes

Weak-reference local pre-scan

Layer / File(s) Summary
Weak-reference pre-scan extraction
crates/perry-hir/src/lower/pre_scan.rs, crates/perry-hir/src/lower/pre_scan/weakref_locals.rs
The pre-scan moves to weakref_locals.rs. The existing crate-visible function is re-exported. The module retains constructor tracking, recursive scanning, alias handling, shadowing detection, and ambiguity poisoning.

GC slot-mask extraction

Layer / File(s) Summary
GC slot-mask module and layout wiring
crates/perry-runtime/src/gc/layout.rs, crates/perry-runtime/src/gc/layout/slot_mask.rs, changelog.d/7830-file-size-gate.md
LayoutSlotMask moves to slot_mask.rs. The module supports inline, heap-backed, and all-pointer masks with mutation, queries, iteration, counting, and bounded lookup. layout.rs provides crate-visible access. The changelog records the file-size gate update.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • PerryTS/perry#7444: Splits oversized Rust files into focused submodules while preserving behavior and internal visibility.
  • PerryTS/perry#7812: Modifies GC layout mask handling, including LayoutSlotMask-related behavior.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: fixing the 2,000-line file-size lint gate.
Description check ✅ Passed The description explains the cause, code moves, behavior impact, and validation results, although it does not use the repository template headings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pre-scan-file-size

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@changelog.d/7830-file-size-gate.md`:
- Around line 3-23: Replace the narrative in the changelog entry with one
concise release-note statement describing the shipped fix: resolve the file-size
lint gate by moving the GC layout slot-mask implementation and weak-reference
pre-scan implementation into dedicated modules. Remove CI history, PR
references, line counts, and development guidance.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 475c3418-d304-4d88-81c3-6dc0dcd78847

📥 Commits

Reviewing files that changed from the base of the PR and between 1ee158d and a0e4505.

📒 Files selected for processing (5)
  • changelog.d/7830-file-size-gate.md
  • crates/perry-hir/src/lower/pre_scan.rs
  • crates/perry-hir/src/lower/pre_scan/weakref_locals.rs
  • crates/perry-runtime/src/gc/layout.rs
  • crates/perry-runtime/src/gc/layout/slot_mask.rs

Comment thread changelog.d/7830-file-size-gate.md Outdated
@proggeramlug
proggeramlug merged commit 82f0e96 into main Aug 11, 2026
1 of 19 checks passed
@proggeramlug
proggeramlug deleted the fix/pre-scan-file-size branch August 11, 2026 09:16
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