Skip to content

tools: resolve model profiles and keep failed-arm logs unique - #736

Merged
juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:fix-tool-input-paths
Oct 23, 2026
Merged

juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:fix-tool-input-paths

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

레시피 입력 목록이 모델 프로필 파일을 정확히 따라가도록 고치고, 실패한 arm의 로그가 서로 덮어쓰이지 않게 하는 도구 수정입니다.

Part of #565. Tracked in #699.

What and why

Two defects in the workspace tools, both fixed here.

  1. Recipe inputs named a profile file that does not exist. A recipe that selects its model as BLOOMERY_MODEL=${BLOOMERY_MODEL:-name} had the literal text turned into tools/ref/models/${BLOOMERY_MODEL:-name}.sh. The real profile was never listed as an input, so a change to it did not invalidate the recipe's key. The same raw text fed the run-script list and the fixture-directory choice, and a recipe with several box calls only kept the last call's profile. RecipeCommands.profiles in tools/recipes.py is now the one place that resolves profile names. It tells a default (${BLOOMERY_MODEL:-name}) from an environment override, keeps every profile of a multi-call recipe, and raises an error that names BLOOMERY_MODEL for any expression or path fragment it cannot resolve. Graph.inputs, KeyContext.run_scripts, the key's file list and the fixture-directory choice all call it. Static analysis keeps a recipe parameter such as {{FAMILY}} as a whole tools/ref/models/ dependency, as before.
  2. The log name of an arm that errors could collide or exceed the filename limit. arm_fail in tools/ref/cold-blocks.sh built the file name from the label and key, so two labels that differ only by a character the name rewrites (a/b and a:b) shared one file, a retry of the same label overwrote the earlier log, and a long label made the write fail. The log is now created with mktemp, so the name is short and unique. Its first line records the round, label, key and exit code, and the full output follows. If the file cannot be created or written, the FAIL row says cannot save full output and names no path.

The arm-log defect came in with a969d43 and moved to the shared helper in e489392. The profile defect came in with e505aa2.

No Rust, GPU or engine path changes, and nothing about speed is claimed.

Release notes: Fixed: recipe input keys follow the real model profile files, and an erroring cold-block arm keeps its own full log.

Code shape

  • No second copy. One method resolves profile names for the recipe graph, the run scripts, the key's file list and the fixture choice. It reuses FAMILY_NAME and RecipeError.
  • Model code holds only architecture facts. No model file changed.
  • Dead code is gone. The per-call BLOOMERY_MODEL lookups in Graph.inputs and KeyContext that built a path from raw text are replaced by the one method.
  • No silent failure. An unsupported profile expression is an error naming BLOOMERY_MODEL, and a log save that cannot complete is stated in the FAIL row.
  • Comments state what is true now.
  • No relaxed gate. No band, tolerance or lint moved.
  • cargo fmt and cargo clippy: not applicable, the change is in Python and Bash only.

Duplication found or removed (path:line): none found. python3 tools/dup-scan.py finds no Rust candidates.

What I ran

The tests are in the two files' own self-tests: tools/ref/cold-blocks.sh --self-test gained cases for name collisions, a repeated label, a 300-character label, a key that contains a slash, and a create that cannot complete and a write that cannot complete. tools/recipes.py gained profile_inputs_self_test, run from the basics self-test. It covers a plain name and the default form, each with no override, an empty override and a real override. It covers two box calls in one recipe, unresolved expressions (${OTHER:-deepseek41}, $BLOOMERY_MODEL, ../deepseek41), and the real recipes bench-cpu-v41-host-check, time-cpu-v41-host, depth-gpu-qwen3moe and time-dma-dram.

These tests were first run against the original arm_fail and the original profile reader. Both fail:

self-test: FAIL (12 failures)
FAILFIRST final tests with base arm_fail: rc=1
FAILFIRST final profile tests with base: failures=13

On this head, on a Linux CPU host:

bash -n tools/ref/cold-blocks.sh        rc 0
bash tools/ref/cold-blocks.sh --self-test
self-test: ok (0 failures)
profile-inputs: 0 failures
key-self-test: 0 failures
FINAL base_rc=0 syntax_rc=0 cold_rc=0 profile_rc=0

git diff --check is clean. The wider tools/check-*.sh scripts were not run here; they are the maintainers' checks.

Hardware

None needed. The checks ran on a Linux CPU host and use no GPU.

What I ran into

An expression other than a plain name or ${BLOOMERY_MODEL:-name} now stops the recipe key with an error. The four recipes listed above, which use the default form or several box calls, resolve without error. This does not block the PR.

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

@github-actions github-actions Bot added the tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo label Oct 23, 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: fixture selection retains a second inherited-profile validator after adding the shared resolver.

Must fix

1. Remove the duplicate inherited-profile validator

tools/recipes.py:8329 repeats the validation in profiles(). For an invalid inherited name, that method raises RecipeError and the handler immediately below returns the same None. The extra branch and mac variable have no effect. This is a kind B defect under R14.

Remove them now so subsequent profile-rule changes have one owner. Replace lines 8327–8331 with:

        rows, _ = self._fixture_table
        dirs: set[str] = set()

Checked

Duplicates: both cited validators confirmed. The fix removes the extra check and variable without adding an abstraction.
Complexity: no changed Rust functions; diagnostics report that dryer and crapper did not run.
Silent failure: the inherited-profile error path returns the same None through the existing RecipeError handler. The fixture-table parser guarantees a valid fallback name.
Tests: the validator compared 25 isolated fixture-selection cases before and after the proposed removal; all matched.
Gates: no threshold or tolerance moved; the PR supplies FAIL-first results for both fixes.
Escape catalog: C1–C4 provide no exception affecting this finding. No ledger lessons are in force.

Notes

Full self-tests were not run by the validator; validation used isolated in-memory checks.

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

@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.

Since the last review: must-fix 1 is fixed. tools/recipes.py:8327 removes the duplicate validator and its variable. profiles() owns profile validation.

Verdict: CLEAN: the interdiff resolves the earlier finding and preserves fixture selection in the checks performed.

Checked

Duplicates: 0 new items; the duplicate validation is removed. No dryer pairs were available.
Complexity: the existing function loses a branch; no function is added.
Silent failure: 2 error paths followed. Unresolved fixture selection retains all fixture rows; key construction returns the named profile error.
Tests: the validator confirmed 120 isolated before/after fixture-selection cases matched, including invalid and empty overrides, multiple calls, and unresolved parameters. Seven fallback and table-loading checks passed. No tests changed in the interdiff; no new mutation check applies.
Gates: no pins, thresholds, or test clauses changed in the interdiff.
Escape catalog: C1–C4 do not match the interdiff. No ledger lessons are in force.

Notes

Dryer and crapper did not run because no Rust file changed. Full self-tests were not rerun; validation used production functions extracted and executed in memory.

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

@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

@juliankang4
juliankang4 merged commit 77ac46c into midagedev:main Oct 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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