Match server overrides by identity during the one-time backfill
app_settings carries no schema version, so an install that predates identity normalization holds rows keyed by whatever id was typed, such as Unsloth/Repo-GGUF:Q4_K_M, while this browser only ever stores the folded form. The exact property lookup therefore reported "not on the server" for a row that is, and the backfill PUT over it, replacing server settings the file documents as the newer authority. The migration runs once on every existing profile, so this lands on exactly the upgrades it was written to protect. Fold both sides before comparing, splitting on the last colon because a quant label never contains one. A repo id and a Windows path fold, a POSIX path does not, which is the same rule the backend resolves by. Verified with the real module under node: the legacy-casing, variant-casing and Windows-path cases go from overwriting to skipping, a second run stays clean, and a genuinely new model, a different quant of the same repo, a POSIX path differing only in case, and a bare legacy key all still migrate.
This commit is contained in:
parent
29a0f2ef08
commit
f026c640c5
2 changed files with 55 additions and 2 deletions
|
|
@ -682,3 +682,23 @@ def test_evicted_local_configs_drop_their_server_overrides():
|
|||
store = " ".join(_read("features/model-picker/model-config/per-model-config.ts").split())
|
||||
assert "evicted?: { modelId: string; ggufVariant: string | null }[]" in store
|
||||
assert "modelIdFromStorageKey(" in store and "ggufVariantFromStorageKey(" in store
|
||||
|
||||
|
||||
def test_backfill_compares_server_keys_by_normalized_identity():
|
||||
"""app_settings has no schema version, so an install predating identity
|
||||
normalization holds rows keyed by whatever id was typed, e.g.
|
||||
"Unsloth/Repo-GGUF:Q4_K_M". This browser only ever stores the folded form,
|
||||
so an exact property lookup reports "not on the server" for a row that is,
|
||||
and the one-time backfill then overwrites settings it documents as the newer
|
||||
authority. The comparison has to fold the same way the backend resolves.
|
||||
"""
|
||||
src = " ".join(_read("features/model-picker/api/migrate-model-overrides.ts").split())
|
||||
assert "function normalizedOverrideKey(" in src
|
||||
# Folded on both sides: the older `id::variant` local keys are not folded.
|
||||
assert "const known = new Set(Object.keys(existing).map(normalizedOverrideKey));" in src
|
||||
assert "if (known.has(key)) { continue; }" in src
|
||||
# A variant never holds a colon, so the last one splits the key. Splitting on
|
||||
# the first would cut a Windows drive letter off every path id.
|
||||
assert "key.lastIndexOf(\":\")" in src
|
||||
# Repo ids fold and POSIX paths do not, which is exactly what these do.
|
||||
assert "normalizeModelIdentity(" in src and "normalizeGgufVariantIdentity(" in src
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue