test: update tests and comments to reflect new autoSelectFamily default

- Update test expectation: 'defaults to enable on Node 22'
- Update comment in fetch.ts to explain IPv4 fallback rationale
- Addresses greptile review feedback
This commit is contained in:
Ignacio
2026-02-16 14:19:03 -03:00
committed by Peter Steinberger
parent c762bf71f6
commit d43c11c76d
2 changed files with 4 additions and 3 deletions

View File

@@ -7,7 +7,8 @@ import { resolveTelegramAutoSelectFamilyDecision } from "./network-config.js";
let appliedAutoSelectFamily: boolean | null = null;
const log = createSubsystemLogger("telegram/network");
// Node 22 workaround: disable autoSelectFamily to avoid Happy Eyeballs timeouts.
// Node 22 workaround: enable autoSelectFamily to allow IPv4 fallback on broken IPv6 networks.
// Many networks have IPv6 configured but not routed, causing "Network is unreachable" errors.
// See: https://github.com/nodejs/node/issues/54359
function applyTelegramNetworkWorkarounds(network?: TelegramNetworkConfig): void {
const decision = resolveTelegramAutoSelectFamilyDecision({ network });

View File

@@ -36,9 +36,9 @@ describe("resolveTelegramAutoSelectFamilyDecision", () => {
expect(decision).toEqual({ value: true, source: "config" });
});
it("defaults to disable on Node 22", () => {
it("defaults to enable on Node 22", () => {
const decision = resolveTelegramAutoSelectFamilyDecision({ env: {}, nodeMajor: 22 });
expect(decision).toEqual({ value: false, source: "default-node22" });
expect(decision).toEqual({ value: true, source: "default-node22" });
});
it("returns null when no decision applies", () => {