Repository navigation
Conversation
…f module combo.ts sits at 3640 lines against a frozen file-size ratchet of 3642. The gate is shrink-only, so ANY change that adds a line to this file is rejected -- including a one-line bug fix plus its explanatory comment. Two in-flight diegosouzapw#7847 fixes both hit this, and one shipped a violation because lint-staged's Prettier reflowed an unrelated over-long line (+4 lines) AFTER the gate had already been checked. Squeezing comments to fit is optimizing the wrong thing. This restores real headroom instead: the three 400-classification predicates are pure string classifiers over upstream error text, sharing the canonical pattern lists in accountFallback.ts, and have no business inside the routing loop. Moving them takes combo.ts to 3610 -- 30 lines of headroom. Behavior-preserving. The bodies were extracted from both revisions and compared after normalizing whitespace: 3 of 3 byte-identical. combo.ts imports them for the fallback guard and re-exports them, so the public surface is unchanged and tests/unit/combo-param-validation-fallback-4519.test.ts still imports them from combo.ts without modification (6/6 pass). Note for anyone repeating this: a bare re-export does not bind the name locally, so combo.ts's own use of the predicates needed a separate import. typecheck caught it.
|
Reviewed this in an isolated worktree against the actual PR head (7172e25). Verified mechanically, not by eye:
This looks solid and ready to merge as-is. Since #8558 is stacked on top of this commit, it'll need this one merged first. One coordination note before this merges. You have a third PR, #8548, that extracts the same
Only one of the two designs can land — they touch the identical hunk. My read leans toward #8548's target, since it reuses a module that already has mutation coverage wired up and extracts more, but you have the context on why |
|
Closing in favour of #8548, per the coordination note there and here. You read it right: there was no deliberate architectural reason for a separate #8558 has been rebased with |
Unblocks #8553 and the follow-up #7847 work. Behavior-preserving move, no logic change.
The problem this solves
combo.tsis 3640 lines against a frozen file-size ratchet of 3642. The gate is shrink-only, so any change that adds a line to that file is rejected — including a one-line bug fix plus the comment explaining it.Both in-flight #7847 fixes hit this. Worse, one of them shipped a violation:
lint-stageds Prettier reflowed an unrelated over-long line duringpre-commit— +4 lines, after the gate had already been checked. That is a trap for anyone touching this file: verifying
check-file-sizebefore committing is not sufficient, because the formatter runs later and can grow the file on its own.Trimming comments until they fit is optimizing the wrong thing. This restores real headroom.
What moves
The three 400-classification predicates —
isContextOverflow400,isParamValidation400,isModelScoped400— decide whether an upstream 400 should advance the combo to the next target or hard-stop it. They are pure string classifiers that share the canonical pattern lists inaccountFallback.ts; nothing about them belongs inside the routing loop.combo.ts3640 → 3610 (30 lines of headroom), new leaf is 55 lines.Behavior preservation
Verified mechanically, not by eye: each body was extracted from both revisions and compared after normalizing whitespace.
combo.tsimports them for its own fallback guard and re-exports them, so the public surface is unchanged —tests/unit/combo-param-validation-fallback-4519.test.tsstill imports them fromcombo.tswith no modification and passes 6/6.One thing worth flagging for anyone repeating this pattern: a bare
export { x } from "./leaf"re-exports without binding the name locally, socombo.tss own use of the predicates needed a separateimport.typecheck:corecaught it — a decomposition that only re-exports will compile-fail rather than fail silently.Verification
combo-param-validation-fallback-4519(existing suite, unmodified)typecheck:core,check-file-size,check:any-budget:t11Inherited base-red (not from this PR)
Confirmed red on
upstream/release/v3.8.49untouched:live repo: no NEW unexported db modules beyond the frozen allowlist. Plus the repo-wide lint (stale suppression — #8544) and file-size (providers/page.tsx,tokenHealthCheck.ts— #8532 / #8524).