Repository navigation
fix(combos): clear LKGP pins on delete - #12425
Merged
diegosouzapw merged 1 commit intoSep 4, 2026
Merged
diegosouzapw merged 1 commit into
diegosouzapw merged 1 commit into
Conversation
5 tasks done
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
Validado em lote numa worktree combinada com os 6 PRs destas duas levas sobre o tip de `release/v3.8.51`: os seis boardaram **sem um único conflito**, `typecheck:core` limpo e **54/54** nos 7 arquivos de teste que trazem. O drift de `i18n:check` (`docs/security/GUARDRAILS.md`, `STEALTH_GUIDE.md` — source-changed) foi medido também no tip puro e é idêntico: base-red pré-existente, não desta leva.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
key_valuerows when a persisted combo is deleted.LIKEwildcards.Problem
deleteCombo()deleted the combo row but did not delete LKGP pins keyed by that combo name. The result was unreachablekey_valuerows undernamespace = 'lkgp'after the combo no longer existed.Root Cause
LKGP pins are stored as
key = "${comboName}:${modelId}". Existing cleanup helpers either delete one exactcomboName:modelIdpair (clearLKGP()), all LKGP (clearAllLKGP()), or pins by provider connection id (deleteLKGPByConnectionIds()).deleteCombo()only executedDELETE FROM combos WHERE id = ?, so it never removed rows that belonged exclusively to the deleted combo name.Solution
${comboName}:namespace prefix.%,_, and\\in the SQLiteLIKEpattern and rely on the:delimiter to avoid collateral deletion.Invariant
DELETE COMBO X → REMOVE LKGP STATE OWNED BY X
AND
UNRELATED LKGP STATE → PRESERVED
Forbidden state:
DELETED COMBO → ORPHANED LKGP REFERENCE
Regression Evidence
tests/unit/combo-delete-lkgp-cleanup-12326.test.tsfailed: deleted combo LKGP rows still returned{ provider: 'berry', connectionId: 'conn-1' }instead ofnull.deleteCombo()cleanup while keeping the test: focused test failed again; after restoring the fix it passed again.Behavior Proof
Validation
node --import tsx/esm --test tests/unit/combo-delete-lkgp-cleanup-12326.test.tsnode --import tsx/esm --test tests/unit/combo-delete-lkgp-cleanup-12326.test.ts tests/unit/combo-cache-invalidation.test.tsnpm run typecheck:corenpx eslint src/lib/db/repositories/sqliteComboRepository.ts src/lib/db/settings/lkgp.ts src/lib/db/settings.ts tests/unit/combo-delete-lkgp-cleanup-12326.test.tsgit diff --checkScope / Risk
Low scope: persistence cleanup only. No routing-provider, circuit-breaker, API-key ACL, authz, or provider-plugin behavior changed.
Compatibility
No schema migration and no public LKGP contract change. Existing LKGP key format is preserved.
Fixes #12326