Skip to content

fix(tests): drop three needless as any casts on the volcengine testing surface (base-red #12732) - #13230

Closed
diegosouzapw wants to merge 1 commit into
release/v3.8.51from
fix/release-v3851-basereds-eslint
Closed

diegosouzapw wants to merge 1 commit into
release/v3.8.51from
fix/release-v3851-basereds-eslint

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Fixes the only hard failure in base-red #12732.

The failure

❌ ESLint errors: 3 error(s)

tests/unit/volcengine-plan-binding-upsert.test.ts:70,96,120
  error  @typescript-eslint/no-explicit-any  Unexpected any. Specify a different type

Why it appeared now

The violations are not new. #12795 regenerated config/quality/eslint-suppressions.json and pruned the entry that had these three frozen — that file shows 0 additions, 5 deletions, and there is no longer any volcengine-plan-binding-upsert key in it. no-explicit-any has been error in tests/ 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:

// src/lib/providers/volcenginePlanBinding.ts:380-383
export const __testing = {
  findTargetConnection,
  upsertConnection,
};

__testing exports upsertConnection directly, and it is a normally typed exported function — bindingTesting.upsertConnection(...) resolves without any help. Dropping as any clears 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

check before after
eslint on the file (with suppressions + --pass-on-unpruned-suppressions) exit 1, all 3 errors exit 0
npm run typecheck:core — 0 errors
node --test tests/unit/volcengine-plan-binding-upsert.test.ts — 3/3 pass

Typecheck matters here specifically: removing as any is 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.

…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.
@diegosouzapw

Copy link
Copy Markdown
Owner Author

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 (tests/unit/volcengine-plan-binding-upsert.test.ts). I restored that file to its base version so the working tree was byte-identical to origin/release/v3.8.51, and re-ran the two failing suites:

--- tree identical to base ---
ℹ tests 13
ℹ pass 11
ℹ fail 2

Same two failures, with none of this PR's content present.

The three failing unit tests are chat-rejects-image-only-model, tunnel-routes-error-sanitization and combo-provider-cooldown-sibling. The first two share one root cause: redactErrorPaths now swallows the remainder of a message after any POSIX-looking span, which destroys the image-model 400's hint. That is tracked in #13144, where I posted the reproduction and a correction to the proposed boundary.

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.

@diegosouzapw

Copy link
Copy Markdown
Owner Author

Duplicata da #13215, que veio antes e é do @backryun. Os diffs são byte a byte idênticos (mesmos três as any em tests/unit/volcengine-plan-binding-upsert.test.ts:70,96,120).

O crédito pelo fix do base-red de ESLint em release/v3.8.51 é do @backryun — fechando esta em favor da #13215.

Refs #12732

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.

1 participant