Skip to content

gallery: remove duplicated entries and lint against them recurring#10996

Merged
mudler merged 1 commit into
masterfrom
gallery-dedupe-entries
Jul 20, 2026
Merged

gallery: remove duplicated entries and lint against them recurring#10996
mudler merged 1 commit into
masterfrom
gallery-dedupe-entries

Conversation

@localai-bot

Copy link
Copy Markdown
Collaborator

What this does

Removes 8 duplicated entries from gallery/index.yaml and adds the lint rules that keep them out.

FindGalleryElement returns the first match, so the second copy of a duplicated name was never reachable. Each pair is byte-identical apart from position, verified two independent ways (parsed comparison with merge keys resolved and canonically serialised, and a raw-text byte comparison of the blocks), so removing the second copy changes no behaviour at all.

Removed: deepseek-r1-distill-llama-8b, llama3.2-3b-enigma, qwen3-asr-0.6b, qwen3-asr-1.7b, qwopus-glm-18b-merged, voice-en-us-kathleen-low, whisper-large-q5_0, whisper-small-q5_1.

The diff is pure deletions: 0 insertions, 212 deletions.

Why it matters beyond tidiness

A variant reference to a duplicated name is ambiguous, since it is not clear which declaration it points at. The proposal job in #10992 already refuses to propose against these names for exactly that reason, and whisper-large-q5_0 and whisper-small-q5_1 are both in whisper families that would otherwise be grouped.

Two lint rules

Duplicate entry names. Reports the name and explains that only the first declaration is reachable, so the later one is dead weight.

Doubly-claimed variant targets. VariantParents in core/gallery/collapse_variants.go resolves a build claimed by two parents by taking the first in gallery order, and its comment justifies that arbitrary tiebreak by saying it keeps the listing deterministic "for a gallery the linter would reject". The linter did not reject it. That comment is now true.

The second rule sits beside the first rather than in its own change, because it is a variant invariant belonging next to the rule it complements, and splitting it would leave that comment describing a linter that does not exist for no reviewing benefit. It mirrors what VariantParents actually skips (dangling, nested and self references), so it does not double-report breaches checkVariantReferences already owns. One parent listing the same target twice is not a violation. Green on arrival: no target is doubly claimed today, by curation rather than by rule.

Verification

Both rules proven red before green:

voice-en-us-kathleen-low: entry "voice-en-us-kathleen-low" is declared more than once:
FindGalleryElement returns the first match, so only the first declaration is
reachable and this one is dead weight

lint-red-proof-second-parent -> variant "ternary-bonsai-8b-q2-g64":
already offered as a variant by "ternary-bonsai-8b"

Entries 1282 to 1274, exactly 8 lost, all 1274 names now unique. A resolved-entry diff confirms no surviving entry has any changed field, and no name was lost or gained beyond the removals. No dangling variant references afterwards.

Anchor check: all 16 blocks were scanned for anchor definitions and merge references before deleting. None of the sixteen defines an anchor or pulls one in; the index's real anchors all sit on entries outside every duplicated pair. Deleting the wrong copy of an anchored entry would have broken its merging children, so this was checked rather than assumed.

core/gallery 324 specs pass, core/gallery/importers and core/http/routes ok, make lint 0 issues, build and vet and gofmt clean.

Assisted-by: Claude:claude-opus-4-8 [Claude Code]

gallery/index.yaml declared eight names twice: deepseek-r1-distill-llama-8b,
llama3.2-3b-enigma, qwen3-asr-0.6b, qwen3-asr-1.7b, qwopus-glm-18b-merged,
voice-en-us-kathleen-low, whisper-large-q5_0 and whisper-small-q5_1.

FindGalleryElement resolves a reference by returning the first match, so in
every pair the second copy was unreachable: it could not be installed, could
not be selected as a variant target, and could not be corrected, because any
edit to it went to a copy nobody reads. A reference to such a name is also
ambiguous to anything reasoning over the catalog, which is why the variant
proposal job refuses to propose against them.

Each pair was compared both as parsed entries and as raw text, and all eight
were byte-identical apart from position. None of the sixteen blocks defines a
YAML anchor or pulls one in with a merge key, so nothing was reachable only
through a deleted block, and no entry named a removed copy as a variant target.
Removing the second copy of each therefore changes no behaviour: the parsed set
loses exactly eight entries and every surviving entry is field-for-field
unchanged.

The removal is textual, by line range, so the diff is pure deletions rather than
a reflow of forty thousand lines.

checkNoDuplicateEntryNames is the rule that keeps them out, added beside the
existing gallery invariants and reporting in the same style.

checkSingleVariantClaim closes the adjacent gap in the same place. VariantParents
resolves a build claimed by two parents by taking the first in gallery order and
calls that deterministic "for a gallery the linter would reject", but nothing
rejected it: the invariant was held by curation alone. Now it is a rule, and the
comment describes something real. No target is doubly claimed today, so the rule
is green on arrival.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
@mudler
mudler merged commit a4bab71 into master Jul 20, 2026
21 of 22 checks passed
@mudler
mudler deleted the gallery-dedupe-entries branch July 20, 2026 20:59
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.

2 participants