Repository navigation
chore(architecture): warn when oversized source files grow - #2556
Merged
Merged
Conversation
The architecture checker only limited two facade files and newly added TypeScript files, so existing God Modules such as the agent runtime, host-core RPC dispatch, and session service kept growing unnoticed. The documented hotspot list also pointed at modules that were already split. The checker now compares every production TS/TSX file above 800 LOC and Rust file above 1000 LOC with its size at the merge base and reports growth as a CI warning annotation. Replaying the last 40 merges showed a hard gate would block about half of all pull requests, so failing is opt-in through ARCHITECTURE_STRICT_GROWTH=1. Tests, fixtures, locales, and changelog catalogs are excluded. The AGENTS.md / CLAUDE.md hotspot list now names the modules that are actually growing.
Deploying pi-desktop with
|
| Latest commit: |
4e4c404
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fd88d2b3.pi-desktop.pages.dev |
| Branch Preview URL: | https://chore-architecture-ratchet.pi-desktop.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
scripts/check-architecture.mjsonly cappedelectron/main/index.ts,app-store.ts, and newly added TS files. Existing God Modules kept growing with no signal (last 90 days:runtime.ts9190→10218,rpc/mod.rs10365→11739,sessions.rs8521→9408). The AGENTS.md/CLAUDE.md hotspot list named modules that were already split (ChatTranscript.tsxis 1 line;plugins.rs/db.rs/providers.rs/plans.rsare <100).What
scripts/architecture-growth.mjs(pure rules) +architecture-growth.test.mjs: a production TS/TSX file >800 LOC or Rust file >1000 LOC must not grow past its size at the merge base. Tests, fixtures, E2E,.d.ts, i18n locales, and changelog catalogs are excluded; new files stay under the existing new-file rules;allowlist.jsongains an optional reasonedgrowthexemption.check-architecture.mjsreports growth as a GitHub::warningannotation. Non-blocking by default;ARCHITECTURE_STRICT_GROWTH=1makes it fail.2026-11-24.1. Architecture README, repo-structure spec, and ADR-0235 synced.Why warning-only
Replaying the last 40 merges on
main, 20 would have tripped the rule, including +2-line fixes. A hard gate would disrupt the current contribution flow, so it starts as a visible signal.Compatibility
No product code, runtime behavior, contracts, or existing failure conditions change. Existing checks keep their exit behavior.
Validation
node --test scripts/architecture-growth.test.mjs: 6/6 passnode scripts/check-architecture.mjs --base origin/main: passes, 0 growthruntime.ts): warning + annotation, exit 0; withARCHITECTURE_STRICT_GROWTH=1, exit 1pnpm check:agent-policy,check:pr-base,biome linton changed scripts: pass