mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-21 14:22:14 +03:00
* fix(combos): synchronize allowedProviders and allow invariant overrides * docs: add PR reference to changelog fragment #13951 * fix(combos): only widen existing allowedProviders/allowedModelFamilies restrictions on edit The dashboard's combo edit save unconditionally set overrideAllowedProviders and unconditionally nulled allowedModelFamilies. When a combo had NO prior allowedProviders restriction, the PUT route unioned the (empty) current restriction with the new step providers, synthesizing a brand-new allowlist out of nothing — the opposite of "no restriction" — so a later add-a-provider update would start failing COMBO_008 where it previously succeeded. - Gate the server-side union in PUT /api/combos/[id] so it only widens an ALREADY non-empty allowedProviders restriction; a combo with no restriction stays unrestricted. - Only clear allowedModelFamilies when a new step's family actually falls outside the existing restriction, instead of always nulling it on any edit. - Derive the provider id via resolveCanonicalProviderModel instead of a naive model.split('/')[0], so self-aliased no-auth providers (e.g. 'opencode' -> 'opencode-zen') resolve to their real routing provider. - Add a PUT-route-level regression test covering both the "no prior restriction stays unrestricted" and "prior restriction gets unioned" cases (the existing combo-update-invariants test only exercised combosDb.updateCombo() directly, bypassing this route branch). Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> * refactor(combos): extract computeAllowedRestrictionSync to keep handleSave under the complexity ratchet The #13951 gating fix pushed handleSave's cyclomatic complexity past the frozen new-code ceiling (16 > 15). Moving the allowedProviders/allowedModelFamilies sync into a module-level helper restores complexityNewCode=0 with no behavior change. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>