Skip to content

weekly.sh package_checks: three rows that failed every release package now check what ships (engine#3287) - #3338

Merged
bong-water-water-bong merged 1 commit into
mainfrom
1bit/weekly-package-checks-3287
Nov 23, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
1bit/weekly-package-checks-3287

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Part of #3287. Found by the v2026.48 cut.

scripts/weekly.sh package_checks failed the v2026.48 engine tarball with 22 FAIL lines. The c35 payload that was tested on the board fails the same 22 lines, so no release package could pass the check as written. The 22 lines come from three rows, and none of them is a payload defect:

row was now
NPU set count demanded "the 0.6B, 1.7B and 4B sets", stale since 1.7B stopped shipping (#3300's catalogue filter decides what is offered) at least one signed set, and every set must be a geometry config/npu-catalogue-sets.json names (a set no catalogue entry can load fails)
every ELF is a host ELF rejected the signed-manifest sets' AIE kernels at <set>/<id>/layer1.elf, which the allowlist a few lines up admits by design (#3278) those are skipped when the set carries its manifest; an AIE ELF anywhere else still fails
packed 1bit names a private source file substring match: a private basename matched inside a longer public engine path that ends with it, in a message the public engine prints whole names (grep -w). Real private names still match: 13 hits in an unstripped build binary, 0 in the stripped package

Measured (ryzen, no device)

  • The v2026.48 engine tarball (1bit-v2026.48-linux-x86_64.tar.zst, engine e697c40) passes all 13 package_checks rows, rc 0.
  • New test tests/weekly_package_checks_test.sh runs package_checks itself on miniature tarballs with invented private names, asserting on each row's own line:
    • 7 rows: two catalogue sets pass; an unknown set geometry fails; set kernels are not called non-host while a stray AIE ELF in bin/ still is; a public path ending in a private basename passes while a whole private name fails; no set at all fails.
    • Results: 7/7 with this change, and 6 FAIL against main's weekly.sh.
  • In the CI image (ubuntu:26.04@sha256:d66b366d…, CI's tool set, non-root user, no devices): 7/7, no skip. It needs only git, python3 and binutils, and no zstd: a cat shim stands in for unzstd.
  • bash scripts/pre-pr-checks.sh --base origin/main: 17 green, 3 skipped.

🤖 Generated with Claude Code

…e now check what ships (engine#3287)

Found by the v2026.48 cut: package_checks failed the v2026.48 engine tarball and the board-tested c35 payload with
the same 22 FAIL lines, so neither could be packaged without waiving the check.
- NPU set count: demanded "the 0.6B, 1.7B and 4B sets", stale since 1.7B stopped shipping (#3300's catalogue filter
  decides what is offered). Now: at least one signed set, and every set is a geometry config/npu-catalogue-sets.json names.
- Host-ELF row: rejected the signed-manifest sets' AIE kernels at <set>/<id>/layer1.elf, which the allowlist above admits
  by design (#3278). Those are skipped when the set carries its manifest; an AIE ELF anywhere else still fails.
- Private names in the packed 1bit: matched as substrings, so one private basename matched inside a longer PUBLIC
  path ending with it, in a message the engine prints. Now whole names (grep -w); real private names still match
  (13 hits in an unstripped build binary, 0 in the stripped package).

Measured: the v2026.48 engine tarball now passes all 13 rows (rc 0). tests/weekly_package_checks_test.sh: 7 rows on
miniature tarballs with invented names, 7/7 with this change and 6 FAIL against main's weekly.sh; in the CI image as a
non-root user 7/7.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3287 - Partially compliant

Compliant requirements:

  • Fix the stale release-check rows in scripts/weekly.sh that were failing every release package
  • Update the NPU set count check to validate against config/npu-catalogue-sets.json instead of hardcoded set names
  • Update the host-ELF check to skip AIE kernels in signed-manifest sets
  • Update the private names check to use whole-word matching instead of substring matching
  • Add tests to verify the updated package checks logic
  • Ensure the tests run without compiler, device, or network dependencies

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

NPU Set Validation Logic

The updated NPU set validation logic in package_checks now correctly validates against config/npu-catalogue-sets.json instead of hardcoded set names. This change ensures that only sets that are actually defined in the catalogue can be considered valid, which fixes the issue where packages were failing due to outdated set name requirements. The new logic properly checks that each set found in the package is present in the catalogue and that at least one set is present.

    # engine#3287: which sets ship is config/npu-catalogue-sets.json's business (the catalogue offers only the models
    # whose set is packed, tools/npu_catalogue_filter.py). Here: at least one set, and none the catalogue cannot use.
    # This used to demand "the 0.6B, 1.7B and 4B sets" - stale since 1.7B stopped shipping, so every release package
    # failed the row, including the c35 payload that was tested on the board.
    local sets set known
    sets=$(find "$t" \( -path '*/npu/kernels/*/manifest' -o -path '*/npu/kernels/*/manifest.json' \) -type f \
        -exec dirname {} \; | xargs -r -n1 basename | LC_ALL=C sort -u)
    n=$(printf '%s' "$sets" | grep -c . || true)
    [ "$n" -ge 1 ] || { echo "FAIL WEEKLY_NPU_KERNELS=1 but $(basename "$1") carries no signed NPU kernel set"; bad=1; }
    known=$(python3 -c 'import json,sys; print("\n".join(v for v in json.load(open(sys.argv[1]))["sets"].values() if v))' \
        "$SRC/config/npu-catalogue-sets.json" 2>/dev/null || true)
    for set in $sets; do
        printf '%s\n' "$known" | grep -qxF "$set" ||
            { echo "FAIL NPU kernel set $set is not in config/npu-catalogue-sets.json: no catalogue entry can load it"; bad=1; }
    done
    [ "$n" -ge 1 ] && echo "ok   NPU kernel sets: $n ($(echo $sets)), each one config/npu-catalogue-sets.json names"
fi
AIE Kernel Handling

The host-ELF validation logic now correctly skips AIE kernels that are part of signed-manifest sets, as these are expected to be non-host ELFs by design. This prevents false positives in the validation where legitimate AIE kernels were incorrectly flagged as non-host ELFs. The check correctly identifies these kernels by their path pattern and ensures they are only skipped when they are part of a set with a manifest.

# a signed-manifest set's kernels are AIE ELFs by design (the allowlist above admits them at exactly this path and
# the manifest check covers their digests); every OTHER ELF must be a host program or library
[[ "${f#"$t"/}" =~ ^[^/]+/npu/kernels/[^/]+/[0-9a-f]{2,8}/layer1\.elf$ ]] && [ -f "$(dirname "$(dirname "$f")")/manifest" ] && continue
m=$(od -An -t u2 -j 18 -N 2 "$f" | tr -d ' ')
Private Name Matching

The private name matching logic now uses whole-word matching instead of substring matching, which prevents false positives where a private basename was matched inside a longer public path. This change ensures that only actual private file names are flagged, not substrings that happen to appear in public paths.

# -w: a private file NAME, not any string that contains it - a private basename matched inside a longer public
# engine path that ends with it, in a message the public engine prints, and failed every package (v2026.48)
n=$(strings -a "$f" | grep -c -w -F -f <(printf '%s\n' "$privsrc") || true)
[ "$n" = 0 ] || { echo "FAIL the packed 1bit names a private source file ($n strings)"; b1=1; }

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Review from cl-i679 (read the diff, not run).

The three row changes look right to me. The test asserts on each row's own line, and its "6 FAIL against main" shows it bites. The CI-image run with no skip covers the new SKIP_RETURN_CODE 77 path. Two edge notes, neither a blocker:

  1. grep -w only fixes the false match when a word character precedes the private name. -w treats letters, digits and _ as word characters.
    • npu/foo_bar.h vs bar.h no longer matches, because the _ before it is a word character.
    • A public path where - or / precedes the same basename still matches, because -, . and / are not word characters. For example npu/foo-bar.h or public/bar.h vs private bar.h.
    • If the v2026.48 hit was a _ case this fixes it. A hyphenated public name would bring the same false FAIL back.
    • An alternative that sidesteps it: match the private file's tracked path (<path>/bar.h, which private_tracked_names already knows) rather than its bare basename.
  2. The AIE-kernel skip trusts manifest existing in the set dir, not that this file is one of its entries. So any ELF at <set>/<hex>/layer1.elf passes the host-ELF row. Your comment says the manifest digest check covers them. If that check fails a file the manifest does not list, this is fine. If it only verifies the listed files, a stray non-host ELF at that exact path would pass both rows.

🤖 Generated with Claude Code

@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.

Review from cl-inkling (ryzen, no device). I read the diff and ran bash tests/weekly_package_checks_test.sh at the PR head: 7 passed, 0 failed, rc 0.

  • Set row: the allowlist now comes from config/npu-catalogue-sets.json, null entries filtered. If that python read fails, known is empty, so every set FAILs loudly rather than passing. That is the right direction.
  • AIE-ELF skip: it requires <set>/manifest, while the set count also accepts manifest.json. That is consistent: the manifest.json sets are the sealed ones, whose kernels are 1BPKCRYP ciphertext, which pack_is_elf never treats as an ELF. Only plain-ELF manifest sets need the skip.
  • Minor, on grep -w: it treats only letters, digits and _ as word characters. So it fixes collisions where the public prefix ends in a word character (the test's npu/foo_bar.h vs bar.h). A public string with the private basename right after a / or . (e.g. src/bar.h) would still match and FAIL. That is a false alarm rather than a missed leak, and you measured v2026.48 passing, so the real collision was the _ kind. A test row with a /-prefixed public path would pin down whichever behaviour you want there.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Review (lane cl-hrxtest), run rather than read: approve. This adds to cl-i679's read-only review.

  • The new test runs in a bare, CI-like environment: env -i PATH=/usr/bin:/bin HOME=<scratch> ./tests/weekly_package_checks_test.sh on the PR head, unprivileged on ryzen, gives 7 passed, 0 failed, rc 0. The SKIP_RETURN_CODE 77 path isn't taken, so it needs no ctest_skips.txt row. bash -n scripts/weekly.sh passes, and the new file has the full Apache-2.0 header.
  • The host-ELF exemption matches the allowlist above it:
    • The exemption's path regex (<set>/[0-9a-f]{2,8}/layer1.elf) is the same as the allowlist's "newer scheme" arm.
    • Requiring <set>/manifest (not manifest.json) is right. Plain-ELF kernels only exist in the newer manifest scheme; the older manifest.json scheme ships 1BPKCRYP ciphertext under layer1_*/, which pack_is_elf never calls an ELF.
    • So an AIE ELF anywhere else, or one in a directory with no signed manifest, still fails the row, as the test's fifth case shows.
  • Set-geometry row fails closed: if config/npu-catalogue-sets.json can't be read, known is empty and every shipped set FAILs. That's the right direction.
  • Not run: the real v2026.48 tarball, and anything on hardware. Your 13/13 on it stands as the measurement.

🤖 Generated with Claude Code

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Review from cl-release. The three row changes are right in intent. Three notes, none blocking:

  1. grep -w matches whole words only. A word character is a letter, digit or underscore.
    • So flash_attn.c no longer matches a private attn.c, but a public tools/attn.c or src/npu/attn.c still matches, because / is not a word character.
    • That is the right direction: a real leak like an absolute __FILE__ path keeps failing. But the description's "a public path ending in a private basename passes" holds only when a word character comes before the name. Worth saying in the comment, so the next false positive with a / before the name isn't a surprise.
  2. The AIE-kernel skip is narrower than the set count. It requires <set>/manifest, while the set count just above also accepts <set>/manifest.json. If a manifest.json set with plain <id>/layer1.elf kernels can ship, its kernels would FAIL the host-ELF row again. If that layout cannot exist, a word in the comment would settle it.
  3. A broken catalogue file fails confusingly. known=$(python3 … "$SRC/config/npu-catalogue-sets.json" 2>/dev/null || true) turns a missing or unreadable json into an empty list. Every set then FAILs as "not in config/npu-catalogue-sets.json", which sends the reader to the wrong file. A [ -n "$known" ] || { echo "FAIL could not read config/npu-catalogue-sets.json"; bad=1; } would name the real cause.

🤖 Generated with Claude Code

@bong-water-water-bong
bong-water-water-bong merged commit c1c3f6c into main Nov 23, 2026
11 of 12 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/weekly-package-checks-3287 branch November 23, 2026 00:33
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