Repository navigation
Description
Problem
Oversized files are where this repo's bug chains concentrate, and they are disproportionately expensive for agents (a file that doesn't fit in one read multiplies every navigation and edit). Evidence: the two files at the center of the week's churn are RealtimeHubController.swift (4,949 lines, 121 touches/month) and chat_completions.rs (3,309 lines, 10 commits/week, split tracked in #9836). But they are not outliers — current counts in product source (tests and generated files excluded):
6500 desktop/macos/Desktop/Sources/APIClient.swift
6012 desktop/macos/Desktop/Sources/Providers/ChatProvider.swift
5401 desktop/macos/Desktop/Sources/MainWindow/Pages/TasksPage.swift
4949 desktop/macos/Desktop/Sources/FloatingControlBar/RealtimeHubController.swift
4832 desktop/macos/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift
4430 desktop/macos/Desktop/Sources/MainWindow/Pages/DashboardPage.swift
4129 desktop/macos/Desktop/Sources/Chat/AgentRuntimeProcess.swift
4101 desktop/macos/Desktop/Sources/DesktopAutomationBridge.swift
3355 desktop/macos/Desktop/Sources/Rewind/Core/RewindDatabase.swift
3309 desktop/macos/Backend-Rust/src/routes/chat_completions.rs
3110 backend/routers/transcribe.py (backend/AGENTS.md still says "2900 LOC")
#9836 fixes exactly one of these retail. Nothing stops the others from growing, or new ones from forming. The repo already ratchets one specific file (check-hub-controller-ratchet.py) — per the shared-boundary rule, two instances of the same guard means the class wants one general mechanism.
Fix: per-file line-count ratchet, one PR
A no-increase ratchet, same family as the existing ratchet scripts:
- Scope:
*.swift,*.rs,*.pyproduct source underdesktop/macos/,backend/— excluding tests,Generated/,*.gen.*/*.g.*, and vendored/venv paths. - Rule: a file at or over the threshold (1,500 lines) may not gain lines relative to its committed baseline; files under the threshold may not cross it. Shrinking a file automatically lowers its baseline (ratchet-down on every run that observes a smaller count).
- Baseline: a checked-in JSON snapshot (current counts), regenerated only downward by the check itself. Raising a baseline requires editing the file in the PR diff — visible, reviewable, and exceptional by construction.
- Registration:
.github/checks-manifest.yaml, bothlocalandcilanes, diff-scoped (only changed files are evaluated, so the check is fast and only fires when someone actually touches a god file). - Absorb the precedent: fold
check-hub-controller-ratchet.py's size-related assertions into this check where they overlap, per the single-owner rule (its non-size assertions stay). - Failure message names the escape hatches in order of preference: split the file (an over-threshold file you must grow is the trigger to split it — Split chat_completions.rs into routes/chat/ along its real seams — move-only, streaming closure intact #9836 is the worked example), or raise the baseline explicitly in the diff with a one-line justification.
Real instances this check would have flagged (cite them in the manifest entry's reason field — note: the manifest loader consumes id/command/triggers/lanes/reason only, there is no dedicated citation field): #9836's file grew to 3.3k across the PRs that also introduced its bug collisions (#9384/#9638/#9692 all landed inside it); transcribe.py silently outgrew its documented size; RealtimeHubController.swift accumulated to 4.9k across the FC-5 chain.
Proof
- Check fails on an adversarial diff growing an over-threshold file, passes on a shrinking one, and auto-lowers the baseline after a split.
- The manifest entry's
reasonfield cites the instances above. - Baseline JSON committed with current real counts — the check is green on
mainat merge.
Cut list
- No file is split in this PR — the ratchet freezes growth; splits happen where the trigger fires (or via Split chat_completions.rs into routes/chat/ along its real seams — move-only, streaming closure intact #9836-style issues).
- No function-length/complexity metrics — line count is crude but ungameable and zero-judgment; complexity metrics invite threshold-tuning debates.
- No Dart/TS coverage initially — focus areas first; extend when a hot instance appears there.
Sizing
One PR: one script (~100 lines), baseline JSON, manifest entry, absorption of the overlapping single-file ratchet.
Activity
build(quality): ratchet oversized product source files (#9851)
refactor: split oversized product source files (#9853)
chore(backend): keep the language response models out of the frozen u…
fix(desktop): keep deleted-lane tasks retired so they stop resurfacin…
fix(desktop): keep deleted-lane tasks retired so they stop resurfacin…
fix(desktop): keep deleted-lane tasks retired so they stop resurfacin…
feat(desktop): port mobile General Summary app picker to conversation…
feat(app): add Omi button action toggle (#11193)
build(quality): ratchet oversized product source files (BasedHardware…
Harden phone capture against silent audio loss (#20902)
fix: preserve owner recognition across rollover and fragmented speech (…