Repository navigation
fix(combos): clear LKGP pins when a combo is deleted - #12330
xiaoyaner0201 wants to merge 2 commits into
Conversation
deleteCombo() removed the combos row but left the combo's LKGP pins in
key_value. Pins are keyed by `${comboName}:${modelId}`, so once the combo
is gone the rows are unreachable: the combo 404s, clearLKGP() needs a
modelId the caller no longer has, and clearAllLKGP() is far too broad.
Provider-connection deletion already cleans up its pins via
deleteLKGPByConnectionIds() (diegosouzapw#8887). This applies the same discipline to
combo deletion with deleteLKGPByComboName(), which also invalidates the
read cache so a stale pin cannot be served for the rest of the TTL.
Closes diegosouzapw#12326
261d121 to
9d5ab8c
Compare
|
The three red checks on this PR are pre-existing base reds on
Both are already being addressed by #12327 ("drain the 2026-09-01 base-red window — passthrough usage regression") and #12331, which touch that same test file. For this PR's own scope: Happy to rebase once the base-red PRs land if that makes the run easier to read. |
|
Thanks for the PR! Looking at the current Triage note: this is the review recommendation — the close itself happens only after the maintainer's per-PR sign-off (and, where a superseding PR is named, after it has landed). Nothing is being closed by this comment. |
Closes #12326.
Problem
deleteCombo()deleted thecombosrow but left the combo's LKGP pins inkey_value. Pins are keyed by${comboName}:${modelId}, so once the combo is gone those rows become unreachable:clearLKGP()needs amodelIdthe caller no longer knowsclearAllLKGP()wipes the namespace for every combo, which is not a targeted cleanupOn an instance with 26 live combos the
lkgpnamespace held 54 rows — 52 for live combos plus 2 orphans from a combo deleted earlier that day. Roughly 2 rows leak per deleted combo, so the table grows without bound for anyone who creates and deletes combos regularly.Fix
Provider-connection deletion already handles this via
deleteLKGPByConnectionIds()(#8887), andproviders/deletion.tswraps it in try/catch so cleanup failures never block the delete. This applies the same pattern to combo deletion:deleteLKGPByComboName(comboName)insettings/lkgp.ts— deletes every pin under the${comboName}:prefix and callsinvalidateCachedLKGP()for each, so a stale pin cannot be served from the 5s read cache for the rest of its TTL.deleteCombo()resolves the combo name before deleting the row, then clears its pins inside try/catch — a cleanup failure is logged, never fatal to the delete.The
:delimiter in the prefix keeps sibling combos safe (proddoes not matchprod-canary), andLIKEwildcards in combo names are escaped so a name liketemp_acannot matchtempXa.Tests
New
tests/unit/combo-delete-lkgp-cleanup-12326.test.ts, structured after the #8887 suite:invalidateCachedLKGP()pathprodvsprod-canaryLIKEwildcards do not widen cleanuptemp_avstempXaVerified the tests actually exercise the fix — with the cleanup block removed, 4 of 6 fail; with it restored, all 6 pass.
No regressions in the existing LKGP suites:
eslintandprettier --checkare clean on the touched files;tsc --noEmitreports no errors in them (the repo's existing baseline errors are unrelated and untouched).Notes
changelog.d/fixes/12330-combo-delete-lkgp-cleanup.md.