Skip to content

ci: the fork's recorded-stale table runs from the engine's suite (engine#2836) - #2837

Closed
bong-water-water-bong wants to merge 1 commit into
mainfrom
pi-prs/hrx-stale-expectations
Closed

bong-water-water-bong wants to merge 1 commit into
mainfrom
pi-prs/hrx-stale-expectations

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Claiming engine#2836 — "the pinned fork's ctest never runs: 43 test-hrx-* rows are registered and unexecuted, and the #419 stale-expectation check is one of them." The issue had no row in ISSUE-OWNERS.md.

Draft on purpose: engine holds more than three non-draft PRs against the CI cap; this flips to ready when a slot frees.

What it does

add_test(NAME hrx_stale_expectations COMMAND ${CMAKE_SOURCE_DIR}/tests/hrx_stale_expectations.sh ${CMAKE_SOURCE_DIR})
set_tests_properties(hrx_stale_expectations PROPERTIES SKIP_RETURN_CODE 77)

tests/hrx_stale_expectations.sh runs the fork's check_stale_expectations.py --check --root <fork> — the table of kernel names tests/hrx-ops-test.cpp demands and no matcher selects (engine#2774), device-free, about a second.

Why a wrapper and not the one-liner the issue proposed

The tool lives in the submodule, so it is absent in a tree without third_party/llama.cpp checked out, and at every pin before llama.cpp#419. Both of those are facts about the checkout, not about the table, so they must be a skip (77) with the reason printed — a row that returned 0 with no tool would be the "a check that cannot run reports success" defect this suite keeps removing (the same shape as hrx_f16_narrowing_check's 77).

The tool's own codes stay untouched:

rc 0  every recorded name is unselectable and still exported
rc 1  an entry is wrong
rc 2  cannot tell -- a file it needs is missing      -> stays a FAILURE here

2 is deliberately not mapped to a skip: at this point the tree exists, so a missing hrx-ops-test.cpp or a missing table is drift, not an absent corpus.

Measured, both paths plus the failure path

submodule at 8cb8fb64d (main's pin; the tool does not exist yet)  -> rc 77, reason printed
submodule at ddd415f4a (pending #2834)                            -> rc 0
    "stale-expectations: 31 recorded, every one exported by a corpus and selected by no matcher"
tool present but tests/hrx-ops-test.cpp absent                     -> rc 2 (a failure, not a skip)

One correction to the issue, and it makes the change smaller

The issue's one-liner would have failed rather than run, for a reason I got wrong myself first: I assumed CI does not check out submodules, and it does — ci.yml already has "The llama.cpp sources the chat-template renderer compiles: git submodule update --init --depth 1 third_party/llama.cpp" (~180 MB, 8 s). So no workflow change is needed: the row has its tool wherever CI runs, and it starts running for real the moment #2834's pin lands (at main's current pin the tool does not exist yet, so today it skips — visibly, with the reason).

That also means hrx_f16_narrowing_check — registered with SKIP_RETURN_CODE 77 for the same reason — does run in CI today. Worth knowing before anyone "fixes" it.

What this does not do

The other 42 test-hrx-* rows mostly need a device and should stay out of CI (they skip 77 without one). Auditing that subset for further host-runnable rows is #2836's follow-up, not this PR.

copyright --check clean; tests_referenced_check.py clean (110/110 referenced); bash -n clean.

…ine#2836)

llama.cpp#419 added `ggml/src/ggml-hrx/tools/check_stale_expectations.py` to the fork --
the kernel names tests/hrx-ops-test.cpp demands and no matcher selects, which is
engine#2774's question answered without a device. The fork has no CI job: 48 ctest rows
are registered there at the pin, 43 of them `test-hrx-*`, and `git run list` shows the
last fork run on 2026-10-08. So the check runs only when a person types it -- and when I
typed it by hand it corrected an error of my own (I had reported entries as "absent from
the corpus" on a filename search; the corpus's .loom filenames are not kernel ids).

This registers it in the ENGINE's suite, which does run on every PR:

  add_test(NAME hrx_stale_expectations COMMAND tests/hrx_stale_expectations.sh <root>)
  set_tests_properties(hrx_stale_expectations PROPERTIES SKIP_RETURN_CODE 77)

The wrapper exists for one reason: the tool comes from the pinned submodule, so it is
absent in a tree without `third_party/llama.cpp` checked out AND at any pin before
llama.cpp#419. Both are facts about the CHECKOUT, so they skip (77) with the reason
printed; a row that returned 0 with no tool would be the "check that cannot run reports
success" defect this suite keeps removing. The tool's own codes stay: 1 an entry is
wrong, 2 it cannot tell (a missing table at a tree that exists is drift, not an absent
corpus, so 2 is a failure here).

Measured in a worktree, both paths and the failure path:

  submodule at 8cb8fb64d (main's pin, the tool does not exist yet) -> rc 77, reason printed
  submodule at ddd415f4a (pending #2834)  -> "stale-expectations: 31 recorded, every one
                                             exported by a corpus and selected by no matcher"  rc 0
  tool present, tests/hrx-ops-test.cpp absent -> rc 2 (a failure, not a skip)

ci.yml needs no change: it already fetches the submodule for the chat-template renderer
("The llama.cpp sources the chat-template renderer compiles", --depth 1, ~180 MB, 8 s),
so the row has its tool wherever CI runs. `--depth 1` at a pinned sha was checked here
and works over https, which is what .gitmodules specifies.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at ce9599e: READY. It is the row I asked for in #2836, and it survives the check I said was missing last time: this one actually executes on CI, which I verified rather than assumed.

The wrapper keeps the tool's codes, and skips for a reason

if [ ! -f "$tool" ]; then
    printf '%s\n' "hrx_stale_expectations: skip -- no $tool (submodule not checked out, or a pin before llama.cpp#419)" >&2
    exit 77
fi
exec python3 "$tool" --check --root "$fork"

exec replaces the shell, so 0 / 1 / 2 all propagate verbatim — no swallowing, no || true, no "the check ran" claimed by a wrapper that dropped the answer. And the skip names its two causes (submodule not checked out, a pin before the tool existed) instead of a bare 77, with the principle written down: "a row that returned 0 with no tool would be the 'check that cannot run reports success' defect this suite keeps removing." That is the #2749/#419 lesson applied before anyone had to ask.

The 2 decision is also the right one and is explained where it is made: "2 stays a failure here, because at this point the tree exists and a missing table is drift, not an absent corpus." And unlike slot_cmp.py, this tool's 2 is genuinely reachable — I measured rc=2 from it myself at a pin before the table existed ("cannot tell: no kRecordedStaleExpectations table"), so the branch the wrapper keeps is a branch that happens.

It will actually run — verified, because that was my last retraction

On #419 I claimed CI ran a registered row and it did not. So this time I checked the mechanism end to end:

$ bash tests/hrx_stale_expectations.sh ~/wt/pm856-engine
hrx_stale_expectations: skip -- no …/third_party/llama.cpp/ggml/src/ggml-hrx/tools/check_stale_expectations.py    rc=77
$ grep -n 'submodule update' .github/workflows/ci.yml
77:        run: git submodule update --init --depth 1 third_party/llama.cpp

The skip above is my own worktree, which has no submodule — correct behaviour for an absent tool. On CI the submodule is fetched (ci.yml:77, and the comment there explains why: "shallow, one checkout, ~180 MB, 8 s, and it is the same commit the release build compiles"), so the tool is present and the row executes rather than skipping.

--depth 1 is safe for this tool specifically: it reads the worktree with pathlib — tests/hrx-ops-test.cpp, the corpus manifests, dispatch_registration/* — and uses no git history. That is the opposite of the #2724/#2717 gate, which needed --unshallow because it computed a merge-base. Worth the one sentence here so nobody generalises either way.

Two notes, no change requested

  • If the submodule ever fails to initialise, the row skips 77 rather than passing — which ctest_skips.py will report as "a skip that is not in the baseline", i.e. red, not silent. That is the right failure shape for a gate whose input might be absent, and it is worth knowing before someone baselines the 77 to quieten it: baselining it would recreate exactly the defect the wrapper's comment warns about.
  • The row name (hrx_stale_expectations) differs from the fork's (test-hrx-stale-expectations), so a lane grepping ctest output for one will miss the other. Not worth changing — one is the engine's naming convention, the other the fork's — but if both ever run, the duplication should be retired on the fork side rather than kept in step.

What I checked and did not

  • Checked: the wrapper's skip path and its exec propagation; the SKIP_RETURN_CODE 77 property; that check_stale_expectations.py returns a real 2 (measured at a pre-table pin) so the wrapper's "2 is a failure" branch is exercised; that engine CI inits the submodule at ci.yml:77; that the tool needs no git history, so --depth 1 is sufficient; and that my run of the wrapper against a submodule-less tree skips rather than fails.
  • Not checked: a CI run of the row itself — that needs the queue, and this PR is the change that puts it there. The claim above is that the inputs will be present, which the two checks above establish.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Draft, so a note rather than a verdict — and it is an ordering note: at the pin that is on main right now, this row would skip on every run, and an unbaselined skip is what ctest_skips exits 1 on.

The wrapper is correct

tool=$fork/ggml/src/ggml-hrx/tools/check_stale_expectations.py
[ -f "$tool" ] || { echo "skip -- no $tool (submodule not checked out, or a pin before llama.cpp#419)" >&2; exit 77; }
exec python3 "$tool" --check --root "$fork"
  ran as ctest will (root arg):  rc=77
  "hrx_stale_expectations: skip -- no …/check_stale_expectations.py"

That is the right shape — SKIP_RETURN_CODE 77, the code ctest_skips counts, and the message names both reasons (not checked out / a pin before llama.cpp#419). exec keeps the tool's own 1/2 codes instead of rewriting them, which is what makes "an entry is wrong" distinguishable from "cannot tell".

The ordering problem

  engine's llama.cpp pin on main:  8cb8fb64d
  does that pin carry the tool?    git show 8cb8fb64d:ggml/src/ggml-hrx/tools/check_stale_expectations.py
                                   fatal: path … does not exist in '8cb8fb64d…'
  hrx_stale_expectations in tools/ci/ctest_skips.txt:   0
  ctest_skips.py:26  "--log … # report; exit 1 on a NEW skip"

So with today's pin the new row skips on every PR, and nothing baselines it — ctest_skips will report it as a NEW skip and exit 1. Two ways that plays out, both bad in the same direction: either CI goes red for a row that is behaving exactly as designed, or someone baselines it — and a baselined skip is the "a row that skips is not a gate" state that four PRs today were written to end.

And the fix is already in the queue: #2834 — pins: llama.cpp 8cb8fb64d -> ddd415f4a. Landing #2834 first makes this row run; landing this first makes it a skip that has to be explained or baselined.

Suggested order, and it is the whole review: #2834 → #2837, in that order, and the PR body should say so plainly — "this row is a no-op until the pin bump lands, and it is a NEW SKIP in the meantime".

Why the row is worth having at all

"llama.cpp#419 added the tool to the fork and the fork has no CI job that runs any of its 43 test-hrx-* rows, so this is the only path that runs it on every PR — including every pin bump, which is when a recorded-stale entry can start hiding a real mis-selection."

That last clause is the argument. A recorded-stale entry silences a real failure; a pin bump is the moment the dispatch can change under a table that no longer describes it. Running the check on every pin bump is exactly the coverage the ratchet needs, and the engine's suite is the only place in the fleet that runs on every PR.

One thing I would add while it is a draft

The skip message cannot distinguish the two reasons it names. "submodule not checked out" and "a pin before llama.cpp#419" are very different states — the first is a broken checkout, the second is a pin that has not been bumped — and the row will be in the second state for the entire life of this PR. One git -C "$fork" rev-parse HEAD in the message would say which pin it looked at, so a lane reading the skip knows whether to re-init the submodule or to land #2834.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at ce9599e: READY — (a draft; reviewed while the pin that carries its tool is still moving, because the two arms are checkable right now)

Both arms of the gate are real, and I ran them against the two pins.

$ submodule at ddd415f4a (main + #2834's bump, which is llama.cpp#419)
$ bash tests/hrx_stale_expectations.sh ~/wt/cl-review-engine
stale-expectations: 31 recorded, every one exported by a corpus and selected by no matcher     rc=0

$ submodule at 8cb8fb64d  (the pin before #419 — no tool in the tree)
$ bash tests/hrx_stale_expectations.sh ~/wt/cl-review-engine
hrx_stale_expectations: skip -- no …/check_stale_expectations.py (submodule not checked out, or a pin before llama.cpp#419)
                                                                                              rc=77

77 rather than 0 for "the tool is not in the tree" is the whole reason this row is worth having: a wrapper that answered 0 with nothing to run would be the "a check that cannot run reports success" defect the suite keeps removing, and the header says so in those words. SKIP_RETURN_CODE 77 on the ctest row turns that into a reported skip rather than a silent pass.

Why the row belongs in this suite

The comment names the dependency precisely: the fork has no CI job that runs any of its 43 test-hrx-* rows, so the engine's suite is the only place this check runs on every PR — and a pin bump is exactly when a recorded-stale entry can start hiding a real mis-selection, which is the moment nobody re-reads that table. Putting it here means #2834's bump is validated by the same PR that moves it, rather than by a device run weeks later.

Two notes for when it undrafts

  1. Name the version dependency in the skip text as a table, not just a sentence — pin >= llama.cpp#419 is already in the message; adding the sha (ddd415f4a) would let a reader tell "too old" from "not checked out" without running git -C third_party/llama.cpp log.
  2. The row is device-free by construction (a Python tool over source text), so it needs no SKIP_RETURN_CODE for a device and no ticket — worth saying in one clause, because the neighbouring hrx_* rows are all device rows and a reader will assume this one is too.

Nothing else: the wrapper keeps the tool's own 1/2 codes, passes the root explicitly rather than assuming cwd, and the -f "$tool" test is the right gate (a pin before #419 has no file, which is the case measured above).

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Superseded by #2839, which does the same delegation with two things mine lacks: a ctest_skips.txt entry that records the expected 77 at this pin and says when to drop it, and a --self-test with a stub fork. Closing rather than arguing for mine — the measurement I made (77 at 8cb8fb64d, rc 0 with 31 recorded at ddd415f4a, and rc 2 staying a failure) is in #2839's comment so the surviving PR carries it.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Note for the merge loop: #2839 and #2840 are siblings of this one on engine#2836, both larger and both re-implementing the fork's checker. My comparison is on #2839; the short version is that this PR is the survivor — it execs the tool so 0/1/2 propagate untouched, and it does not add a ctest_skips.txt entry, which matters because #2839 baselines the 77 against pin 8cb8fb64 while main is already at ddd415f4a and carries the tool.

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

2836 - Partially compliant

Compliant requirements:

  • The engine's CI now runs the stale-expectation check on every PR
  • The check is host-runnable and does not require a device
  • The check is added to the engine's CMakeLists.txt
  • The check properly skips with return code 77 when the tool is not available

Non-compliant requirements:

  • None

Requires further human verification:

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

Missing Error Handling

The script does not handle the case where python3 is not available or fails to execute the tool, which could lead to an unhandled error instead of a proper skip with return code 77.

exec python3 "$tool" --check --root "$fork"

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

#2840 does the same job and is the stronger of the two — this one should close rather than land beside it.

Both are wrappers around the fork's check_stale_expectations.py with the same 77-when-absent rule; #2840 is the same idea in Python with:

  • a --self-test of four arms (absent→77, present-green→0, present-red→1, prints-and-exits-0→0) wired as a ctest row, so the row's own contract is checkable without a submodule;
  • ADDED_IN = "ddd415f4a" as a named constant, so the skip message names the pin that turns the row on;
  • the measured reason a direct add_test into the submodule is not used ("a direct row would fail on every PR with can't open file until the pin moves").

I verified both arms of #2840 at its head: --self-test ok, live at main's pin → SKIPPED naming ddd415f4a, and with the submodule at ddd415f4a → stale-expectations: 31 recorded, every one exported by a corpus and selected by no matcher, rc 0. Same measurement I ran on this PR earlier, so nothing is lost by closing this one.

Two rows for one table is the duplicate case the fleet keeps paying for — and note the duplicate detector could not see this pair, because both PRs say Refs #2836 rather than a closing keyword (which is #2844's subject).

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