Skip to content

fix(quality): drop two unnecessary any casts that leave the branch lint-red - #9484

Closed
HouMinXi wants to merge 2 commits into
diegosouzapw:release/v3.8.50from
HouMinXi:fix/quality-base-lint-red
Closed

HouMinXi wants to merge 2 commits into
diegosouzapw:release/v3.8.50from
HouMinXi:fix/quality-base-lint-red

Conversation

@HouMinXi

@HouMinXi HouMinXi commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

npm run lint exits 1 on release/v3.8.50 with nothing checked out on top of it:

$ git worktree add <tmp> --detach upstream/release/v3.8.50   # 2cb7567d6, no edits
$ npm run lint
tests/unit/issue-9407-gemini-web-validation-false-positive.test.ts
  50:38  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
tests/unit/v1-models-auth-leak-9320.test.ts
  83:54  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
2 problems (2 errors, 0 warnings)
(exit 1)

Both files arrived on 2026-08-04 with #9407 and #9320 and are absent from config/quality/eslint-suppressions.json, whose own most recent commit (3440c118e, #9205) is newer than both. So the branch fails its own gate, and every pull request opened against it inherits the failure regardless of what it changes. Two of mine opened today, touching no shared files, show the identical pair.

The fix

Neither cast was doing anything, so this removes them rather than freezing them.

GeminiWebExecutor declares testConnection as a public method (open-sse/executors/gemini-web.ts:359), so the test can read it directly. getApiKeys returns a typed view whose name field infers correctly in the find callback, so the parameter annotation was redundant.

Leaving config/quality/eslint-suppressions.json untouched is deliberate: the allowlist policy in CLAUDE.md asks for the cause to be fixed where it can be, and freezing these two would have carried them forward as permanent entries.

Verification

$ npm run lint
(exit 0)

$ npm run typecheck:core
(exit 0)

$ node --import tsx/esm --import ./open-sse/utils/setupPolyfill.ts \
    --import ./tests/_setup/isolateDataDir.ts --test --test-force-exit \
    tests/unit/issue-9407-gemini-web-validation-false-positive.test.ts \
    tests/unit/v1-models-auth-leak-9320.test.ts
# tests 12
# pass 12
# fail 0

Removing a cast can change what an assertion actually observes, so the #9320 lookup was re-pointed at a key name that does not exist to confirm the assertion still has teeth:

# tests 12
# pass 11
# fail 1

Restored, and green again.

What this does to CI, measured against a PR without it

The lint-guard job runs npm run lint:json -- --max-warnings 0 as its second step. Comparing that job across two of my PRs opened minutes apart against the same base, one carrying this change and one not:

                                        without this change   with it
ESLint (baseline congelado)             failure               success
Run npm run quality:collect             skipped               success
Ratchet check (blocking)                skipped               success
Require-tighten (blocking)              skipped               success
CodeQL alerts ratchet (blocking)        skipped               failure

So this is necessary but not sufficient. It clears the first gate; the job then reaches three more that were previously never evaluated, and stops at the CodeQL ratchet:

[codeql-ratchet] Alertas CodeQL abertos (nao-dismissed): 1
[codeql-ratchet]   Top regras: js/stack-trace-exposure(1)
[codeql-ratchet] REGRESSAO - 1 alertas CodeQL abertos > baseline 0

That one alert is repository-wide rather than per-PR, so it is red on every open pull request too. js/stack-trace-exposure is the rule CLAUDE.md Hard Rule #14 already documents as a known CodeQL limitation on call sites that route through sanitizeErrorMessage(), which suggests a dismissal rather than a code change, but that is your call and not something I would do unasked.

The neighbouring fast-gates job stops even earlier, at check:file-size:

[file-size] 2 violacoes:
  src/sse/handlers/chat.ts: 1846 > congelado 1845
  open-sse/executors/base.ts: 1623 > congelado 1578

Neither file is touched here.

Related

#8542 describes exactly the compounding this makes visible: with the ESLint step red, nothing downstream in that job ever ran, so the CodeQL regression was invisible in every PR log until the first gate was cleared. #8522 describes the same pattern from the baseline side. Both still open.

…nt-red

`npm run lint` exits 1 on release/v3.8.50 with nothing checked out on top of
it. The two test files that carry the violations arrived on 2026-08-04 with
9407 and 9320 and were never added to the suppressions snapshot, so the gate
has been failing on the branch itself and every pull request opened against it
inherits the failure.

Neither cast was doing anything. GeminiWebExecutor declares testConnection as a
public method, and getApiKeys already returns a typed view whose name field
infers correctly in the find callback. Removing both is enough to bring the
gate back to zero; the suppressions file is untouched, which keeps this from
freezing a violation that did not need freezing.
@HouMinXi

HouMinXi commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

#9488 cleared both casts, plus a third base-red in the translate-path snapshot that I had missed. Nothing left in this branch. Closing.

@HouMinXi HouMinXi closed this Aug 5, 2026
diegosouzapw added a commit that referenced this pull request Aug 5, 2026
…ne (#9509)

release/v3.8.50 fails its own "No new ESLint warnings" gate right now,
independent of what any PR changes. Measured directly: a worktree
checked out at the current tip alone, no PR merged in, exits 2 with
"There are suppressions left that do not occur anymore." Cross-checked
against two unrelated open PRs (#9499, #9497) hitting the identical
failure, ruling out anything content-specific.

The mass-freeze commit that regenerated config/quality/eslint-suppressions.json
for the TypeScript 7 migration left one entry pointing at a violation
that no longer exists: src/lib/usage/providerLimits.ts no longer
triggers no-restricted-imports, but the suppression entry for it does.
ESLint's own suppression bookkeeping treats an unmatched entry as a
hard failure, separate from and in addition to real unsuppressed
errors.

--prune-suppressions removes exactly that one entry. It also drops the
informal "_comment" key documenting the freeze's origin, since ESLint's
suppression writer only round-trips file-keyed entries it manages
itself -- that context is not lost, it is still readable at the
mass-freeze commit (6b0e11e) in git history.

This is one of two independent problems behind the same gate failure,
not the whole fix. Two files (tests/unit/issue-9407-gemini-web-validation-false-positive.test.ts,
tests/unit/v1-models-auth-leak-9320.test.ts) carry real, currently
unsuppressed no-explicit-any errors with no entry covering them at
all -- pruning cannot add what was never there. #9484 fixes those at
the source. Verified here that after this change alone, the gate
moves from exit 2 (stale suppressions) to the ordinary exit 1 those
two remaining errors cause -- both this and #9484 need to land before
the gate is green again.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
@HouMinXi
HouMinXi deleted the fix/quality-base-lint-red branch September 16, 2026 14:07
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…ne (diegosouzapw#9509)

release/v3.8.50 fails its own "No new ESLint warnings" gate right now,
independent of what any PR changes. Measured directly: a worktree
checked out at the current tip alone, no PR merged in, exits 2 with
"There are suppressions left that do not occur anymore." Cross-checked
against two unrelated open PRs (diegosouzapw#9499, diegosouzapw#9497) hitting the identical
failure, ruling out anything content-specific.

The mass-freeze commit that regenerated config/quality/eslint-suppressions.json
for the TypeScript 7 migration left one entry pointing at a violation
that no longer exists: src/lib/usage/providerLimits.ts no longer
triggers no-restricted-imports, but the suppression entry for it does.
ESLint's own suppression bookkeeping treats an unmatched entry as a
hard failure, separate from and in addition to real unsuppressed
errors.

--prune-suppressions removes exactly that one entry. It also drops the
informal "_comment" key documenting the freeze's origin, since ESLint's
suppression writer only round-trips file-keyed entries it manages
itself -- that context is not lost, it is still readable at the
mass-freeze commit (020ea4a) in git history.

This is one of two independent problems behind the same gate failure,
not the whole fix. Two files (tests/unit/issue-9407-gemini-web-validation-false-positive.test.ts,
tests/unit/v1-models-auth-leak-9320.test.ts) carry real, currently
unsuppressed no-explicit-any errors with no entry covering them at
all -- pruning cannot add what was never there. diegosouzapw#9484 fixes those at
the source. Verified here that after this change alone, the gate
moves from exit 2 (stale suppressions) to the ordinary exit 1 those
two remaining errors cause -- both this and diegosouzapw#9484 need to land before
the gate is green again.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
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