Skip to content

apr_bin.sh / pv_bin.sh refuse a FOREIGN worktree's binary but accept an OWN-tree binary OLDER than the tree — HEAD sha matches while uncommitted edits differ (d4 #3634 apr; bf #3600 pv to confirm) #3635

Closed as not planned

Description

@noahgift

What (corrected 22:25Z — the first body overclaimed; see the edit note at the end)

scripts/apr_bin.sh and scripts/pv_bin.sh already attribute a binary to a TREE through cargo's dep-info (<target>/<profile>/apr.d source paths vs this workspace's src_path; .crates2.json for installs) and refuse a FOREIGN worktree's binary in every pass — that design is in both headers and it is right. The gap is one step later: an OWN-tree binary that is OLDER than the tree. Dep-info names the right workspace, the embedded sha equals HEAD (the edits are uncommitted, or stacked on the same base), and nothing compares the binary's mtime to the sources the .d rule lists — which is the one thing a make-style rule exists to answer.

Two reports tonight:

Step 0 ("pin the binary, ALWAYS … proves it was built from HEAD") is therefore satisfiable by a binary that is the tree's PREVIOUS state whenever the edit is uncommitted — the normal state of a worktree mid-row.

Fix

Evaluate the .d rule the way make would: any listed source with mtime newer than the binary ⇒ refuse as STALE (own tree, older than ), distinct from the existing FOREIGN refusal. Cheap (one find -newer over the .d list), no build. Optionally also print git status --porcelain | wc -l in the receipt line so a dirty tree is visible even when mtimes lie (touch, checkout).

done_when

Edit note: the first version of this body said the scripts hand a worktree "another worktree's binary". They do not — dep-info attribution refuses foreign trees. The defect is staleness within the own tree. Corrected by the author after reading apr_bin.sh:76–140 and pv_bin.sh:1–48.

Activity

  1. added this to the 0.70.0 milestone on Sep 20, 2026
  2. added
    bugSomething isn't working
    P1High priority
    on Sep 20, 2026
  3. changed the title [-]apr_bin.sh / pv_bin.sh prove HEAD, not the TREE — a shared CARGO_TARGET_DIR hands a worktree another worktree's binary at the same sha (bf #3600 pv, d4 #3634 apr, same evening)[/-] [+]apr_bin.sh / pv_bin.sh refuse a FOREIGN worktree's binary but accept an OWN-tree binary OLDER than the tree — HEAD sha matches while uncommitted edits differ (d4 #3634 apr; bf #3600 pv to confirm)[/+] on Sep 20, 2026
  4. noahgift commented on Sep 20, 2026

    @noahgift
    MemberAuthor

    Correction from the session that reported this: Step 0 was bypassed, not defeated. I did not source scripts/apr_bin.sh. The exact sequence on 2026-09-20 ~23:30Z was:

    cargo build --release --features cuda --bin apr          # in worktree aprender-q41, HEAD e6f77c98c + uncommitted #3604 edits
    APR=$(cargo metadata --format-version 1 --no-deps | jq -r .target_directory)/release/apr
    "$APR" --version        # → apr 0.68.2 (00e5d2dde)   ← not this tree's HEAD
    "$APR" run --help | grep revalidate                     # → nothing            ← not this tree's edits
    

    target_directory resolved to the shared /mnt/nvme-raid0/targets/aprender (the gitignored .cargo/config.toml redirect), and the binary there was another worktree's — an older sha and a different tree. I caught it from the missing --revalidate flag, not from any pin check, because none ran. So the dep-info attribution apr_bin.sh performs never had the chance to refuse it, and I cannot claim to have exercised the own-tree-but-older gap this issue names. What I can say is which class my case was: different worktree, different HEAD sha — the case the script is described as already refusing. The newer-than-.d gap (same HEAD, own tree, uncommitted edits not yet built) is real and adjacent, but it is not what bit me; bypassing the script is.

    Rebuilt under CARGO_TARGET_DIR=<worktree>/target-pinned; apr --version → e6f77c98c (matching HEAD), --revalidate present; every number in evidence/perf/3604/MEASUREMENT.md is from that binary and the file says so.

    Lesson I am taking from it rather than the one I first reported: cargo metadata's target_directory is not a pin, and "the build just finished" is not proof the binary at that path is the one it built. Step 0 exists because those two feel like proof.

  5. noahgift commented on Sep 20, 2026

    @noahgift
    MemberAuthor

    Third instance, other repo (infra-c8, arbiter bridge, 2026-09-20 ~23:50Z): the shared cargo target dir served a binary whose arbiter version named a commit it was NOT built from — cargo excludes a workspace member's path from its fingerprint, so a build from a lane worktree reads as "fresh" in another worktree, build-script output included. Their fix on the bridge: the self-test refuses a binary whose embedded sha ≠ HEAD (exit 2) — which is the check apr_bin.sh already has, and which this issue says is insufficient for the own-tree-older-than-edits case. Same family; the cross-worktree case is the one dep-info attribution is supposed to catch here.

  6. added
    kind:codeWork is a code change (derived rule, #4159)
    on Sep 24, 2026
  7. modified the milestones: 0.70.0, backlog on Sep 24, 2026
  8. noahgift commented on Sep 25, 2026

    @noahgift
    MemberAuthor

    Parked by APR-EPIC-001: over S2 budget (rank 5/38). Reopen = pull. Applied by aprender-d1: claude+agy both said close, apr shadow row recorded (handoff/close-quorum-2026-09-25.json).

  9. added
    parkedClosed over epic budget (APR-EPIC-001 rule 5). Reopen = pull.
    on Sep 25, 2026
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

    P1High prioritybugSomething isn't workingkind:codeWork is a code change (derived rule, #4159)parkedClosed over epic budget (APR-EPIC-001 rule 5). Reopen = pull.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions