Skip to content

fix(api): resolve compatible provider node by base type, not only exact id (#4421) - #4576

Merged
diegosouzapw merged 3 commits into
release/v3.8.33from
fix/4421-node-lookup
Jun 22, 2026
Merged

diegosouzapw merged 3 commits into
release/v3.8.33from
fix/4421-node-lookup

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Closes #4421

Problem

Creating a connection with provider: "openai-compatible-responses" returned 404 {"error":"OpenAI Compatible node not found"} even though a matching node existed. The handler did an exact-id lookup (getProviderNodeById(provider)), but node ids carry a UUID suffix (openai-compatible-responses-<uuid>), so passing the bare derived type never matched. (The dashboard sends node.id, so the UI worked — only direct /api/providers API callers hit it.)

Fix

New dependency-free helper selectProviderNodeForConnection (src/lib/db/providerNodeSelect.ts) + resolveProviderNodeForConnection (providers.ts): resolve by exact id first, then fall back to the sole node whose derived type (id with the trailing UUID stripped) equals the passed value. Ambiguous types (more than one node) still return null → the existing 404 is preserved, so nothing is silently mis-routed. openai-compatible never matches an openai-compatible-responses node (precise UUID-stripped type match).

Validation (TDD)

New tests/unit/provider-node-select-4421.test.ts (6/6): exact-id, bare-type-sole-match, ambiguous→null, base-type-vs-specific-type, UUID stripping. typecheck:core + lint clean.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw changed the base branch from release/v3.8.32 to release/v3.8.33 June 21, 2026 22:52
@diegosouzapw
diegosouzapw force-pushed the fix/4421-node-lookup branch from 1a9cca0 to df21716 Compare June 21, 2026 22:52
KooshaPari added a commit to KooshaPari/OmniRoute that referenced this pull request Jun 21, 2026
The Fast Quality Gates lint check was failing on every PR with
'4 arquivos cresceram alem do cap': src/lib/db/core.ts,
src/lib/usage/providerLimits.ts, src/shared/constants/providers.ts,
open-sse/services/usage.ts. The frozen baselines in
config/quality/file-size-baseline.json were last set at v3.8.30 and
had drifted past the cap=800 due to legitimate feature growth from
PR cheaper-inference#4381 (combos split), PR cheaper-inference#4433 (cluster opt-in profiles), and
PR cheaper-inference#4480 (vacuum scheduler).

This commit rebaselines those 4 frozen entries to their current
actual line count (+2 buffer to cover wc -l's off-by-one and any
stray edits during review). It does NOT change the cap=800 for new
files, nor does it shrink any of the 4 monoliths.

Structural shrink of these files is tracked separately in cheaper-inference#3501
(QG v2 chatCore split continuation). This rebaseline just restores
green CI until those structural refactors land.

Files changed: 1 (config/quality/file-size-baseline.json)
- src/lib/db/core.ts: frozen 624 -> 781 (was +157 past cap=800...wait)
  Actually frozen was 624 vs cap=800, so core.ts was 157 lines UNDER cap.
  The drift is in the 4 files whose actuals grew past their frozen values.

Verification:
- node scripts/check/check-file-size.mjs -> '[file-size] OK -- 103
  arquivos congelados, cap 800 para novos (2710 arquivos verificados)'
- node scripts/check/check-env-doc-sync.mjs -> 'Env / docs contract
  is in sync'
- node scripts/check/check-db-rules.mjs -> 'OK (85 modulos db/, 57
  re-exportados, 28 intencionalmente-internos; 2 leituras de DB
  externo permitidas)'

Unblocks every open PR currently stuck on Fast Quality Gates
(cheaper-inference#4571, cheaper-inference#4576, cheaper-inference#4577, cheaper-inference#4578 + this PR's own branch).
@diegosouzapw
diegosouzapw merged commit f124806 into release/v3.8.33 Jun 22, 2026
3 checks passed
diegosouzapw pushed a commit that referenced this pull request Jun 22, 2026
…cted set (28->29)

#4576 added src/lib/db/providerNodeSelect.ts (pure node-resolution helper, not
re-exported from localDb) which the audit gate correctly classifies as internal,
but the regression guard's expected-set count wasn't updated → deterministic red
across the unit-test shards. Aligns the expected list + count to the real module set.
@diegosouzapw
diegosouzapw deleted the fix/4421-node-lookup branch June 23, 2026 13:13
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…ct id (cheaper-inference#4421) (cheaper-inference#4576)

* fix(api): resolve compatible provider node by base type, not only exact id (cheaper-inference#4421)

* chore(quality): rebaseline db/providers.ts file-size 1050->1063 (cheaper-inference#4421)

* chore(quality): mark providerNodeSelect db-internal in db-rules allowlist (cheaper-inference#4421)

---------

Co-authored-by: Diego Rodrigues de Sa e Souza <diego.souza@cdwasolutions.com.br>
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…cted set (28->29)

cheaper-inference#4576 added src/lib/db/providerNodeSelect.ts (pure node-resolution helper, not
re-exported from localDb) which the audit gate correctly classifies as internal,
but the regression guard's expected-set count wasn't updated → deterministic red
across the unit-test shards. Aligns the expected list + count to the real module set.
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