Skip to content

fixture: one table for the architecture-to-directory map; a named deferral for a gate that needs an env variable - #402

Closed
midagedev wants to merge 2 commits into
mainfrom
b2-fixmap
Closed

midagedev wants to merge 2 commits into
mainfrom
b2-fixmap

Conversation

@midagedev

Copy link
Copy Markdown
Owner

What and why

Two commits.

1. tools/fixture-dirs.tsv is the one table of the architecture-to-fixture-directory map. The map was code three times (crates/refset/src/fixture.rs DIRS, crates/model/src/bin/fixture.rs SOURCES.family, the case in tools/ref/ref-paths.sh) and was scraped from one of them by four scripts. A new family meant editing all of them. Now refset::fixture::dir_of reads the file (include_str!), the fixture bin names a family by it (Source::family), ref-paths.sh, refset-publish.sh and check-recipes.sh read it by awk, and tools/recipes.py and tools/gate-batch.sh read it with their own tsv reader instead of a regex over the shell case. A missing file, a malformed row, a repeated architecture and a none directory are named errors in each reader. bloomery-refset moves from [dev-dependencies] to [dependencies] of bloomery-model (the bin needs it; refset depends on gguf only, so no cycle).

2. A gate that needs an env variable is deferred by name. gate-gpu-qwen38-nodes-remote needs BLOOMERY_TIER_NODES; a batch that sets none ended it red with names 0 addresses, the gate one. The recipe now opens its box command with tools/ref/needs-env.sh <recipe> <VAR> (exit 67, names the variable, before a build or a lock). tools/gate-batch.sh reads the call as it reads real-only's and fixture-only's: an item whose env and the batch's BLOOMERY_BOX_ENV do not set the variable is deferred in either tier, never called, never red: rc=deferred needs-env, needs_env=<n> in the DONE line, a comment line in deferred.list. A deferral of a tier's own kind comes first.

Release notes: internal — one table for the fixture directories; a batch defers a gate that needs a variable by name.

Per-model copies

  • Removed (paths at base ce96affca): crates/refset/src/fixture.rs:46 DIRS (6 rows); crates/model/src/bin/fixture.rs:114,124,132,142,152,161 SOURCES.family; tools/ref/ref-paths.sh:96-103 case rows (8); the readers of those rows by regex or grep: tools/recipes.py:6587 (FIXTURE_CASE, FIXTURE_ROW), tools/gate-batch.sh:4700 (fixture_table()) and its fake case in the self-test tree, tools/refset-publish.sh:72 (awk over DIRS), tools/check-recipes.sh:471.
  • Added: tools/fixture-dirs.tsv, 9 rows (6 directories, 3 self), the one owner. No per-model code.

Proof

Move class (no kernel, launch or byte formula is touched; no file under crates/gpu* changed).

  • ref-paths.sh unchanged in behaviour. Base and this tree, run on 14 profiles x 2 tiers x 3 root states (full, empty, two first shards) x 2 modes (FIXTURE_NEW unset and set) = 168 cases: 138 give identical variables, messages and exit codes. The other 30 are the five profiles with no row in the fixture tier; they differ in one message, (the table in …/ref-paths.sh) became (no row in …/fixture-dirs.tsv).
  • FAIL-first by a mutant on the table (each edits tools/fixture-dirs.tsv only; the clean runs before and after were green in every reader's Mac test: cargo test -p bloomery-refset fixture::, recipes.py --self-test, the fixturevariants and fixturedirs blocks of check-recipes.sh, refset-publish.sh --self-test, gate-batch.sh --self-test --part 13):
    • rename the glm5next directory: red in refset, recipes.py, the check-recipes blocks and refset-publish.
    • swap the qwen38 and v41 directories: the same four.
    • a repeated row, and a none directory: red in refset, recipes.py, gate-batch (and the check-recipes blocks for none).
    • qwen3moe from self to a directory: red in the check-recipes block.
    • drop one directory row at a time: five of the six went red in refset's tests; nemotron_h survived all five Mac tests, so this PR adds a pin for it (part 13 runs the real tree's classes and wants both Nemotron families placed in the fixture tier; FAIL-first on the dropped row), and a refset test that every architecture with a family of fixture sets has a directory. Dropping deepseek41 is red in recipes.py, check-recipes and gate-batch as well.
    • Not run: the box's fixture bin test (every_spec_has_one_source_row…, which now pins the six fetch names) against these mutants.
  • FAIL-first for needs-env (mutants of the new lines; gate-batch.sh --self-test, clean runs 101 of 101 in part 12 before and after): no deferral at all, red 20; an empty value counted as set, 2; the batch's BLOOMERY_BOX_ENV ignored, 2; the DONE line without needs_env=, 1; the tier count taking the needs-env items, 12; no check that the call opens the box command (part 14), 4; the guard exiting 66 instead of 67, 3; the guard reading the wrong name, 3. 8 of 8 killed. The cases: deferral in either tier, solo and chain recipes, by closure, item env and batch env, an empty value, the run.log line, the DONE counter, deferred.list, a batch of deferred items only, beside a real-only item, the dry run, the five named errors, and the guard's exit codes.
  • Mac static tier (just mac-static origin/main at the rebased head c49d1508c): fmt-check, combos, check-arch, check-comments, check-defaults, check-levers, check-loads, check-ptx-names, check-records, check-rustflags, check-unsafe, check-waits rc 0. Red, not from this change: lint (68 warnings against the ratchet 41, none in a touched file; the same count is on main), and check-recipes in four self-tests that fail on the Mac (ref/cold-blocks, narrow-scan, ptx-compare; all three also fail on an export of origin/main taken before the rebase; and stack-watch, which fails under the parallel run and passes alone). Also green: recipes.py check (134 gate rows), pr-gate-lines.py --self-test, gate-batch.sh --self-test (702 of 702 on the full tree at the head).

What the narrow does here

just affected origin/main --narrow keeps the full list: 183 of 183 gate recipes. Two of the changed files select every box recipe by themselves: tools/ref/ref-paths.sh and tools/fixture-dirs.tsv are in BOX_GLOBALS (every box command sources the one and reads the other), and crates/model/Cargo.toml is a package manifest that stays whole. recipes.py reach for the changed Rust files names 100 gates through crates/refset/src/fixture.rs. I did not run just narrow on the box: with these three files it cannot narrow, and the scans would prove only that no kernel moved, which the diff shows. The batches below are the own-target gates of the changed files plus one gate per table row; the rest of the list belongs to the release train.

GPU Evidence

Box: nvidia-smi --query-gpu=name,driver_version --format=csv,noheader prints NVIDIA GeForce RTX 3090, 615.71.09 and NVIDIA RTX A6000, 615.71.09. Head c49d1508c (base 753df0aea), own remote dir ~/repo/bloomery-b2-fixmap, all jobs through the box queue, tools/gate-batch.sh --round-ledger.

Fixture tier, --list of the nine gates plus gate-gpu-qwen38-nodes-remote, second run on the warm dir: DONE total=10 red=1 tier=fixture skipped=1 wall=2278s laneA=2176s laneB=2277s deferred=30 needs_env=1. The first run's gate-gpu-lib ended rc 124 at the 900 s bound on the cold build of the new dir (DONE total=10 red=1 canary=red gate-gpu-lib unrun=7 wall=935s); nothing in it was a test failure.

command (item) job result
just gate-gpu-qwen4exp-e2e (row qwen38) s2661 rc 0, gpu-gate.sh: gate_qwen4exp_e2e ran 78 s (exit 0)
just gate-gpu-ds41-step (row v41) s2666 rc 0, gpu-gate.sh: gate_deepseek41_step ran 35 s (exit 0)
just gate-gpu-glm5next-e2e (row glm5next) s2668 rc 0, gpu-gate.sh: gate_glm5next_e2e ran 66 s (exit 0)
just gate-gpu-qwen35moe-e2e (row qwen35moe) s2676 rc 0, gpu-gate.sh: gate_qwen35moe_e2e ran 16 s (exit 0)
just gate-gpu-nemotron-h-moe-e2e (row nemotron-bolt) s2683 rc 0, gpu-gate.sh: gate_nemotron_h_moe_e2e ran 11 s (exit 0)
just gate-gpu-nemotron-e2e (row nemotron) s2681 rc 66, not from this change: the box holds no /models/fixtures/nemotron; the line is ref-paths.sh: BLOOMERY_TIER=fixture: the family 'nemotron_h' has no fixture file, no /models/fixtures/nemotron/*-00001-of-*.gguf (\fixture generate` writes it); not running it on its real file (exit 66)`, which is the row read and the directory named
just gate-fixture-budget s2672 rc 0, test result: ok. 1 passed
just gate-gpu-lib s2660 rc 0, test result: ok. 273 passed; 0 failed
just gate-gpu-gates-lib s2625 rc 0 at c49d1508c, test result: ok. 124 passed; 0 failed; 3 ignored and ok. 5 passed (skipped in the second run, green in the round ledger)
just gate-gpu-qwen38-nodes-remote none rc=deferred needs-env, no box call; the second run's DONE line counts it in needs_env=1

Real tier (--tier real), DONE total=2 red=1 wall=926s:

  • just gate-fixture s2644 rc 0: test result: ok. 2 passed and ok. 39 passed.
  • just gate-refset s2643 rc 101, not from this change: hw_refset: 192 set(s) in place, 15 failed. All 15 are sets this box does not hold (tokenizer-llama and the gemma-embedding and gemma-embedding2 sets: cannot read …/MANIFEST.tsv: No such file or directory); no fx set fails. 229 passed; 1 failed is that one hw test.

Not run: the box fixture bin's names test against table mutants (above), and the remaining gates of the 183: they ride the release train.

This PR was written by a bot (a Claude Sonnet 5.5 agent in the Claude Code harness) under the lead's direction.

🤖 Generated with Claude Code

midagedev and others added 2 commits October 17, 2026 13:14
…to-directory map

The map was code three times (refset `DIRS`, the fixture bin's `SOURCES.family`, the case in ref-paths.sh) and was scraped from one of them by four scripts. Now one file holds it:

- refset reads it by `include_str!` (`dir_of`, `first_shard_in`), and the fixture bin names a family by it (`Source::family`; refset is a regular dependency of bloomery-model);
- ref-paths.sh, refset-publish.sh and check-recipes.sh read it by awk; tools/recipes.py and tools/gate-batch.sh read it with their own tsv reader instead of a regex over the shell case;
- a missing file, a malformed row, a repeated architecture and a `none` directory are named errors in each reader.

Behaviour is the same: ref-paths.sh at base and here gives identical variables, messages and exit codes over every profile, tier and root state (but the one message that names the table).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…eds-env)

`gate-gpu-qwen38-nodes-remote` needs BLOOMERY_TIER_NODES; a batch that sets none ended it red with `names 0 addresses, the gate one`. The recipe now opens its box command with `tools/ref/needs-env.sh <recipe> <VAR>` (exit 67, naming the variable, before a build or a lock). gate-batch reads the call as it reads real-only's and fixture-only's: an item whose env and the batch's BLOOMERY_BOX_ENV do not set the variable is deferred in either tier, never called, never red: `rc=deferred needs-env`, `needs_env=<n>` in the DONE line, a comment line in deferred.list. The deferral of a tier's own kinds comes first.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@midagedev midagedev added the needs-gpu Changes code a card must check, and carries no gate run on a card label Oct 17, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo labels Oct 17, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MUST_FIX: duplicated validators, an internal constant exported as public API and a misleading node-address instruction need mechanical fixes.

Must fix

1. Share the Python table parser

tools/gate-batch.sh:4866 and tools/recipes.py:6596 independently define the same row grammar, duplicate-key check and empty-table rule. This is R14 duplication. Share the reader now, before another table change needs two edits.

Move RecipeError and fixture_table to tools/bloomery/fixture_dirs.py using this complete module. In recipes.py import both names from that module; delete their old definitions, FIXTURE_DIR_NAME and PROFILE_DEFAULT_LINE.

class RecipeError(Exception):
    """A recipe, tree or tool the parser cannot read."""


def fixture_table(dirs_text, ref_paths_text):
    import re
    rows = {}
    for n, line in enumerate(dirs_text.splitlines(), 1):
        if not line.strip() or line.startswith("#"):
            continue
        cols = line.split("\t")
        if (len(cols) != 2
                or not re.fullmatch(r"[A-Za-z0-9_-]+", cols[0])
                or not re.fullmatch(r"[a-z0-9-]+", cols[1])
                or cols[1] == "none"):
            raise RecipeError(
                f"tools/fixture-dirs.tsv: line {n} ({line!r}) is not "
                "`<family><TAB><dir>`: never `none`")
        if cols[0] in rows:
            raise RecipeError(
                f"tools/fixture-dirs.tsv: line {n}: the family "
                f"{cols[0]!r} is in the table twice")
        rows[cols[0]] = cols[1]
    if not rows:
        raise RecipeError("tools/fixture-dirs.tsv: no row")
    profile = re.findall(
        r'^: "\$\{BLOOMERY_MODEL:=\$\{BLOOMERY_REF_MODEL_PROFILE:-([A-Za-z0-9_]+)\}\}"$',
        ref_paths_text, re.M)
    if len(profile) != 1:
        raise RecipeError("tools/ref/ref-paths.sh: expected one default profile")
    return rows, profile[0]

Replace gate-batch's fixture_table with:

def fixture_table():
    if not FIXTURE_TABLE:
        sys.path.insert(0, os.path.join(root, "tools"))
        from bloomery.fixture_dirs import RecipeError, fixture_table as read_table
        try:
            with open(os.path.join(root, "tools/fixture-dirs.tsv"), encoding="utf-8") as fh:
                text = fh.read()
            with open(os.path.join(root, "tools/ref/ref-paths.sh"), encoding="utf-8") as fh:
                paths = fh.read()
            rows, _ = read_table(text, paths)
        except OSError as e:
            fail(f"{e.filename} cannot be read ({e.strerror}): the fixture tier's family table is read there")
        except RecipeError as e:
            fail(str(e))
        FIXTURE_TABLE.append(
            (set(rows), {a for a, d in rows.items() if d == "self"}))
    return FIXTURE_TABLE[0]

In its self-test setup add:

mkdir -p "$t/tools/bloomery"
cp "$(dirname "$self")/bloomery/fixture_dirs.py" "$t/tools/bloomery/fixture_dirs.py"

Update the three table-error expectations to the shared messages: fixture-dirs.tsv: no row, line 7 .*glm5next.* is not .<family><TAB><dir>., and line 7: the family .qwen4exp. is in the table twice. This removes more definitions and lines than it adds.

2. Reuse the variable-name validator

tools/gate-batch.sh:4421 duplicates the variable-name grammar in VAR at tools/gate-batch.sh:4721. R14 requires one owner; reuse the existing validator so a grammar change needs one edit.

Move the existing VAR definition to replace ENV_VAR, deleting its old declaration:

VAR = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*$")

Replace the added validation line with:

    novar = sorted({v for _, v in calls if not VAR.fullmatch(v)})

3. Keep SELF private

crates/refset/src/fixture.rs:49 adds a public API used only inside this module and its unit tests. R13 permits pub only for another crate's caller. Keep it internal before callers depend on it:

const SELF: &str = "self";

4. Document node addresses through the batch environment

justfile:2174 advertises NAME@K=V for BLOOMERY_TIER_NODES. Following it with gate-gpu-qwen38-nodes-remote@BLOOMERY_TIER_NODES=192.0.2.10:9000 makes the item parser at tools/gate-batch.sh:4720 read 9000 as recipe arguments; :5085 rejects them because this recipe takes none. This is a proven misleading comment (kind B). Correct the instruction so users can supply a node address. Replace lines 2174–2175 with:

# BLOOMERY_TIER_NODES a batch defers it by name (needs-env); a run by hand exits 67 before a build.
# Set it through BLOOMERY_BOX_ENV='BLOOMERY_TIER_NODES=192.0.2.10:9000'.

Checked

Duplicates: both table readers and variable-name validators confirmed; dryer reported no pairs.
Complexity: crapper reported no flagged function.
Silent failure: both Python readers reject malformed, duplicate and empty table rows by name.
Tests: isolated current/proposed parser checks and item-syntax reproduction passed; full suites were not run.
Gates: no thresholds moved in the supplied diff.
Escape catalog: no C1–C4 match among these findings; no ledger lessons in force. No inference hot path changed.

Notes

GPU evidence names cards, commits and gate output, but omits the model filenames required by CONTRIBUTING.md.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

const DIRS_TABLE: &str = include_str!("../../../tools/fixture-dirs.tsv");

/// A row's `dir` for a family with no fixture file of its own: a command runs on the profile's file, and there is no directory.
pub const SELF: &str = "self";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R13: SELF is used only inside this module and its unit tests; keep the constant private.

Suggested change
pub const SELF: &str = "self";
const SELF: &str = "self";

@midagedev

Copy link
Copy Markdown
Owner Author

Superseded by #507 (rebased onto main).

@midagedev midagedev closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant