mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-27 01:22:10 +03:00
chore(release): clear release/v3.8.51 base-red gates — docs count, stryker list, lockfile host, stale suppressions, 7 lint regressions (#11502)
Validated in a combined 4-PR batch worktree off release/v3.8.51 tip. - Every fix individually confirmed against the pristine tip, no runtime behavior change - typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity, check:cycles — all OK - Full-repo lint: 503 → 228 problems, confirming this PR's diagnosis of the exit-2 stale-suppressions + orphaned-code causes; the remaining 228 are pre-existing dashboard react-hooks/* findings this PR never claimed to touch - node --test tests/unit/combo-routing-engine.test.ts, providers-constants-split.test.ts, and the providerLimits/videoBridge importers — all pass as part of the batch's 246/246 node:test run Thanks for the meticulous base-red triage — this directly explains and fixes the largest lint-drift finding from the prior merge-batch session.
This commit is contained in:
@@ -1610,10 +1610,9 @@ async function buildUnifiedModelsResponseCore(
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
const visionFields =
|
||||
!modelType || modelType === "chat"
|
||||
? getCustomVisionCapabilityFields(model, aliasId, modelId)
|
||||
: null;
|
||||
const visionFields = !modelType
|
||||
? getCustomVisionCapabilityFields(model, aliasId, modelId)
|
||||
: null;
|
||||
|
||||
if (includeAlias) {
|
||||
models.push({
|
||||
@@ -1644,10 +1643,9 @@ async function buildUnifiedModelsResponseCore(
|
||||
if (includeCanonical && canonicalProviderId !== alias && !prefix && !isNoAuthProvider) {
|
||||
const providerPrefixedId = `${canonicalProviderId}/${modelId}`;
|
||||
if (models.some((m) => m.id === providerPrefixedId)) continue;
|
||||
const providerVisionFields =
|
||||
!modelType || modelType === "chat"
|
||||
? getCustomVisionCapabilityFields(model, providerPrefixedId, modelId)
|
||||
: null;
|
||||
const providerVisionFields = !modelType
|
||||
? getCustomVisionCapabilityFields(model, providerPrefixedId, modelId)
|
||||
: null;
|
||||
models.push({
|
||||
id: providerPrefixedId,
|
||||
object: "model",
|
||||
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
describeVideoPart as defaultDescribeVideoPart,
|
||||
extractVideoFocusHint,
|
||||
extractVideoParts,
|
||||
formatVideoTimestamp,
|
||||
loadVideoPartBytes,
|
||||
replaceVideoParts,
|
||||
resolveVideoDedupCandidateFrameCount,
|
||||
|
||||
@@ -13,12 +13,7 @@ import {
|
||||
} from "@/lib/db/providerLimits";
|
||||
import { syncToCloud } from "@/lib/cloudSync";
|
||||
import { setQuotaCache } from "@/domain/quotaCache";
|
||||
import {
|
||||
buildClaudeExtraUsageConnectionUpdate,
|
||||
CLAUDE_EXTRA_USAGE_ERROR_SOURCE,
|
||||
isClaudeExtraUsageBlockEnabled,
|
||||
isClaudeExtraUsageQueued,
|
||||
} from "@/lib/providers/claudeExtraUsage";
|
||||
import { buildClaudeExtraUsageConnectionUpdate } from "@/lib/providers/claudeExtraUsage";
|
||||
import { isConnectionUnavailableToAuxiliaryActivity } from "@/lib/exclusiveLeaseIsolation";
|
||||
import { clearRecoveredProviderState } from "@/sse/services/auth";
|
||||
import { getMachineId } from "@/shared/utils/machine";
|
||||
@@ -443,26 +438,6 @@ export function hasUsableQuota(usage: JsonRecord): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
// A window "still blocks" recovery when it governs quota and is either still
|
||||
// exhausted with a real reset that hasn't passed yet, or exhausted with no
|
||||
// parseable real reset at all (unknown-reset windows stay locked, matching
|
||||
// the pre-existing kimi-coding partial-refresh semantics).
|
||||
function windowStillExhaustedAfterRealReset(value: unknown, nowMs: number): boolean {
|
||||
if (!isRecord(value)) return false;
|
||||
if (value.unlimited === true) return false;
|
||||
const remaining =
|
||||
typeof value.remaining === "number"
|
||||
? value.remaining
|
||||
: typeof value.remainingPercentage === "number"
|
||||
? value.remainingPercentage
|
||||
: null;
|
||||
if (remaining !== null && remaining > 0) return false;
|
||||
if (value.resetAt == null) return true;
|
||||
const resetMs = Date.parse(String(value.resetAt));
|
||||
if (Number.isNaN(resetMs)) return true;
|
||||
return resetMs > nowMs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is an explicit cooldown still in the future?
|
||||
*
|
||||
|
||||
@@ -53,3 +53,61 @@ export function resolveLiveWsPublicUrl(env: NodeJS.ProcessEnv = process.env): st
|
||||
export function getLiveWsPath(): string {
|
||||
return deriveLiveWsPath(resolveLiveWsPublicUrl() ?? undefined);
|
||||
}
|
||||
|
||||
/** A port the handshake may report, or null when it is not usable. */
|
||||
export function sanitizeLiveWsPort(port: unknown): number | null {
|
||||
const value = typeof port === "string" ? Number(port) : port;
|
||||
if (typeof value !== "number" || !Number.isInteger(value)) return null;
|
||||
return value > 0 && value < 65536 ? value : null;
|
||||
}
|
||||
|
||||
export interface LiveWsUrlParts {
|
||||
/** Explicit `wsUrl` passed by the caller - always wins. */
|
||||
explicit?: string | null;
|
||||
/** `live.publicUrl` from the handshake - a complete URL, used as-is. */
|
||||
handshakeUrl?: string | null;
|
||||
/** `live.port` from the handshake, i.e. the running LIVE_WS_PORT. */
|
||||
handshakePort?: number | null;
|
||||
/** `live.path` from the handshake. */
|
||||
handshakePath?: string | null;
|
||||
/** The compiled-in default, used for everything the handshake does not say. */
|
||||
defaultUrl: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the live dashboard WebSocket URL.
|
||||
*
|
||||
* The handshake reports the port the live server is actually listening on, but
|
||||
* the client read only `publicUrl` and `path` from it. An operator who moved
|
||||
* the server with `LIVE_WS_PORT` still got the compiled-in 20132, and the
|
||||
* dashboard sat on "Live disabled - WebSocket disconnected" with no way to
|
||||
* correct it short of rebuilding the image (#11331).
|
||||
*
|
||||
* Precedence: an explicit `wsUrl` wins, then a complete `publicUrl` from the
|
||||
* handshake, then the default URL with whatever port and path the handshake
|
||||
* reported applied to it.
|
||||
*/
|
||||
export function resolveLiveWsUrl({
|
||||
explicit,
|
||||
handshakeUrl,
|
||||
handshakePort,
|
||||
handshakePath,
|
||||
defaultUrl,
|
||||
}: LiveWsUrlParts): string {
|
||||
if (explicit) return explicit;
|
||||
if (handshakeUrl) return handshakeUrl;
|
||||
|
||||
const port = sanitizeLiveWsPort(handshakePort);
|
||||
const path =
|
||||
typeof handshakePath === "string" && handshakePath.startsWith("/") ? handshakePath : null;
|
||||
if (port === null && path === null) return defaultUrl;
|
||||
|
||||
try {
|
||||
const url = new URL(defaultUrl);
|
||||
if (port !== null) url.port = String(port);
|
||||
if (path !== null) url.pathname = path;
|
||||
return url.toString();
|
||||
} catch {
|
||||
return defaultUrl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user