fix(tests): drop three needless as any casts on the volcengine testing surface (base-red #12732) - #13230
fix(tests): drop three needless as any casts on the volcengine testing surface (base-red #12732)#13230diegosouzapw wants to merge 1 commit into
as any casts on the volcengine testing surface (base-red #12732)#13230Conversation
…ing surface (base-red #12732) `release/v3.8.51` is red on `ESLint errors: 3 error(s)`: tests/unit/volcengine-plan-binding-upsert.test.ts:70,96,120 error @typescript-eslint/no-explicit-any — Unexpected any. The violations are not new. #12795 regenerated `config/quality/eslint-suppressions.json` and pruned the entry that had these three frozen (0 additions, 5 deletions on that file), so a rule that is `error` in `tests/` since #6218 started failing the whole-repo lint on code the PR never touched. The casts were unnecessary to begin with: `__testing` exports `upsertConnection` directly (`src/lib/providers/volcenginePlanBinding.ts:380-383`) and it is a normally typed exported function, so `bindingTesting.upsertConnection(...)` resolves without help. Removing `as any` both clears the errors and puts the three call sites under type checking instead of opting them out — strictly better than restoring the suppression. Validated: eslint on the file exits 1 with all three errors before and 0 after; `typecheck:core` 0 errors; the file's own suite passes 3/3.
|
The red checks on this PR are inherited from the base, not caused by this diff. Proof rather than assertion: This branch changes exactly three lines in one file ( Same two failures, with none of this PR's content present. The three failing unit tests are Worth noting why base-red #12732 does not list these: its most recent verdict came from a push-mode run, which executes the quick hard gates only. The full unit suite was never part of that verdict, so these three have been red without appearing in the base-red report. |
Fixes the only hard failure in base-red #12732.
The failure
Why it appeared now
The violations are not new. #12795 regenerated
config/quality/eslint-suppressions.jsonand pruned the entry that had these three frozen — that file shows 0 additions, 5 deletions, and there is no longer anyvolcengine-plan-binding-upsertkey in it.no-explicit-anyhas beenerrorintests/since #6218, so a rule the PR never intended to touch started failing the whole-repo lint on code it never edited.That also explains why #12795's own CI was green: its Lint job ran before the pruned file became the branch's baseline for the next whole-repo run.
The fix
The casts were unnecessary in the first place:
__testingexportsupsertConnectiondirectly, and it is a normally typed exported function —bindingTesting.upsertConnection(...)resolves without any help. Droppingas anyclears the errors and puts the three call sites under type checking instead of opting them out, which is strictly better than restoring the suppression entry.Validation
eslinton the file (with suppressions +--pass-on-unpruned-suppressions)npm run typecheck:corenode --test tests/unit/volcengine-plan-binding-upsert.test.tsTypecheck matters here specifically: removing
as anyis only safe if the now-checked call sites actually satisfy the signature, and they do.One deliberate omission
This file is not Prettier-clean, and this PR does not reformat it. It was already non-conformant on the base (verified against
HEAD~1), no CI job enforces Prettier — it only runs through lint-staged on commit — and reformatting would turn a 3-line base-red fix into a 25-line diff across untouched assertions. Left as-is on purpose; happy to split it into a formatting-only PR if you'd rather have it clean.