Skip to content

chore: simplify file-size check to a flat 1000-line limit#839

Merged
wesbillman merged 1 commit into
mainfrom
brain/clean-up-filesizes
Jun 3, 2026
Merged

chore: simplify file-size check to a flat 1000-line limit#839
wesbillman merged 1 commit into
mainfrom
brain/clean-up-filesizes

Conversation

@wesbillman

Copy link
Copy Markdown
Collaborator

Summary

Simplify the file-size check to a flat 1000-line limit and replace the per-file override sprawl with a single shared implementation.

The previous 500-line limit had accumulated ~50 grandfathered overrides in desktop, each with a paragraph of justification — the escape hatch had become the norm rather than the exception. This raises the floor to a level where overrides are genuinely rare.

Changes

  • scripts/check-file-sizes-core.mjs (new) — shared walk/count/violation/exit logic at the repo root, owned by neither app. Desktop and web both import it so the two checks can't drift. Also folds in the missing-root-dir guard that previously only web had.
  • desktop/scripts/check-file-sizes.mjs → thin config (rules + 7 TEMP overrides).
  • web/scripts/check-file-sizes.mjs → thin config (rules only, no overrides).

Behavior

  • Flat 1000 lines per rule. No warnings, no two-tier.
  • Desktop overrides: ~50 → 7. The 7 remaining are the only files genuinely over 1000, kept as TEMP entries (at current line count) and marked "split me, don't add to this list." They're a deferred backlog to split in a follow-up.
  • Web: zero overrides.

Verification

  • pnpm -r check green — biome clean (566 desktop + 53 web files) + both size checks pass on a clean tree.
  • Pre-push suite green: desktop-test, rust-clippy, desktop-tauri-test, mobile-test, rust-tests, desktop-tauri-clippy.
  • Negative test against a fixture: a 1001-line file fails at limit 1000 (exit 1, correct message); an override'd file at its exact count is tolerated. The check still bites.

Follow-up

Split the 7 oversized files: nest.rs, runtime.rs, huddle/tts.rs, tauri.ts, nostr_convert.rs, relayClientSession.ts, migration.rs.

Replace the homegrown per-file override sprawl with a single shared
check. The 500-line limit had grown ~50 grandfathered overrides in
desktop, turning the escape hatch into the norm.

- Extract the walk/count/violation logic into a shared core at
  scripts/check-file-sizes-core.mjs; desktop and web now import it so
  the two checks can't drift. The core also guards missing root dirs
  (previously only web did).
- Raise the limit to a flat 1000 per rule. No warnings, no two-tier.
- Drop all overrides except the 7 desktop files that genuinely exceed
  1000; those stay as TEMP entries (at current line count) to be split
  in a follow-up. Web has no overrides.

pnpm -r check is green: biome clean + both file-size checks pass.

Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
@wesbillman wesbillman requested a review from a team as a code owner June 3, 2026 23:22

@wpfleger96 wpfleger96 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

😍

@wesbillman wesbillman merged commit 0c225f4 into main Jun 3, 2026
15 checks passed
@wesbillman wesbillman deleted the brain/clean-up-filesizes branch June 3, 2026 23:40
wpfleger96 added a commit that referenced this pull request Jun 4, 2026
mergeDetails unconditionally overwrote memberCount with
details.memberCount, which is always 0 — ChannelDetails is built from
kind:39000 metadata that carries no member information. The batch
kind:39002 fetch in channelsProvider correctly populates the count, but
mergeDetails clobbered it before the UI rendered. Preserve the base
channel's memberCount instead.

Also restores desktop/scripts/check-file-sizes.mjs to main's simplified
format — rebase replayed branch commits that modified the old per-file
overrides map, re-introducing the pre-#839 format.
michaelneale added a commit that referenced this pull request Jun 4, 2026
* origin/main: (36 commits)
  fix: use immutable commit-SHA URLs in screenshot PR comments (#842)
  feat(mobile+desktop): two-tier Slack-style app icon badge (#802)
  chore: simplify file-size check to a flat 1000-line limit (#839)
  fix(desktop): robust emoji picker — unify picker + fix custom emoji in editing, status, reactions (#837)
  feat(desktop): reusable screenshot workflow for agents (#826)
  desktop(mesh-llm): let a serving node route a different model (#833)
  chore(release): release version 0.3.9 (#832)
  fix: native arbitrary-file download + image context-menu flash (#830)
  fix(desktop): custom emoji reaction rendering + picker autofocus (#831)
  Mesh-LLM v1: relay-gated direct-iroh inference between users (WAN) (#822)
  chore(release): release version 0.3.8 (#829)
  chore(release): release version 0.3.7 (#825)
  feat: code block rendering, syntax highlighting, and compose fixes (#803)
  feat: custom emoji — user-owned NIP-30 sets with a client-side union (#816)
  Install sprout-cli skill at repo root + fix desktop clippy (#818)
  fix(desktop): use public re-export path for ensure_client_node_for_model (#824)
  refactor(desktop): feature-gate mesh-llm-sdk behind optional Cargo feature (#823)
  fix(desktop): align workflow read/save commands to the frontend contract (#820)
  fix(desktop): disable mesh-llm auto-build to prevent git config corruption (#819)
  fix(desktop): clear clippy lints in agents/mesh_llm commands (#817)
  ...

# Conflicts:
#	Cargo.lock
#	desktop/scripts/check-file-sizes.mjs
#	desktop/src-tauri/Cargo.toml
#	desktop/src/app/AppShell.tsx
#	desktop/src/app/AppTopChrome.tsx
#	desktop/src/features/messages/hooks.ts
#	desktop/src/features/workspaces/useWorkspaceInit.ts
#	desktop/src/shared/api/tauri.ts
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