Skip to content

loom coverage: --manifest resolves the stick's own ids (engine#3156) - #3510

Merged
bong-water-water-bong merged 1 commit into
mainfrom
loom-coverage-manifest-fix
Nov 25, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
loom-coverage-manifest-fix

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

#3509's --manifest was written against a manifest I synthesised from the checklist's row names, and against the real file it resolves nothing:

$ python3 tools/ci/loom_coverage_check.py --manifest /etc/1bit/onebit-models.txt --cards …
loom_coverage: 24 shipped id(s) resolve to no pinned file, so no row could be classified for them:
GLM-4.7-Flash-1bit, Inkling-2-Mini-1bit, LFM2-1.2B-1bit, MiniCPM-V-4.6-1bit, MiniCPM5-1B-1bit …

The stick's ids carry the distribution's own suffix (GLM-4.7-Flash-1bit), and the first cut only stripped -gguf, so no id matched a pinned file name. That is a broken feature the tests did not catch because the test input was the wrong shape.

Fix

  • Strip the catalogue suffixes -1bit, -npu, -gguf from the id before resolving.
  • Resolve on stem + quant spec, not on a prefix: qwen3-4b-q4_k_m.gguf is Qwen3-4B, while qwen3-4b-instruct-2507-q4_k_m.gguf is a different model that merely starts with the same text. _is_quant_spec() matches the quant first and requires whatever it leaves over to be a size qualifier (ud, xl, xs, xxs).

Against the real file

/etc/1bit/onebit-models.txt as shipped on the box (24 hrx + 2 npu ids), card trees = the corpus + cards-staging + the staged 1bit-* cards:

COVERED          glm-4.7-flash-q4_k_m.gguf                  1bit-GLM-4.7-Flash (Q4_K_M) sha256 29837ed2c0fc
REQUANT          glm-4.7-flash-ud-q4_k_xl.gguf              1bit-GLM-4.7-Flash has ['Q4_K_M'], we ship UD_Q4_K_XL
DIFFERENT-UPLOAD inkling-2-mini-ud-q4_k_xl.gguf             unsloth-Inkling-2-Mini-loom binds e62d463c135f
UNCOVERED        lfm2-1.2b-q4_k_m.gguf                      no card names this model
UNCOVERED        minicpm5-1b-q4_k_m.gguf                    no card names this model
COVERED          qwen2.5-coder-1.5b-instruct-q4_k_m.gguf    Qwen2.5-Coder-1.5B-Instruct-GGUF-loom sha256 cc324af070c2
COVERED          qwen2.5-coder-7b-instruct-q4_k_m.gguf      Qwen2.5-Coder-7B-Instruct-GGUF-loom sha256 509287f78cb4
COVERED          qwen3-0.6b-q4_k_m.gguf                    unsloth-Qwen3-0.6B-loom sha256 ac2d97712095
REQUANT          qwen3-0.6b-q8_0.gguf                      unsloth-Qwen3-0.6B-loom has ['Q4_K_M'], we ship Q8_0
DIFFERENT-UPLOAD qwen3-1.7b-q4_k_m.gguf                    ggml-org-Qwen3-1.7B-loom binds d2387ca2dbfe
REQUANT          qwen3-1.7b-q8_0.gguf                      ggml-org-Qwen3-1.7B-loom has ['Q4_K_M'], we ship Q8_0
DIFFERENT-UPLOAD qwen3-4b-q4_k_m.gguf                      ggml-org-Qwen3-4B-loom binds ab27b9bfa375
COVERED          qwen3-4b-instruct-2507-q4_k_m.gguf        unsloth-Qwen3-4B-Instruct-2507-loom sha256 3605803b982c
COVERED          qwen3-8b-q4_k_m.gguf                      unsloth-Qwen3-8B-loom sha256 120307ba529e
DIFFERENT-UPLOAD qwen3-coder-30b-a3b-instruct-q4_k_m.gguf  ggml-org-…-Coder-30B-…-loom binds f6050b4da228
UNCOVERED        qwen3-embedding-0.6b-q8_0.gguf            no card names this model
COVERED          qwen3.5-4b-ud-q4_k_xl.gguf                Qwen3.5-4B-GGUF-loom sha256 b252c5610a42
COVERED          qwen3.8-27b-ud-q4_k_xl.gguf               unsloth-Qwen3.8-27B-UD-Q4_K_XL sha256 2a5f3565f39c
UNCOVERED        zaya1-8b-f16.gguf / zaya1-8b-q4_k_m.gguf  no card names this model
UNCOVERED        bge-reranker-v2-m3-q8_0.gguf              no card names this model
REQUANT          gpt-oss-20b-mxfp4.gguf                    unsloth-gpt-oss-20b-loom has ['Q4_K_M'], we ship MXFP4
loom_coverage: 8 of 8 row(s) compared on BYTES

18 of 24 ids resolve; the 6 that do not — MiniCPM-V-4.6, Qwen3-Reranker-0.6B, ZAYA1-8B-PM, flint-40b-a2.5b, jina-reranker-v1-tiny-en, nomic-embed-text-v2-moe — are printed as unresolved rather than matched by eye, which is the honest answer for ids whose pinned files are not named after them.

Note what the expansion shows: an id can legitimately own several pinned files (the 0.6B/1.7B q8_0 rows, GLM's ud-q4_k_xl, zaya's f16), so the map reports a verdict per FILE, not per catalogue entry. A "shipped" row that pins two quants gets two answers, and the REQUANT lines above are that mechanism working — the card covers the model on one quant and not the other.

Self-test: 11 ok, 0 failed, unchanged. It does not yet cover the manifest path — that is the follow-up I owe (the arms are verdict-shaped, and a manifest arm needs a fixture manifest plus a pins file), and it is the reason the wrong input shape got through the first time.

The manifest this was written for is the stick's /etc/1bit/onebit-models.txt, whose ids carry the
distribution suffix ('GLM-4.7-Flash-1bit'), so the first cut resolved 0 of 24 ids. Strip the
catalogue suffixes (-1bit/-npu/-gguf) and require the remainder after the id to be a QUANT spec,
not any prefix: 'qwen3-4b-q4_k_m.gguf' is Qwen3-4B, 'qwen3-4b-instruct-2507-q4_k_m.gguf' is not.

Against the real file: 18 of 24 ids resolve, 6 are reported unresolved rather than guessed, and the
map now answers for the shipped catalogue. Self-test unchanged (11 ok, 0 failed).
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incorrect model name resolution

The fix introduces logic to strip catalogue suffixes (-1bit, -npu, -gguf) from model IDs before resolution. However, the new _named_by function and the logic in rows_from_manifest may not correctly handle cases where a model ID and a file name have overlapping prefixes but are actually different models (e.g., qwen3-4b-instruct-2507-q4_k_m.gguf vs qwen3-4b-q4_k_m.gguf). This could lead to incorrect matches and misclassification of models.

def _named_by(basename, key):
    """True when a pinned FILE belongs to catalogue id `key`: the stem is the id, or the id plus a quant spec."""
    if basename == key + ".gguf":
        return True
    if not basename.startswith(key + "-"):
        return False
    rest = basename[len(key) + 1 : -len(".gguf")] if basename.endswith(".gguf") else basename[len(key) + 1 :]
    return _is_quant_spec(rest)


def rows_from_manifest(manifest_rows, ours):
    """(rows, unresolved): the shipped catalogue as (device, model FILE) rows.

    A catalogue id names a MODEL, and every verdict this tool makes is about a FILE (the bytes a card binds),
    so an id is resolved to the files we pin for it. The pin records basenames; an id is either a file stem
    (`Qwen3-4B-Q4_K_M`) or a repo name (`unsloth/Qwen3-4B-GGUF`), so the last path segment is the key, with a
    trailing `-gguf` dropped. An id that resolves to nothing is reported as unresolved rather than guessed at:
    a coverage claim that rests on a name match is the trap this tool exists to avoid.
    """
    names = (ours or {}).get("names") or set()
    rows, unresolved = [], []
    for device, model_id in manifest_rows:
        if device != "hrx":
            continue  # the NPU route is a different map (docs/npu.md); this tool reports HRX rows only
        key = model_id.split("/")[-1].lower()
        # A catalogue id carries the distribution's own suffix (`Qwen3-4B-1bit` in the stick's Lemonade ids,
        # `unsloth/Qwen3-4B-GGUF` in a repo id); neither is part of the model name.
        for suffix in ("-1bit", "-npu", "-gguf"):
            if key.endswith(suffix):
                key = key[: -len(suffix)]
        if key.endswith(".gguf"):
            rows.append((device, key))
            continue
        hits = sorted(n for n in names if _named_by(n, key))
        if not hits:
            unresolved.append(model_id)
        rows.extend((device, n) for n in hits)

@bong-water-water-bong
bong-water-water-bong merged commit cae768d into main Nov 25, 2026
12 of 13 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the loom-coverage-manifest-fix branch November 25, 2026 09:29
bong-water-water-bong pushed a commit that referenced this pull request Nov 25, 2026
…#3156)

#3510 fixed --manifest to resolve the stick's own ids, but the self-test had no arm for that path -- which is
exactly why the wrong input shape shipped in #3509: it was validated against a manifest synthesised from the
issue's row names, and against the real file it resolved 0 of 24 ids and printed an empty map that read like a
clean one.

This adds arm()'s manifest counterpart, manifest_arm, which asserts the resolved (device, model) ROWS and the
unresolved list rather than only the verdict, because "no rows" is a state a verdict-only arm cannot see. 11 arms:

- the stick's -1bit suffix is the distribution's, not the model name (hrx GLM-4.7-Flash-1bit)
- a resolved id earns a real verdict (COVERED on bytes), and can still be DIFFERENT-UPLOAD
- an id resolves on stem + quant spec, not prefix: qwen3-4b must not claim
  qwen3-4b-instruct-2507-q4_k_m.gguf
- a repo-style id ending -GGUF resolves; a bare .gguf id is a file name
- an id we pin nothing for is reported unresolved, never name-matched
- npu rows are skipped, and are not counted as unresolved either
- one id owning several pins yields one row per file (the REQUANT mechanism)
- mode=, comments, blank and junk lines are not rows

The card-writing half of arm() is factored into make_card() so both arms build the same tree; no existing arm
changes behaviour (11/11 still pass unchanged).

Control: with rows_from_manifest reverted to the #3509 resolver, the new self-test reports 17 ok / 5 failed --
the three -1bit arms resolve to nothing (rows [], unresolved ['GLM-4.7-Flash-1bit']), the instruct arm does the
same, and the prefix arm resolves BOTH files for Qwen3-4B (qwen3-4b-instruct-2507-q4_k_m.gguf and
qwen3-4b-q4_k_m.gguf), i.e. it claims the instruct model's bytes for the base model. Against the fixed resolver:
22 ok, 0 failed.

Real artifact, unchanged by this commit: --manifest on /etc/1bit/onebit-models.txt as the box generates it
(24 hrx ids) still resolves 18 of 24, with 6 reported unresolved (MiniCPM-V-4.6, Qwen3-Reranker-0.6B,
ZAYA1-8B-PM, flint-40b-a2.5b, jina-reranker-v1-tiny-en, nomic-embed-text-v2-moe) and 5 rows COVERED on bytes.

pre-pr-checks.sh --tree-only --base origin/main: 15 green, 3 skipped, 0 could not be told.
bong-water-water-bong added a commit that referenced this pull request Nov 25, 2026
…#3156) (#3511)

#3510 fixed --manifest to resolve the stick's own ids, but the self-test had no arm for that path -- which is
exactly why the wrong input shape shipped in #3509: it was validated against a manifest synthesised from the
issue's row names, and against the real file it resolved 0 of 24 ids and printed an empty map that read like a
clean one.

This adds arm()'s manifest counterpart, manifest_arm, which asserts the resolved (device, model) ROWS and the
unresolved list rather than only the verdict, because "no rows" is a state a verdict-only arm cannot see. 11 arms:

- the stick's -1bit suffix is the distribution's, not the model name (hrx GLM-4.7-Flash-1bit)
- a resolved id earns a real verdict (COVERED on bytes), and can still be DIFFERENT-UPLOAD
- an id resolves on stem + quant spec, not prefix: qwen3-4b must not claim
  qwen3-4b-instruct-2507-q4_k_m.gguf
- a repo-style id ending -GGUF resolves; a bare .gguf id is a file name
- an id we pin nothing for is reported unresolved, never name-matched
- npu rows are skipped, and are not counted as unresolved either
- one id owning several pins yields one row per file (the REQUANT mechanism)
- mode=, comments, blank and junk lines are not rows

The card-writing half of arm() is factored into make_card() so both arms build the same tree; no existing arm
changes behaviour (11/11 still pass unchanged).

Control: with rows_from_manifest reverted to the #3509 resolver, the new self-test reports 17 ok / 5 failed --
the three -1bit arms resolve to nothing (rows [], unresolved ['GLM-4.7-Flash-1bit']), the instruct arm does the
same, and the prefix arm resolves BOTH files for Qwen3-4B (qwen3-4b-instruct-2507-q4_k_m.gguf and
qwen3-4b-q4_k_m.gguf), i.e. it claims the instruct model's bytes for the base model. Against the fixed resolver:
22 ok, 0 failed.

Real artifact, unchanged by this commit: --manifest on /etc/1bit/onebit-models.txt as the box generates it
(24 hrx ids) still resolves 18 of 24, with 6 reported unresolved (MiniCPM-V-4.6, Qwen3-Reranker-0.6B,
ZAYA1-8B-PM, flint-40b-a2.5b, jina-reranker-v1-tiny-en, nomic-embed-text-v2-moe) and 5 rows COVERED on bytes.

pre-pr-checks.sh --tree-only --base origin/main: 15 green, 3 skipped, 0 could not be told.

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant