gallery: remove duplicated entries and lint against them recurring#10996
Merged
Conversation
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>
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.
What this does
Removes 8 duplicated entries from
gallery/index.yamland adds the lint rules that keep them out.FindGalleryElementreturns 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_0andwhisper-small-q5_1are 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.
VariantParentsincore/gallery/collapse_variants.goresolves 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
VariantParentsactually skips (dangling, nested and self references), so it does not double-report breachescheckVariantReferencesalready 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:
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/gallery324 specs pass,core/gallery/importersandcore/http/routesok,make lint0 issues, build and vet and gofmt clean.Assisted-by: Claude:claude-opus-4-8 [Claude Code]