Skip to content

[PR] fix: retain nested transport codes in upstream health reports - #6743

Merged
ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-14_nested-upstream-error-codes
Nov 14, 2026
Merged

ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-14_nested-upstream-error-codes

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Closes #6741

Problem

Native Node Fetch failures commonly expose their transport error as TypeError.cause.code. The existing taxonomy follows that cause chain, but the separate errno reader only inspects the outer error. As a result, the upstream alert and /__bili/upstreams report can identify a failure category while dropping the specific errno, and a repeated alert can keep an older code instead of the current cause.

Change

Follow the same bounded eight-entry cause order when reading the errno. Keep the first nonempty string code, including an outer code when present. Both alert records and open-circuit health records use this helper. Failure classification, retry behavior, circuit transitions, and the report schema stay as they are.

Validation

  • On unchanged master a8bbb8d23108ba9148d09512927041364625d910, the targeted 29 tests produced 11 failures and 18 passes. Ten failures are new cause-code cases; the other is the new errno assertion in the existing real-proxy failure/recovery test.
  • With this patch, all 48 tests across the errno, upstream alerts, circuit, and transport-failure suites pass under their normal retry settings.
  • A loopback HTTP server closes its socket and native Fetch produces a real TypeError with cause.code = UND_ERR_SOCKET; the public alert/circuit health records retain that code. The existing proxy integration also verifies ECONNREFUSED through the real /__bili/upstreams endpoint.
  • Controls cover direct errors, outer-code precedence, empty/non-string wrapper codes, repeated alert updates, the eight-entry limit, cyclic causes, and existing recovery/timeout behavior.
  • npm run typecheck, npm run build, and git diff --check pass on Node 24.22.1 / Linux.

Existing work checked

The complete Afloat16 historical PR patch index and non-PR issue index contain no earlier change to this helper. I also checked the actual patches for #5147 (the health report and outer-only errno reader), #5177 (cause-aware proxy logging), and #4417 (unknown circuit-failure accounting). None repairs the errno stored in the alert and health records.

@ranxianglei ranxianglei changed the title fix: retain nested transport codes in upstream health reports [PR] fix: retain nested transport codes in upstream health reports Nov 14, 2026
@ranxianglei
ranxianglei merged commit 218d586 into ranxianglei:master Nov 14, 2026
48 checks passed
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.

Native Fetch cause codes disappear from upstream alerts and health reports

2 participants