Skip to content

tools/ci: census_counters_check reads architectures.json flat, so it reports 33/1042 every day on a correct tree (26/478) #3041

Closed

Description

@bong-water-water-bong

The row has been red for days, and the snapshot it accuses is correct. tools/ci/census_counters_check.py reads registry/architectures.json flat; the committed file nests its classes under "architectures". So archs.get(hf) finds no entry for any class, every watch: "report" class counts as declined, and the row disagrees with a correct snapshot on every run. The tempting repair — editing registry/census.json to the number the check computes — would bake the bug into the data.

Measured on main (78c3783):

$ python3 tools/ci/census_counters_check.py --check ; echo rc=$?
  declined_architectures: the snapshot says 26, this tree computes 33
  declined_models:        the snapshot says 478, this tree computes 1042
rc=1

# the same numbers, computed the way tools/census.py computes them
$ python3 -c "…watch=='report' and not a_get(archs, hf)…"
significant.json classes: 47 | watch=report: 33
declined (watch=report and no backends): 26 | snapshot says 26
declined models computed: 478 | snapshot says 478        ← the file on disk is right

Cause. registry/architectures.json is {"about", "sources", "counts", "architectures", "gguf_architectures"}. Every other reader unwraps it — tools/census.py:80 (["architectures"], then the identical predicate at :124-125), tools/census_watch.py:249, tools/registry_build.py:223 — and the check is the only one that indexes the whole file. Its docstring even says "tools/census.py:125 exactly".

Why it stayed invisible. Three reasons, and the third is the interesting one:

  1. It runs in census.yml:76 (the daily census), not in PR CI — deliberately, per engine#2850/ci: check the census snapshot's two tree-derived counters (engine#2850) #2852.
  2. Since engine#2852 the disagreement is a ::warning:: that still opens the census PR, so nothing goes red and nobody reads it.
  3. The check's own self-test cannot see it, because its fixture writes a flat architectures.json while the committed file nests. With the flat lookup and a flat fixture, the code and its test agree with each other and both disagree with the repository — which is why --self-test ok and --check rc 1 have coexisted every day.

Fix (draft PR, one line + the arm that would have caught it): unwrap "architectures" (tolerating a flat file), and give the fixture the committed file's shape plus a watch: report class that has a backend — the one shape a flat lookup gets wrong. Control, with the fixture fixed and the lookup reverted:

FAIL a consistent snapshot passes  [[('declined_architectures', 1, 2), ('declined_models', 7, 12)]]
self-test FAILED (2)          ← the live row's 26 vs 33 / 478 vs 1042, in miniature

With both changes: census-counters: both tree-derived counters match the registry, rc 0, self-test ok.

No data change is needed: registry/census.json's 26/478 are correct for this tree.

Activity

  1. bong-water-water-bong commented on Nov 20, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Confirmed independently, and the two numbers reproduce exactly: the checker says 33, the tree computes 26, and the seven-class difference is nameable.

    Where the two disagree, from main:

    tools/ci/census_counters_check.py:49   archs = json.loads((root / REG / "architectures.json").read_text(…))   # whole file
    tools/ci/census_counters_check.py:59   … if entry.get("watch") == "report" and not (archs.get(hf) or {}).get("backends")
    tools/census.py:80                     archs = json.load(open(os.path.join(REG, "architectures.json")))["architectures"]  # nested

    registry/architectures.json's top level is about, sources, counts, architectures, gguf_architectures — the 350 classes are under "architectures". So the checker's archs.get(hf) looks up class names among five metadata keys, gets None for all 47 watch: "report" classes, and counts every one of them as declined.

    Measured both ways on main's own tree, no build:

    significant classes                              47
    declined with the checker's FLAT lookup          33
    declined with the NESTED lookup (census.py:80)   26
    classes wrongly reported declined: DFlash2DraftModel, DeepseekV41ForCausalLM, Glm5NextForConditionalGeneration,
      GraniteSwitchForCausalLM, HrmTextForCausalLM, Lfm3ForCausalLM, …            (7 in total)
    

    Lfm3ForCausalLM is the one that makes this more than a counter: it is mapped ("gguf": "lfm3", backends: ["hrx"] — and it ran, engine#2918), so the daily red row currently claims the fleet's newest served family is unmapped.

    The fix is one expression, and it should be made in the place that owns the shape rather than duplicated: archs = json.loads(…)["architectures"] at :49, which makes declined_classes() agree with tools/census.py:80 by construction — the docstring already says it is that function "exactly", and today it is not. A KeyError on a malformed file is the right failure here (the checker would rather be cannot-tell than confidently wrong).

    One caveat worth carrying into the fix: census.py:80 does ["architectures"] with no .get, so it already throws on a file without that key — matching it exactly means the checker inherits that, which is the behaviour you want for a counters check.

  2. added
    bug
    on Nov 20, 2026
  3. bong-water-water-bong commented on Nov 20, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Already fixed by #3046 — I worked this one for twenty minutes before noticing, so recording what the two versions share and where they differ, and closing the duplicate work rather than the issue.

    Verified on #3046's head (3afb8c40):

    $ python3 tools/ci/census_counters_check.py --check
    census-counters: both tree-derived counters match the registry        rc=0
    $ python3 tools/ci/census_counters_check.py --self-test
    ok   a FLAT architectures.json is cannot-tell, not a tree of declined classes
    self-test ok
    

    So the row is green and, more importantly, the failure mode is now refused rather than mis-counted: a flat architectures.json — the shape this tool was written against — is cannot-tell, not a tree where every report class is declined. That is a stronger answer than accepting both shapes, which is what my version did: mine would have silently kept working on a file that no longer has the nested key, i.e. it would have hidden the next shape change the way this one was hidden.

    Two things from my run that may be useful to keep:

    1. The two numbers on main before the fix: declined_architectures: the snapshot says 26, this tree computes 33 and declined_models: … 478 … 1042. Worth having in the row's record because they are what a reader sees when the check is red, and the issue's title only names the second.
    2. The tempting repair is worth naming in the code: editing registry/census.json to 33/1042 would bake the bug into the data and leave a snapshot that no correct tree can ever match. The issue says it; a comment at the classes_of/raw_archs site says it to whoever is holding the file.

    My duplicate is closed — I had a cl-infra/3041-census-nested branch with a classes_of() that accepted both shapes plus an arm, and it is deleted rather than pushed, since one PR per issue and yours is better on the exact point that matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions