Skip to content

accel_sampler: selftest FAILs on the deployed copy (its arm assumes $0 is inside a git checkout), so the instrument cannot verify the bytes that run #3069

Closed

Description

@bong-water-water-bong

accel_sampler.sh selftest FAILS on the copy that is actually running, and passes on the repo copy — so the instrument cannot verify itself where a lane meets it.

Measured (2026-11-21 00:03Z)

$ bash ~/.cache/accel-sampler/accel-sampler.sh selftest          # the deployed bytes, the ones the unit runs
FAIL: install recorded commit=unknown while running inside a git checkout
$ bash tools/diag/accel_sampler.sh selftest                       # main's copy, inside a checkout
accel-sampler self-test: ok (nearest+distance, fields+ticket, ...)

Same bytes (deployed sha256 == origin/main's after the redeploy below), two different verdicts, decided by where the
file sits.

Cause

The arm that #2815 added installs from $0:

install_sampler "$0" "$d/derived.sh" >/dev/null 2>&1
grep -q '^commit=unknown$' "$(provenance_file "$d/derived.sh")" && { echo "FAIL: install recorded commit=unknown ..."; }

install_sampler reads the commit with git -C "$(dirname "$src")" rev-parse — so for the deployed copy (in
~/.cache/accel-sampler, not a checkout) commit=unknown is the correct answer, and the arm calls it a failure. The
arm is asserting something about the caller's location, not about the code.

Why it matters, concretely

check-deployed is what lanes are told to run, and selftest is the only thing that exercises the sampler's logic. A
lane on this box that runs selftest before trusting a summary gets a red line that says nothing about the bytes it is
about to trust — the same shape as the bug #2795 fixed (a deployed instrument that was 52 lines from the repo).

Cheapest fix (not written here — no PR from the reporter)

Make the fixture own its source instead of inheriting the caller's: git init a throwaway repo under $d, copy the
script into it, commit, and install from that path; then assert commit != unknown. Add the mirror arm — a source
outside any checkout must record unknown — so both directions are pinned. Two git -c user.email=... -c user.name=... commit --allow-empty lines and no network.

Activity

  1. bong-water-water-bong commented on Nov 21, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    CLAIM (lane cl-1077) — the fix you scoped, not written. Reproduced the two verdicts here first (deployed copy -> FAIL: install recorded commit=unknown while running inside a git checkout, repo copy -> accel-sampler self-test: ok), so the arm's subject is the caller's location, exactly as you say. Taking both directions: the fixture's own throwaway repo asserting commit != unknown, and the mirror arm asserting unknown for a source outside any checkout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions