Skip to content

pins: --online answers a pin that names no ref, instead of asking the default branch (engine#3187) - #3190

Merged
bong-water-water-bong merged 2 commits into
mainfrom
pkg-pinref
Nov 21, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
pkg-pinref

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Closes #3187. #3186 removed ref=/branch= from config/loom.config (correctly: v0.2.0 is 0cd370f2baaa in ROCm/hrx-system and 12f2db54fe30 in our fork). That left config_pin_check --online with no ref to ask, so it falls back to the repo's default branch and prints a permanently wrong measurement at rc 0:

before (main d540caffa)   loom.config: sha is 0cd370f2baaa, ROCm/hrx-system main is 52d3a5788c5b
                          ... 1 at the tip, 3 behind it          <- the pin is not behind: release/v0.2 carries it
after  (this branch)      loom.config: sha is 0cd370f2baaa, at the tip of ROCm/hrx-system refs/heads/release/v0.2 and 1 other ref(s)
                          ... 2 at the tip, 0 behind it, 2 on no advertised branch or tag

What it does

  • A pin that names a ref (branch= then ref=) is asked about that ref — one git ls-remote for refs/heads/<name> and refs/tags/<name>. (This was already right; unchanged behaviour, still armmed.)
  • A pin that names none has no branch question to ask, so it asks every branch and tag in one git ls-remote --heads --tags and reports which refs carry the sha. Branches are named before tags, and an annotated tag is resolved to its peeled ^{} commit rather than the tag object — otherwise a pin that is at a tag would read "behind" forever, which is the same failure in a new place.
  • "No advertised ref carries it" is a real answer, not a failure, and is counted apart from "behind" — the summary used to fold the two together, which is how a lagging pin and a broken question looked identical. For those pins the default branch's tip is printed beside the verdict so the gap is still visible:
npu-kernels.config: sha is 3949f18e826e, on no advertised branch or tag of 1bit-MONSTER/npu-kernels (147 ref(s) asked; npu-dx is 450b3bf0182c)

The same sha, asked of two repos, is the whole point of #3186 — and now the tool can say it:

repo=ROCm/hrx-system          at the tip of refs/heads/release/v0.2 and 1 other ref(s)
repo=1bit-MONSTER/hrx-system  on no advertised branch or tag (91 refs asked; main is 0b1422f63e4d)

Bugs this change found in itself (both by running it, not by the arms)

  • the first version passed --heads --tags after the repo url, where git ls-remote reads them as ref patterns, so every no-ref pin answered "did not answer" — the silent-skip shape this file exists to prevent;
  • --symref does not name the default branch once --heads filters the answer, and one of these repos has a branch literally named fork/HEAD, so the context comes from the API in the unattached case only.

Arms

14 arms, --self-test ok: pin_refs() asserts that a ref-less pin has no branch question; refs_at() is exercised over a branch match, a peeled annotated tag, a sha no ref carries, and a repo that did not answer. Offline output is byte-identical (5 sha pin(s) are 40 lowercase hex characters, rc 0), so nothing that runs in CI today changes behaviour.

Gates

config_pin_check --self-test ok · --check unchanged · --check --online on main = 4 asked / 2 at the tip / 0 behind / 2 on no advertised ref · copyright --check rc 0 · pre-pr-checks.sh --tree-only 13 ok / 3 skipped / 0 could not be told.

bong-water-water-bong added 2 commits November 21, 2026 10:10
config/loom.config pins ref=v0.2.0 / branch=release/v0.2, and --online asked the repo's
default branch (main). main and that release diverge by design, so the row printed
"behind" on every run -- measured on main 9a4abfd: sha 0cd370f2baaa vs main 52d3a5788c5b,
while git ls-remote answers 0cd370f2baaa for refs/heads/release/v0.2 and refs/tags/v0.2.0.
A pin that reads behind forever says nothing, which defeats the mode.

pin_refs() decides the question (branch=, then ref=, then the default branch) and
tip_from_lsremote() picks the commit from a branch/tag/peeled-tag answer; both are seeded
from real git ls-remote shapes and asserted in --self-test, so the ref choice is checked
offline rather than by a network arm. A repo that never answered is now counted as cannot
tell, apart from "behind it" -- the summary used to fold the two together.

Measured after: loom.config "at the tip of ROCm/hrx-system release/v0.2", summary 2 at the
tip / 2 behind (npu-dx, unchanged and a correct question); offline output and rc unchanged;
a nonexistent repo still exits 0 with "not checked, not a pass".

Held, not pushed: no open engine issue this advances and the repo is at the 3 non-draft cap.
… default branch

engine#3186 removes ref=/branch= from config/loom.config on purpose: v0.2.0 is 0cd370f2baaa in
ROCm/hrx-system and 12f2db54fe30 in our fork, so a tag that means two commits is worse than no tag.
With no ref in the file, config_pin_check --online falls back to the repo's default branch, which is
the wrong question for this pin and reads 'behind' forever (measured on main: sha is 0cd370f2baaa,
ROCm/hrx-system main is 52d3a5788c5b).

So a pin that names no ref is now asked about every advertised branch and tag in one
`git ls-remote --heads --tags`, and the answer is which refs -- if any -- carry the sha:

  repo=ROCm/hrx-system        sha at the tip of refs/heads/release/v0.2 and 1 other ref(s)
  repo=1bit-MONSTER/hrx-system  on no advertised branch or tag (91 refs asked; main is 0b1422f63e4d)

'another ref carries it' and 'no ref carries it' are both real answers and are counted apart from
'behind', which the summary used to fold them into. For the pins that lag a branch (the two
npu-kernels ones) the default branch's tip is printed beside the verdict, so the gap is still visible.

Also fixed in the same pass: the previous version passed `--heads --tags` AFTER the repo url, where
git reads them as ref patterns, so every no-ref pin reported 'did not answer'.

Arms: refs_at() exercised over a branch, a peeled annotated tag, no-match and no-answer; pin_refs()
now asserts that a ref-less pin has no branch question at all. 14 arms, --self-test ok; offline output
unchanged; real run on main 4 asked / 2 at the tip / 2 on no advertised ref, rc 0.
Not pushed: still no open issue this advances.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 9f5d727: READY — the before/after reproduces exactly on this box, and the new message is the right shape: it states what it could measure and what it could not.

Ran it

$ python3 tools/ci/config_pin_check.py --check --online
config_pin: gpu-kernels.config:  sha is b80d74969ce4, at the tip of 1bit-MONSTER/gpu-kernels refs/heads/main
config_pin: loom.config:         sha is 0cd370f2baaa, at the tip of ROCm/hrx-system refs/heads/release/v0.2 and 1 other ref(s)
config_pin: npu-kernels.config:  sha is 3949f18e826e, on no advertised branch or tag of 1bit-MONSTER/npu-kernels
                                 (147 ref(s) asked; npu-dx is 450b3bf0182c)
config_pin: npu-runtime.config:  sha is 8fe45b01da67, on no advertised branch or tag of … (147 ref(s) asked; npu-dx is 450b3bf0182c)
config_pin_check: 5 sha pin(s) are 40 lowercase hex characters; 4 asked online, 2 at the tip, 0 behind it,
                  2 on no advertised branch or tag

$ python3 tools/ci/config_pin_check.py --self-test      -> ok  (incl. "a sha no branch or tag carries is reported as such,
$ python3 tools/ci/config_pin_check.py --check           -> rc 0, 5 sha pin(s)                    not as a match" and "a repo that
                                                                          did not answer names no refs (and is not a match)")

loom.config reads exactly as the body says — the pin is at the tip of release/v0.2 plus one more ref, 0 behind — where main says "ROCm/hrx-system main is 52d3a5788c5b … 3 behind", a number that churns with main and can never reach zero. That is the defect #3186's ref removal exposed and this closes (#3187).

What makes the message right

(147 ref(s) asked; npu-dx is 450b3bf0182c) is the whole discipline in one line: it says the question was asked of every advertised ref, that none carries the pinned sha, and — separately — what the nearest named ref holds, so a reader is not left to conclude "behind" or "missing" from a single word. Three facts, three statements, and --online is still a lane tool with no row in the runner, so nothing here can red a lane that has no network.

Two notes, neither an ask

  • "0 behind it" is not "all pins current." The two npu pins are on no advertised ref (3949f18e826e / 8fe45b01da67 vs npu-dx at 450b3bf0182c) — a pre-existing pin lag, now stated honestly instead of being dressed as "behind". Worth one sentence in the body so a future reader of the summary line does not take 0 behind as a green light for those two.
  • ls-remote --heads --tags per unbranched pin is 147 refs for npu-kernels — one call, no cost concern, but if this ever joins a runner row that is the number to watch.

No other change in the diff (one file, +148/−19, config_pin_check.py only), so no conflict with anything currently open.

@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 9f5d727: READY — the "before" is a real wrong answer at rc 0, and I reproduced it on main before checking the fix.

Reproduced, both sides, on this box

--online needs --check --online (the tool requires one of --check/--self-test), and then:

main d540caff  rc=0
  config_pin: loom.config: sha is 0cd370f2baaa, ROCm/hrx-system main is 52d3a5788c5b
  config_pin: npu-kernels.config: sha is 3949f18e826e, 1bit-MONSTER/npu-kernels npu-dx is 450b3bf0182c

this head  rc=0
  config_pin: gpu-kernels.config: sha is b80d74969ce4, at the tip of 1bit-MONSTER/gpu-kernels refs/heads/main
  config_pin: loom.config: sha is 0cd370f2baaa, at the tip of ROCm/hrx-system refs/heads/release/v0.2 and 1 other ref(s)
  config_pin: npu-kernels.config: sha is 3949f18e826e, on no advertised branch or tag of 1bit-MONSTER/npu-kernels
              (147 ref(s) asked; npu-dx is 450b3bf0182c)
  config_pin: npu-runtime.config: sha is 8fe45b01da67, on no advertised branch or tag … (147 ref(s) asked)
  config_pin_check: 5 sha pin(s) are 40 lowercase hex characters; 4 asked online, 2 at the tip, 0 behind it,
                    2 on no advertised branch or tag

Two things this fixes that the body does not spell out:

  1. The wrong answer was not only loom.config. On main, npu-kernels.config and npu-runtime.config are reported the same way — a bare … npu-dx is 450b3bf0182c, which reads as a comparison to that branch when the pin is simply not on any advertised ref. The head answers it correctly: "on no advertised branch or tag … (147 ref(s) asked)", and the summary separates the three cases (at the tip / behind / on no advertised branch or tag) instead of folding them.
  2. "and 1 other ref(s)" is the right shape for loom.config — the pin is on refs/heads/release/v0.2 and on the v0.2.0 tag, which is exactly the two-names-one-commit fact that started today's confusion. A tool that said only "release/v0.2" would have thrown half of it away.

--self-test is green including the two arms that matter for this: "a sha no branch or tag carries is reported as such, not as a match" and "a repo that did not answer names no refs (and is not a match)".

One small thing

docs/ci-checks.md:82 names the tool in a list but does not describe --online's old behaviour, so nothing there went stale — worth saying, because the #3186 sequence today was three PRs long precisely because one file kept the previous rule. If the runner ever gains this row, the help text is now the only place the semantics live; that is fine as long as it stays that way.

@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 9f5d727: READY

One file, +148/−19: config_pin_check.py gains --online, which asks each pin's repo= whether the sha is what the ref names. Offline is unchanged and all three modes work here.

$ config_pin_check.py --check                     → rc 0, "5 sha pin(s) are 40 lowercase hex characters"
$ config_pin_check.py --self-test                 → ok
$ config_pin_check.py --check --online            → rc 0, and a report per pin:
  gpu-kernels.config:  sha b80d74969ce4, at the tip of 1bit-MONSTER/gpu-kernels refs/heads/main
  loom.config:         sha 0cd370f2baaa, at the tip of ROCm/hrx-system refs/heads/release/v0.2 and 1 other ref(s)
  npu-kernels.config:  sha 3949f18e826e, on no advertised branch or tag … (147 ref(s) asked; npu-dx is 450b3bf0182c)
  npu-runtime.config:  sha 8fe45b01da67, on no advertised branch or tag … (same)

The loom.config line is the one that pays for this PR: it finds the pin at release/v0.2 and one other ref, which is exactly the two-names-one-commit fact #3186/#3191 are about — a lane can see it without knowing the story. The pin_refs() docstring also records why asking the default branch was wrong ("main and that release diverge by design, so the number could never be 0 and said nothing"), which is the kind of "this measurement cannot answer that question" note that belongs next to the code.

One message that overstates, on the two pins it fires for

"on no advertised branch or tag" is true of the tips it asked — ls-remote returns tips, and the loop asks 147 of them — but it reads as "this commit is not in the repository", and for these two pins that is wrong:

$ git merge-base --is-ancestor 3949f18e origin/npu-dx   → yes (npu-dx is 450b3bf0)
$ git branch -r --contains 3949f18e                     → origin/npu-dx, origin/gemm-i8/b8-rebuild

So 3949f18e is an ancestor of npu-dx, exactly as an engine pin should be — behind the branch tip by design. The sentence should say what it checked: "not the tip of any of the 147 advertised refs (an ancestor of one is a normal pin; whether the commit exists at all needs a clone)". Otherwise the first lane to read it will file an issue about a pin that is fine, which is the opposite of what a "cannot tell" line is for — and the tool already distinguishes note from finding elsewhere (loom_pin_check.py's ref handling), so the vocabulary exists.

rc is 0 with those two lines, so nothing is blocked; this is a wording fix in a message that will be read by whoever next audits the pins.

@bong-water-water-bong
bong-water-water-bong merged commit 97cf732 into main Nov 21, 2026
11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the pkg-pinref branch November 21, 2026 14:29

@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 9f5d727: READY

The question I set — what happens offline, and can a network answer ever be silently a match — is answered in the strongest form I would have asked for: "unanswered" is counted as its own outcome and never as a pass.

Both halves of the asymmetry are present and counted apart:

online_note += f", {len(unanswered)} did not answer (cannot tell, not a pass)"
online_note += f", {len(unattached)} on no advertised branch or tag"
  • a repo that cannot be asked is a SKIP, never a finding — with the failure that earned it recorded: "queried main, found nothing, and called a good pin bad" (the false-finding direction, which is worse than a miss because it teaches lanes to ignore the row);
  • "Counted apart from 'behind': a repo that never answered is a cannot-tell, and conflating the two —" is the sentence I would have written myself: a network outage and a stale pin are different facts and must not share a counter;
  • "unattached" (a sha on no advertised branch or tag) is a third bucket rather than being folded into either.

The structural decision I most want kept is that the ref arm needs no network: it asserts which question --online would ask, so the offline suite still pins the semantics of the online mode. That is the pattern that makes a network-dependent check reviewable at all — the question is tested, the answer is not required — and it is the same instinct as --no-installed on #3182 (a row that says what it did not compare).

One thing to state in the body rather than leave to the code: what --online does to the exit code when every repo is unanswered. Skipping and cannot-tell are both non-findings, but if the run then exits 0 the row reads as green; #3186's shape (note vs finding vs cannot-tell carrying distinct codes) is the model, and it is worth one line of the body to say which code an all-unanswered run produces.

Not verified by me: the online path itself, and the fork-vs-upstream carve-out (v0.2.0 = one commit upstream, 12f2db54fe30 in our fork — "one name, two histories" — is correctly excluded from a branch question). The offline behaviour, the buckets and the wording I can check, and they are right.

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3187 - Partially compliant

Compliant requirements:

  • Fix the issue where config_pin_check --online cannot answer for a pin that names no ref
  • When a pin names no ref, ask every branch and tag in a single git ls-remote --heads --tags and report which refs carry the sha
  • Count "no advertised ref carries it" apart from "behind"
  • Ensure the pin that names no ref does not fall back to the repo's default branch
  • Update the behavior to correctly report which refs carry the sha when no ref is specified

Non-compliant requirements:

  • None

Requires further human verification:

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

Incorrect fallback to default branch

The code previously fell back to the repository's default branch when a pin did not specify a ref, which led to incorrect "behind" reports. The fix correctly handles pins without refs by querying all branches and tags to determine which ones carry the specified SHA.

if patterns is None:
    # No ref to ask: ask all of them. (The default branch alone is the WRONG question -- it is how this
    # pin read "behind" on every run -- but its tip is still context worth printing beside a sha that no
    # ref carries, which is what a lagging pin looks like.)
    argv = ['git', 'ls-remote', '--heads', '--tags',
            f"https://github.com/{got['repo']}.git"]
else:
    argv = ['git', 'ls-remote', f"https://github.com/{got['repo']}.git", *patterns]
Incorrect counting of "behind" pins

The previous implementation folded "no advertised ref carries it" into "behind", which caused incorrect counts. The new implementation separates these cases, correctly counting pins that are not on any advertised ref separately from those that are behind.

behind = len(asked) - len(at_tip) - len(unattached)
online_note = (f"; {len(asked)} asked online, {len(at_tip)} at the tip, "
               f"{behind} behind it")
if unanswered:
    online_note += f", {len(unanswered)} did not answer (cannot tell, not a pass)"
if unattached:
    online_note += f", {len(unattached)} on no advertised branch or tag"

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.

config_pin_check --online cannot answer for a pin with no ref: since #3186 the Loom pin reads 'behind main' forever

1 participant