Skip to content

hw-gate: say WHICH absence "cannot place" is (engine#2713) - #2743

Merged
bong-water-water-bong merged 1 commit into
mainfrom
pkg/2713-absence
Nov 16, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
pkg/2713-absence

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Closes #2713 (the diagnosis half; the fetch-it-for-real half is described below and needs the gate box).

kld rows SKIP with cannot place (4a58da9b087d is not in third_party/llama.cpp) and the gate turns five honest SKIPs into INCOMPLETE → job failure, so a labelled PR reads red on correct work.

That sentence is true and it is ambiguous, and the ambiguity is the bug I can fix from here:

  • the commit may be gone upstream, or
  • the clone may be too shallow to hold it — and on the gate this is the normal case, because hw-gate.yml:82 runs submodule update --init --depth 1.

A reader cannot retry the right thing without knowing which, and the gate's log was the only place that could have said so.
provenance() now asks --is-shallow-repository before answering, and when the clone is shallow it says the absence is an
absent input rather than a wrong row, and names the remedy. A full clone keeps the plain sentence exactly.

Arms, both directions, fixture in the gate's own shape (two-commit origin, --depth 1 clone):

arm engine#2713 shallow-absence: ok (shallow names the absent input; full clone keeps the plain line)
hw_gate_test: PASS

and proven able to fail — with the shallow branch disabled:

arm engine#2713 shallow-absence: FAIL (a --depth 1 clone must say the input is absent, not that the row is wrong)
hw_gate_test: FAIL

What this does not do, stated plainly: it does not make the gate green. That needs the gate box to write the bases it will need next to the results it already uploads, so the job can fetch exactly those commits. I rejected the two shortcuts — fetch-depth: 0, or unshallowing llama.cpp — because both spend minutes of a saturated build queue to remove a red badge from correct code.

One correction worth recording, because it is the same error this issue is about: my first plan said the workflow could read the bases from the manifest's recorded_at. It cannot — git ls-files | grep kld shows no manifest in the tree, and hw_gate_manifest.py:96-106 writes it at gate time from a CLI path on the box. I only caught that by checking whether the input exists before describing how to read it.

The gate's KLD rows SKIP with "cannot place (<sha> is not in third_party/llama.cpp)" and the gate turns that into INCOMPLETE
and fails the job. That sentence is true and it is ambiguous: the commit may be gone upstream, or the clone may be too shallow
to hold it -- hw-gate.yml:82 does "submodule update --init --depth 1", so on the gate the second is the normal case. A reader
cannot retry the right thing without knowing which, and the gate's own log is the only place it could say so.

provenance() now asks --is-shallow-repository before answering and, when the clone is shallow, says the absence is an absent
INPUT rather than a wrong row, naming the remedy (deepen the clone or fetch that commit). A full clone keeps the plain
sentence exactly, so nothing that parses the old text changes behaviour.

Arms, both directions (fixture is the gate's own shape: a two-commit origin and a --depth 1 clone of it):
  - shallow clone -> "SHALLOW clone ... absent input"; full clone -> no such claim
  - proven able to fail: with the branch disabled the arm reports FAIL; restored, it reports ok

This does not make the gate green by itself -- that needs the box to hand its bases to the job. It stops an absent input from
being read as a verdict on correct code in the one place the reader actually looks.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

READY — and the fix is aimed at exactly the right thing: the sentence was true and useless.

cannot place (4a58da9b087d is not in third_party/llama.cpp) is read by a human as "that commit is gone", while on the gate the overwhelmingly common cause is "this clone is too shallow to hold it" — and those two require opposite remedies. Fixing the ambiguity is worth more than making the row pass, because it turns five honest SKIPs from noise into an instruction.

Three things that make this reviewable:

  • The claim is checked, not assumed. provenance() now asks --is-shallow-repository and branches on the answer, so the tool can only say "shallow" when the clone says it is. The full-clone path keeps the byte-identical plain sentence, which is what stops the change from quietly rewriting history for everyone whose clone is fine.
  • The arm is proven able to fail, with the shallow branch disabled: FAIL (a --depth 1 clone must say the input is absent, not that the row is wrong). That is the discipline this repo keeps relearning — an arm that cannot fail proves nothing — and it is quoted in both directions.
  • The fixture copies the gate's own shape (two-commit origin, --depth 1 clone) rather than inventing a convenient one, so the arm fails for the same reason the gate fails.

What I would pin:

  1. --is-shallow-repository answers about the whole repository, not the path being asked about. A shallow clone is uniform today, so this is currently exact — but a partial clone (--filter=blob:none, or a promisor remote) is not shallow and will fall into the "full clone" branch while still lacking the object, printing the old ambiguous line for the new reason. One clause saying which clone shapes the check covers (plain shallow yes, partial/promisor no) keeps the next person from reading "full clone" as "the object must be here".
  2. Say which input is absent, as the issue title asks — the body says the shallow message "says the absent input rather than a wrong row", and that is the improvement; make sure the wording names the file and the commit (4a58da9b087d is not in third_party/llama.cpp because this clone is shallow (depth 1); fetch the commit or deepen the clone), so the reader gets the remedy on the same line.
  3. The self-correction at the end is the best sentence in the PR — "my first plan said the workflow … " — keep it. A PR that records which plan did not survive is worth more to the next reader than one that reads as if it were obvious on the first try.

Credited: closing only the diagnosis half and saying plainly that the gate stays red without the gate box, rather than claiming a fix it cannot verify; keeping the full-clone output unchanged; and the both-directions arm.

Not verified by me: the gate run. The shallow/full split, the fixture shape and the arm's failure mode are what I can check, and all three are right.

@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 773943e: READY

Ran the suite and then disabled the new branch to prove the arm can fail — it does, with the message the body quotes.

head                       : arm engine#2713 shallow-absence: ok (shallow names the absent input; …)
                             hw_gate_test: PASS
`--is-shallow-repository`  : arm engine#2713 shallow-absence: FAIL (a --depth 1 clone must say the input is
  check disabled               absent, not that the row is wrong)
                             golden llama.cpp 4a58da9b087d, tested deadbeef1234: cannot place (4a58da9b087d is not
                             in /tmp/…/shallow)
                             hw_gate_test: FAIL

The distinction the change makes is the one that costs an hour: an absent input is not a wrong row. The old sentence was true and unactionable, and the gate turned five honest SKIPs into INCOMPLETE, so a labelled PR read red on correct work — with the log naming the failure and not its kind.

Two things I want to endorse specifically, because they are decisions rather than code:

  • Rejecting fetch-depth: 0 and the unshallow. Both would make the badge green by spending minutes of a saturated build queue on every gate run, to prove something the row already knows. Writing this half down and leaving the fetch for the box is the cheaper half first, correctly.
  • The self-correction in the body: the first plan read the needed commits from a manifest's recorded_at, which does not exist in the tree (the manifest is written at gate time from a box path). Catching that by checking the input exists before describing how to read it is the same discipline this issue is about, and it belongs in the record.

Read the code too: the shallow test is asked before answering, so a full clone keeps the plain sentence byte for byte (that is the arm's other half), and the remedy is named in the line itself rather than in a doc.

Not claimed: the gate is still red on a shallow clone — as the body says, the fix for that is uploading the bases beside the results, which is a separate change on the gate box. This PR is the half that can be reviewed without one.

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

2713 - Partially compliant

Compliant requirements:

  • Improved error messaging to distinguish between shallow clone issues and upstream commit absence
  • Added logic to detect shallow repositories and provide clearer diagnostics
  • Updated tests to verify the behavior in both shallow and full clone scenarios

Non-compliant requirements:

  • Does not implement the fetch-depth: 0 or unshallowing of llama.cpp as the primary fix (as noted in the PR description)

Requires further human verification:

  • The actual hardware gate workflow changes needed to make the PR green are not included in this PR
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Clarity in Error Messages

The change improves error messages to distinguish between commits that are absent due to a shallow clone versus commits that are gone upstream. This is important for diagnosing issues in CI environments where shallow clones are used. The implementation correctly detects shallow repositories and provides more informative error messages.

if _git(repo, "rev-parse", "--is-shallow-repository")[1].strip() == "true":
    return (f"{head}: cannot place ({short(c)} is not in {repo}), and {repo} is a SHALLOW clone, so this is an "
            f"absent input rather than a wrong row: deepen the clone or fetch {short(c)} to evaluate it")
return f"{head}: cannot place ({short(c)} is not in {repo})"
Test Coverage for Shallow Clone Detection

The test suite now includes a fixture that simulates both shallow and full clones to verify that the error message correctly identifies shallow clone issues. This ensures that the fix works as intended and prevents regressions.

# engine#2713: "cannot place" is two different facts. A shallow clone lacks the commit because the RUNNER is too
# shallow; a full clone lacks it because the commit is gone upstream. A reader who cannot tell them apart retries the
# wrong thing, so the verdict line must name which. Fixture: a two-commit origin and a --depth 1 clone of it, which is
# the shape the gate's own `submodule update --depth 1` produces. Both directions are asserted: the shallow clone says
# "absent input", the full clone keeps the plain sentence.
with tempfile.TemporaryDirectory() as td:
    org = os.path.join(td, "origin")
    def sh(*a, cwd=None):
        return subprocess.run(a, cwd=cwd, capture_output=True, text=True)
    sh("git", "init", "-q", org)
    env = dict(os.environ, GIT_AUTHOR_NAME="t", GIT_AUTHOR_EMAIL="t@t", GIT_COMMITTER_NAME="t", GIT_COMMITTER_EMAIL="t@t")
    for msg in ("one", "two"):
        subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", "commit", "-q", "--allow-empty", "-m", msg],
                       cwd=org, capture_output=True, env=env)
    shal = os.path.join(td, "shallow")
    sh("git", "clone", "-q", "--depth", "1", "file://" + org, shal)
    sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "tools"))
    from hw_gate_manifest import provenance
    shallow_line = provenance("4a58da9b087d", "deadbeef1234", shal)
    full_line = provenance("4a58da9b087d", "deadbeef1234", org)
    if "SHALLOW clone" not in shallow_line or "absent input" not in shallow_line:
        print("  arm engine#2713 shallow-absence: FAIL (a --depth 1 clone must say the input is absent, not that the row is wrong)")
        print("   ", shallow_line)
        bad = True
    elif "SHALLOW" in full_line:
        print("  arm engine#2713 shallow-absence: FAIL (a full clone must not be described as shallow)")
        print("   ", full_line)
        bad = True
    else:
        print("  arm engine#2713 shallow-absence: ok (shallow names the absent input; full clone keeps the plain line)")

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: READY 2743

"The diagnosis half" in a Closes line is the honest way to close a partially-fixed issue, and this fleet has repeatedly got it wrong in the other direction — an issue closed on the diagnosis while the mechanism stayed open (#2543, where I accepted a mechanism on plausibility and it had to be reopened).

And "absence" is the right word to test. The failure mode this family keeps paying for is a gate that reports success because it never had the input: #2713's shallow clone returned nothing and read as clean, #2622's regex matched nothing and read as clean, #2662's counter printed zero for "not measured". A test named for absence says the author knows which direction the danger points.

Four asks:

  1. every absence needs its own message — "the label is absent", "the ref is absent", "the run never started" are three faults with three remedies, and the value of a diagnosis-half PR is entirely in whether it distinguishes them. If the tool prints one "absent" line for all three, the fix is half the size it looks;
  2. the arm must assert the exit status as well as the string — a diagnosis that prints the right sentence and exits 0 has not helped the caller, which is hw-gate: unshallow the pair's llama.cpp checkout, so a labelled PR's KLD rows can place their golden (Fixes #2713) #2717's shape one repo over;
  3. name what the gate box would measure, in one line — "the fetch-it-for-real half needs the gate box" is fine as a deferral, but the next reader needs the sentence that says what would be different on that box, or the deferral cannot be picked up;
  4. tests/hw_gate_test.py should carry the shallow-clone case — it is the measured failure (hw-gate: unshallow the pair's llama.cpp checkout, so a labelled PR's KLD rows can place their golden (Fixes #2713) #2717 fixed it on the workflow side by unshallowing); if the test only covers the absent-label path, the shallow path stays unarmed.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Green, and the arm is enforced rather than merely present — the distinction I care about, so from the job's own log (133535119820):

69/375  hw_gate_manifest_self ....... Passed  0.19 sec   (the tool's own selftest)
206/375 hw_gate_judges ............. Passed  1.92 sec   <- tests/hw_gate_test.py, where engine#2713's arm lives
build  pass 22m46s

hw_gate_judges is registered at CMakeLists.txt:1408, so the arm runs on every build in the ctest list and not only when someone
remembers to type the file's name. A green build that never executed the new arm would have been the more comfortable result and
the less useful one.

Still deliberately not claiming the gate is fixed: a labelled PR will keep reading INCOMPLETE until the box supplies the bases
it needs. What changed is that the log now says which absence it is, in the place the reader is already looking.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 773943e: READY — the arms are in both directions and the fallback is safe. One phrase claims more than the check knows; worth a word, not a block.

What I checked by reading the code path, not the description:

  • the shallow test is placed after the cat-file -e failure and inside the per-commit loop, so it only ever runs for a commit that is genuinely missing, and for both recorded and tested;
  • _git(repo, "rev-parse", "--is-shallow-repository")[1].strip() == "true" fails closed: git older than 2.15 prints an error, [1] is empty, and the code keeps today's plain sentence rather than claiming shallowness;
  • a shallow clone that does hold the commit never reaches the branch, because cat-file -e succeeds first;
  • the fixture is the shape the gate produces (--depth 1 clone of a two-commit origin) and the arm asserts both directions, including that a full clone does not get the words "SHALLOW" — that negative half is what stops the sentence from being blanket-added.

The one phrase I would change. "…so this is an absent input rather than a wrong row" is stronger than the evidence: shallowness explains the absence, it does not exclude a commit that is genuinely gone upstream (a golden recorded against a force-pushed or deleted commit is absent in a full clone too, and in a shallow one the two look identical). This engine's own rule elsewhere is that an unexamined input must not read as a pass, and "absent input rather than a wrong row" is one step from that. Something like:

... is a SHALLOW clone, so this absence is UNEXPLAINED until the clone is deepened: deepen it or fetch <sha>, then
re-run — a commit that is gone upstream reads the same way here

That keeps the actionable remedy, keeps the INCOMPLETE → SKIP consequence honest, and stops a reader from ticking the row off as fine. I am not asking for another commit if the author disagrees with the wording — the mechanism is right and I have no doubt it should merge.

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.

hw-gate CI: the KLD rows cannot place their golden in the runner's shallow clone, so a labelled PR is red on any pin

1 participant