Skip to content

fix(ci): repair the API Route Typecheck base-red blocking every PR - #14079

Merged
diegosouzapw merged 1 commit into
release/v3.8.51from
fix/release-v3.8.51-basereds-apitypecheck
Sep 18, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.51from
fix/release-v3.8.51-basereds-apitypecheck

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Base-red — reproduced on the pure release/v3.8.51 tip (1603c86e)

node scripts/check/check-api-typecheck.mjs fails on the release tip itself, so every PR against the release is born red on API Route Typecheck. Not tracked by the Release-Green issue (#14004), which runs in quick mode.

File Error Cause Fix
src/lib/usage/glmResetCards.ts:47 TS2322 Promise<any> → T entered the gate's scope when #12754 added the route importing it; runWithProxyContext is an untyped async helper declare the awaited-callback contract every call site already follows: fn: () => Promise<T> → Promise<T>
src/sse/handlers/chat.ts:1286 TS2345 ResponseLike → Response handleSingleModelChat had no return annotation, so runWithTransientBackendRetry<T extends ResponseLike> fell back to the constraint : Promise<Response> (every return path builds a Response)
src/app/api/internal/codex-responses-ws/route.ts TS2339 ×5 (7 → 12), TS2740 bridge helpers return { error } | payload as unannotated object-literal unions → TS synthesises error?: undefined on the success member and "error" in x stops narrowing explicit return types (CodexWsFailure | CodexWs*Context) keep the discriminant real; ApiKeyMetadata alias moved to the policy shape; logger.warn → log.warn

No as any, no @ts-ignore, no baseline widening. Baseline ratcheted down 294 → 283.

Evidence (local)

  • check-api-typecheck.mjs → OK — 283 pre-existing error(s), all within frozen baseline
  • npm run typecheck:core → clean
  • eslint (suppressions applied) on the 3 files → clean
  • check-complexity / check-cognitive-complexity → OK
  • 43/43 unit tests in codex-responses-ws-* + glm-reset-card* green

⚠️ base-red inherited: #14004 — Unit Tests fast-path (≈35 tests red on the tip, being swept separately) and file-size drift on chatcore-translation-paths.test.ts (#14016).

The gate fails on the pure release/v3.8.51 tip (3 files above the frozen
baseline), so every PR against the release is born red on it. None of the
three is a PR defect — they are drift from merged work:

- src/lib/usage/glmResetCards.ts: entered the gate's scope when #12754 added
  the route that imports it. runWithProxyContext is an untyped async helper
  (Promise<any>), so runWithConnectionFetch<T> could not return T. Every call
  site passes an async callback and awaits it — declare that contract:
  fn: () => Promise<T> → Promise<T>.
- src/sse/handlers/chat.ts: handleSingleModelChat had no return annotation, so
  runWithTransientBackendRetry<T extends ResponseLike> fell back to the
  constraint and the value could no longer feed withSessionHeader(Response).
  Annotated Promise<Response> (every return path builds a Response).
- src/app/api/internal/codex-responses-ws/route.ts: the bridge helpers return
  either { error: Response } or a payload, but as unannotated object-literal
  unions TypeScript synthesised error?: undefined on the success member, and
  every "error" in x guard stopped narrowing (TS2339 x5 on the destructure).
  Explicit return types keep the discriminant real; the ApiKeyMetadata alias now
  points at the policy shape (the wider one both sources are assignable to),
  which clears the TS2740 self-mismatch; logger.warn → log.warn (the module
  logger factory has no .warn).

check-api-typecheck.mjs: OK — 283 errors, baseline ratcheted DOWN from 294
(codex-responses-ws 7→4 TS2339, TS2740 1→0; combos/test and keys/[id] 1→0).
typecheck:core clean; 43/43 unit tests in the touched areas green.
@diegosouzapw

Copy link
Copy Markdown
Collaborator Author

Validated in local merge-train /tmp/mt-basereds.log on 192.168.0.113 @ train tip c2fb6404606064c56520d7b2a148e8770dc70cd0 (boarded #14022 #14016 #14079 #14082): static gates green; test:unit 40635 tests, 17 failing — every one reproduces on the pure release tip 1603c86 (41 failing there; list in the base-red sweep), zero new reds. Merged with --admin per merge-gates §4/§7 (inherited base-reds only).

@diegosouzapw
diegosouzapw merged commit 24fc202 into release/v3.8.51 Sep 18, 2026
15 of 21 checks passed
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…heaper-inference#14079)

The gate fails on the pure release/v3.8.51 tip (3 files above the frozen
baseline), so every PR against the release is born red on it. None of the
three is a PR defect — they are drift from merged work:

- src/lib/usage/glmResetCards.ts: entered the gate's scope when cheaper-inference#12754 added
  the route that imports it. runWithProxyContext is an untyped async helper
  (Promise<any>), so runWithConnectionFetch<T> could not return T. Every call
  site passes an async callback and awaits it — declare that contract:
  fn: () => Promise<T> → Promise<T>.
- src/sse/handlers/chat.ts: handleSingleModelChat had no return annotation, so
  runWithTransientBackendRetry<T extends ResponseLike> fell back to the
  constraint and the value could no longer feed withSessionHeader(Response).
  Annotated Promise<Response> (every return path builds a Response).
- src/app/api/internal/codex-responses-ws/route.ts: the bridge helpers return
  either { error: Response } or a payload, but as unannotated object-literal
  unions TypeScript synthesised error?: undefined on the success member, and
  every "error" in x guard stopped narrowing (TS2339 x5 on the destructure).
  Explicit return types keep the discriminant real; the ApiKeyMetadata alias now
  points at the policy shape (the wider one both sources are assignable to),
  which clears the TS2740 self-mismatch; logger.warn → log.warn (the module
  logger factory has no .warn).

check-api-typecheck.mjs: OK — 283 errors, baseline ratcheted DOWN from 294
(codex-responses-ws 7→4 TS2339, TS2740 1→0; combos/test and keys/[id] 1→0).
typecheck:core clean; 43/43 unit tests in the touched areas green.
@diegosouzapw
diegosouzapw deleted the fix/release-v3.8.51-basereds-apitypecheck branch October 18, 2026 23:50
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