Skip to content

chore(quality): bank completed file-size shrinks (shrink-only --update on current tip) - #8585

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
MumuTW:chore/file-size-bank-completed-shrinks
Jul 27, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
MumuTW:chore/file-size-bank-completed-shrinks

Conversation

@MumuTW

@MumuTW MumuTW commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Implements proposal 1 of #8584. One JSON file, no product code, no test changes.

What this does

Runs node scripts/check/check-file-size.mjs --update — the shrink-only ratchet path — apparently for the first time.

frozen (prod) testFrozen
entries removed (fell to ≤ cap 800) 14 0
entries lowered to measured size 60 17
entries raised 0 0
entries added 0 0

cap and testCap untouched. All 55 _rebaseline_* documentation note keys preserved. Verified by a key-by-key diff of the pre/post JSON rather than by reading the diff, so "zero raised" is a measured claim.

The gate is green before and after. This is a pure tightening, not a base-red repair — nothing here unblocks anything, it just stops the ceiling from being a one-way valve.

Why it was needed

--update is shrink-only by construction (if (loc <= cap) delete frozen[file]; else frozen[file] = loc), so it can't be abused. But grepping .github/workflows/ for --update finds only wiki-sync.yml (unrelated) and ci.yml:221, which runs check-quality-ratchet.mjs --require-tighten — a different script against a different metric. Neither check:file-size --update nor check:complexity-ratchets --update is invoked anywhere in CI.

The result is an asymmetry: raising a cap is a manual ten-second edit and the fastest way to unblock a PR; lowering requires a command that is nobody's job. So caps outlive the code that earned them:

file actual old cap ratio
src/shared/validation/schemas.ts 19 2,523 132.8×
src/shared/constants/pricing.ts 40 1,662 41.5×
open-sse/config/providerRegistry.ts 279 4,731 17.0×
src/shared/constants/providers.ts 480 3,276 6.8×
src/shared/constants/sidebarVisibility.ts 293 1,198 4.1×
src/lib/evals/evalRunner.ts 301 961 3.2×

A 19-line file carrying a 2,523-line cap isn't a gate on that file — it's permission to add 2,504 lines with the gate silent. Every one of those numbers is a decomposition that succeeded and whose gain was never banked.

The part worth reading twice

Three of the entries tightened here had already been decomposed once, and the gain was never recorded:

file old cap actual now
src/lib/providers/validation.ts 4,523 958
open-sse/services/usage.ts 3,454 1,065
open-sse/services/tokenRefresh.ts 2,249 999

Those are the same three files being decomposed a second time right now in #8546, #8545 and #8547. Round one took them from ~4.5k/3.5k/2.2k down to ~1k and left the caps at the round-zero high-water mark, so the ledger reflects none of it. That is the clearest illustration I found of why the baseline reads as pure inflation: the shrinks happened, they were simply never written down.

Largest single tightenings in this diff, for the record:

4523 ->  959  (-3564)  src/lib/providers/validation.ts
3454 -> 1066  (-2388)  open-sse/services/usage.ts
2249 -> 1000  (-1249)  open-sse/services/tokenRefresh.ts
1873 -> 1044  ( -829)  open-sse/executors/grok-web.ts
3777 -> 3097  ( -680)  open-sse/handlers/imageGeneration.ts

For comparison, complexity-baseline.json records ~37 rebaseline notes since 2026-06-13 with exactly one decrease in it (−1 line). This commit moves 91 entries down.

Known residue, deliberately not fixed here

Three entries sit at exactly their frozen value and far below the 800 cap — ProviderDetailPageClient.tsx 798, useProviderModels.ts 155, useProviderSettings.ts 264. They cannot leave the baseline, because --update only reaches the delete branch when the file also shrank in that same run (loc < frozen); an entry already equal to its cap never qualifies. That is a one-line change to the gate's logic and doesn't belong in a mechanical banking commit, so it's noted in #8584 instead.

webProvidersA.ts is a legitimate keep: it shrank 809 → 801 but 801 is still above the 800 cap, so it stays frozen at 801, which is correct.

Scope

Only check:file-size --update. I did not run check:complexity-ratchets --update, because complexity is currently above its baseline on this tip (2169 vs 2130) and the shrink-only path would refuse to write — that one is #8580's problem, not this PR's.

Verification

  • npm run check:file-size — green before and after (168 arquivos congelados after, was 182 keys / 127 real files before; now 113 real files + the 55 notes).
  • Prettier clean.
  • No production code, no tests changed, so no test additions required — same shape as fix(quality): repair release/v3.8.49 base-red gates #8561.

Refs #8584

@MumuTW
MumuTW requested a review from diegosouzapw as a code owner July 25, 2026 15:43
MumuTW added a commit to MumuTW/OmniRoute that referenced this pull request Jul 26, 2026
…he cap

`check:file-size --update` could only ever delete an entry from inside the
improvement branch (`loc < frozen[file]`). An entry sitting at EXACTLY its
frozen value while already within the 800-line new-file cap therefore never
qualified for removal, however far under the cap it was — it stayed in the
baseline permanently.

Three real cases on release/v3.8.49 @ 4053e23 survived a full `--update`
run for this reason:

  src/app/(dashboard)/dashboard/providers/[id]/ProviderDetailPageClient.tsx  798
  src/app/(dashboard)/dashboard/providers/[id]/hooks/useProviderModels.ts    155
  src/app/(dashboard)/dashboard/providers/[id]/hooks/useProviderSettings.ts  264

`evaluateFileSizes` now reports a third bucket, `redundant` — in `frozen`,
not a violation, not an improvement, and `loc <= cap` — and the `--update`
path deletes those entries alongside the shrinks. Same treatment for the
testFrozen/testCap half, which had the identical gap.

The non-update gate path is untouched: `redundant` entries were already
passing and still pass, so no PR's result changes. Only `--update` behaves
differently.

TDD: 7 new failing tests first (16 total in tests/unit/check-file-size.test.ts,
9 pre-existing all still passing), then the fix, then 16/16 green. End-to-end
on the real baseline, `--update` now reports "74 arquivo(s) encolheram, 3
entrada(s) redundante(s) removida(s)" and removes 17 entries instead of 14,
with 0 caps raised. That baseline diff is deliberately NOT in this commit —
banking the data belongs to cheaper-inference#8585.

Refs cheaper-inference#8584
@MumuTW
MumuTW force-pushed the chore/file-size-bank-completed-shrinks branch from 3052acc to 8dc5916 Compare July 26, 2026 09:51
@MumuTW
MumuTW force-pushed the chore/file-size-bank-completed-shrinks branch from d7b6ee0 to a482c39 Compare July 27, 2026 04:42
@MumuTW MumuTW changed the title chore(quality): bank 91 completed shrinks into the file-size baseline chore(quality): bank completed file-size shrinks (shrink-only --update on current tip) Jul 27, 2026
@MumuTW
MumuTW force-pushed the chore/file-size-bank-completed-shrinks branch from a482c39 to f1f5a44 Compare July 27, 2026 16:36
Regenerate file-size-baseline.json with shrink-only `--update` measured on the
current tip (5f365ba), after cheaper-inference#8741 (--update removes at-cap entries) and cheaper-inference#8767
(OWNER-APPROVED temporary cap/testCap 800->1000 for the v3.8.50-.54 PREPARE phase)
both landed.

  frozen      186 -> 120 entries (75 shrank, 66 removed as redundant)
  testFrozen   58 ->  43 entries (19 shrank, 15 removed as redundant)

Shrink-only, verified against the pre-rebase baseline: no entry grew, no entry
was added, every removed entry measures <= cap, and `cap`/`testCap` stay at the
1000 that cheaper-inference#8767 set. All `_rebaseline_*` audit notes are preserved verbatim,
including both cheaper-inference#8767 relax entries.

The earlier SKILL.md sync and the `--update` removal fix are dropped from this
branch — both landed upstream via cheaper-inference#8741.
@MumuTW
MumuTW force-pushed the chore/file-size-bank-completed-shrinks branch from f1f5a44 to dd7f7cb Compare July 27, 2026 16:56
@diegosouzapw
diegosouzapw merged commit 41fe8dc into cheaper-inference:release/v3.8.49 Jul 27, 2026
15 checks passed
diegosouzapw added a commit that referenced this pull request Jul 27, 2026
…stryker drift

file-size: nine frozen entries could not absorb the combined result of the
31-PR train. Two distinct causes, kept apart in the baseline note on purpose:

  (1) GENUINE irreducible growth at existing chokepoints —
      providerLimits/auth (#8632), rateLimitManager (#8616),
      models-catalog-route.test (#8610).
  (2) COLLISION with #8585, which banked shrinks measured on the pre-train
      release tip while 30 sibling PRs in the SAME train grew those files
      again — chat/accountFallback (#8628), chatCore (#8613),
      videoGeneration (#8581), imageGeneration.

Ceilings re-pinned to the post-merge tip. #8612 (also in this train) automates
shrink-banking so this self-inflicted drift stops recurring.

stryker: three covering unit tests were missing from tap.testFiles —
isLocalStreamLifecycleError-abort-shape (circuitBreaker.ts, a shared base-red
that was reddening Fast Quality Gates on every open PR),
noauth-autocombo-lockout-7623 (accountFallback.ts) and
kimi-quota-reset-recovery (auth.ts), the latter two landed with this train.
This was referenced Jul 28, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…per-inference#8585)

Regenerate file-size-baseline.json with shrink-only `--update` measured on the
current tip (3eef45f), after cheaper-inference#8741 (--update removes at-cap entries) and cheaper-inference#8767
(OWNER-APPROVED temporary cap/testCap 800->1000 for the v3.8.50-.54 PREPARE phase)
both landed.

  frozen      186 -> 120 entries (75 shrank, 66 removed as redundant)
  testFrozen   58 ->  43 entries (19 shrank, 15 removed as redundant)

Shrink-only, verified against the pre-rebase baseline: no entry grew, no entry
was added, every removed entry measures <= cap, and `cap`/`testCap` stay at the
1000 that cheaper-inference#8767 set. All `_rebaseline_*` audit notes are preserved verbatim,
including both cheaper-inference#8767 relax entries.

The earlier SKILL.md sync and the `--update` removal fix are dropped from this
branch — both landed upstream via cheaper-inference#8741.
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…stryker drift

file-size: nine frozen entries could not absorb the combined result of the
31-PR train. Two distinct causes, kept apart in the baseline note on purpose:

  (1) GENUINE irreducible growth at existing chokepoints —
      providerLimits/auth (cheaper-inference#8632), rateLimitManager (cheaper-inference#8616),
      models-catalog-route.test (cheaper-inference#8610).
  (2) COLLISION with cheaper-inference#8585, which banked shrinks measured on the pre-train
      release tip while 30 sibling PRs in the SAME train grew those files
      again — chat/accountFallback (cheaper-inference#8628), chatCore (cheaper-inference#8613),
      videoGeneration (cheaper-inference#8581), imageGeneration.

Ceilings re-pinned to the post-merge tip. cheaper-inference#8612 (also in this train) automates
shrink-banking so this self-inflicted drift stops recurring.

stryker: three covering unit tests were missing from tap.testFiles —
isLocalStreamLifecycleError-abort-shape (circuitBreaker.ts, a shared base-red
that was reddening Fast Quality Gates on every open PR),
noauth-autocombo-lockout-7623 (accountFallback.ts) and
kimi-quota-reset-recovery (auth.ts), the latter two landed with this train.
@MumuTW
MumuTW deleted the chore/file-size-bank-completed-shrinks branch September 5, 2026 10:18
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…per-inference#8585)

Regenerate file-size-baseline.json with shrink-only `--update` measured on the
current tip (b78b9b3), after cheaper-inference#8741 (--update removes at-cap entries) and cheaper-inference#8767
(OWNER-APPROVED temporary cap/testCap 800->1000 for the v3.8.50-.54 PREPARE phase)
both landed.

  frozen      186 -> 120 entries (75 shrank, 66 removed as redundant)
  testFrozen   58 ->  43 entries (19 shrank, 15 removed as redundant)

Shrink-only, verified against the pre-rebase baseline: no entry grew, no entry
was added, every removed entry measures <= cap, and `cap`/`testCap` stay at the
1000 that cheaper-inference#8767 set. All `_rebaseline_*` audit notes are preserved verbatim,
including both cheaper-inference#8767 relax entries.

The earlier SKILL.md sync and the `--update` removal fix are dropped from this
branch — both landed upstream via cheaper-inference#8741.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…stryker drift

file-size: nine frozen entries could not absorb the combined result of the
31-PR train. Two distinct causes, kept apart in the baseline note on purpose:

  (1) GENUINE irreducible growth at existing chokepoints —
      providerLimits/auth (cheaper-inference#8632), rateLimitManager (cheaper-inference#8616),
      models-catalog-route.test (cheaper-inference#8610).
  (2) COLLISION with cheaper-inference#8585, which banked shrinks measured on the pre-train
      release tip while 30 sibling PRs in the SAME train grew those files
      again — chat/accountFallback (cheaper-inference#8628), chatCore (cheaper-inference#8613),
      videoGeneration (cheaper-inference#8581), imageGeneration.

Ceilings re-pinned to the post-merge tip. cheaper-inference#8612 (also in this train) automates
shrink-banking so this self-inflicted drift stops recurring.

stryker: three covering unit tests were missing from tap.testFiles —
isLocalStreamLifecycleError-abort-shape (circuitBreaker.ts, a shared base-red
that was reddening Fast Quality Gates on every open PR),
noauth-autocombo-lockout-7623 (accountFallback.ts) and
kimi-quota-reset-recovery (auth.ts), the latter two landed with this train.
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