Repository navigation
tools: kernel-set-check.sh with its three review points answered (carries #2120) - #2200
Conversation
…consistent and in one form (engine#2106)
…h is visible (engine#2106)
…naming is visible (engine#2128)
…ayer-indexed, full notice on the test Three points open on #2120 across four heads: the test carried a two-line notice (CI's copyright step failed), a listed layout.json was classified as a sealed kernel so a correct plain-ELF set failed as MIXED FORMS, and layerN_Mnp/ directories were counted as other. Five new arms; three fail on the script before this change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
PR Reviewer Guide 🔍(Review updated until commit 09b425f)Here are some key observations to aid the review process:
✅ Resolved findingsscripts/kernel-set-check.sh:135Incorrect Layer Directory Naming Regex The regex used to identify layer-indexed directories does not correctly handle suffixes after the layer number, such as |
|
VERDICT: READY at The three points are real fixes, and the first one is the licence gate catching itself
What the branch actually is, measuredSo the two reassuring facts are true — it is properly stacked on #2120, and nothing merged into That is better than the two copy-bundles tonight (#2147, #2164) — merge ancestry stays consistent, and none of it is stale. It still means the body's "main + #2120 + one commit" is a claim about its own work while the diff is five PRs, so:
One thing worth adding while the classifier is openA fixture for a plain set with suffixed layer dirs — the two bugs are both "the classifier's idea of a name was narrower than the name", and one arm with |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
READY at 746839136. The three review points are answered and the test suite is the reason: 20 cases, each holding one refusal or one non-refusal, including the two that matter most — a plain-ELF set that lists layout.json must not read as MIXED FORMS, and suffixed layer directories (layer1_101np/) must count as layer-indexed rather than "other". Both are the shapes that made point 2 and 3 real, and both are now pinned.
Two notes, neither blocking.
1. The exit code carries two facts and one can mask the other. 0 / 1 / 2 are documented as consistent / not consistent / not a set, but the aggregation gives them one channel:
rc=0
for dir in "$@"; do
check_set "$dir" || { rc=$?; [ "$rc" -gt 1 ] && rc=2; }
done
...
[ "$rc" -eq 0 ] && rc=1 # driven by the global `fail`
check_set reports "inconsistent" through the global fail but returns 0 (its last command is the printf), so an inconsistent set leaves rc untouched; only "not a set" sets rc. The consequence is that script goodset noset exits 2 (correct), while script badset noset also exits 2 — and 2 is documented as "the argument is not a set", so the genuine inconsistency in the first argument is not in the exit code at all. A caller scripting on it cannot tell "I was given something that is not a set" from "there was a real finding and also a bad argument". Cheapest fix: two counters (bad for consistency, notset for unparseable) and a stated precedence — e.g. 1 if any set was inconsistent, 2 only when no argument was a set at all. This is the same split as #2094/#2202: one code for two meanings is how the second meaning gets lost.
2. "Not an ELF" is classified as "sealed", so damage reads as a form.
forms.setdefault("elf" if head == b"\x7fELF" else "sealed", []).append(rel)
A zero-length file, a truncated kernel, or anything else that starts with four other bytes lands in sealed. A set with one truncated .elf then reports MIXED FORMS: 1 sealed, 3 elf and sends its reader into the sealed/plain story that this script exists to end — when the finding is "one file is empty". I would classify sealed positively (the sealed container's own header/magic, whatever import_external checks) and let anything matching neither be a third state that says so, e.g. UNREADABLE: 1 file that is neither plain ELF nor sealed. If the sealed form genuinely has no magic to test, then say in the header that "sealed" means "not ELF" and that a damaged kernel will be reported under it.
What I did not check: the manifest schema's own variations (I read the layout.json/suffix cases, not every field a shipped manifest may carry), and anything about whether the sealed binaries are what a device expects — this PR is host-only by design, which is right.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 7468391: READY
This carries #2120 (my CHANGES at a319324) and closes the three points that stood there. It merges cleanly onto main.
Checked at this head:
bash tests/kernel_set_check_test.sh:kernel_set_check: all cases ok.tools/copyright.py --check: rc 0. Point 1 is fixed: the test file now carries the full notice.tools/ci/ci_targets_check.py --check: rc 0. The row is abashctest, registered atCMakeLists.txt:211.- Mutants (one edit each to
scripts/kernel-set-check.sh, then restored; the tree is clean afterwards):
| mutant | result |
|---|---|
the .elf/.bin guard removed, so a listed layout.json gets a form again (point 2) |
rc 1, 2 FAIL: a plain-ELF set that lists its layout.json: rc 0 |
the layer regex back to layer\d+_\d+/ without the suffix (point 3) |
rc 1, 1 FAIL |
- A listed JSON file is still size- and sha256-checked before the guard skips it for form classification, so the
layout.json that changed is still caughtarm holds. - CI:
buildat 7468391 failed inTools for checkout and the buildat 15:01Z. That is the runner DNS outage on the board, not this tree. The checks CI would run on these three files are the ones above.
Non-blocking: as the body says, the proof is fixtures only. I found no shipped kernel set with a manifest.json on this box either. Once this lands, #2120 is redundant and can close.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY -- all three review points are fixed and pinned, including the two I nearly reported as unpinned
I went looking for the two subtle points and first read them as untested; that was my grep, not the PR. Recording both so the next reader does not repeat it -- the assertions are there and they are the right ones:
Point 2 (the listed layout.json), fixture at mask 10:
- a plain-ELF set whose manifest lists
layout.jsongets rc 0 and3 file(s) in plain ELF form, and the test assertsMIXED FORMSis absent -- that negation is the part that matters, because the previous behaviour was a correct set refused, so asserting only rc 0 would pass on a version that still printed the refusal; - and the same fixture then appends one byte to
layout.jsonand requires rc 1 withlayout.json: manifest says .... That is exactly the "held to its size and sha256 like any other entry" half of the fix, tested rather than argued.
Point 3 (suffixed layer directories), fixtures layer1_100np, layer1_101np, layer2_102np: real suffixed directories exist in the fixture tree and the MIXED NAMING arm exercises the both-schemes case, so layer\d+_\d+[a-z]*/ is pinned by a set that would have been counted as "other" before.
Point 1 (the CI copyright step): the file now carries the full Apache notice, which is the only thing that step reads.
What I checked and liked beyond the points: the classification is skipped only for entries whose path does not end in .elf/.bin, so the "one form or none" rule still has a single definition rather than a special case for JSON; and the pack-naming arms (wide32.elf present / absent32.elf missing, with the message naming what the serve would do) cover the neighbouring engine#2128 failure mode in the same harness. 38 check rows, every one of them asserting a message as well as a return code, which is the right shape for a diagnostic script.
One remark, not a blocker: the diff still carries #2120 (a319324) as its base commit, so the review of "this PR" is really #2120 plus the fix commit. If #2120 merges first this collapses to one commit; if it does not, the title should probably say so, because the +480 is being attributed to a three-point fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Persistent review updated to latest commit 09b425f |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 09b425f: READY
Re-review of 09b425f, a merge of main (09b425fd). The PR's own diff (sorted +/- lines against its merge base) is identical to 7468391, READY from me, which carries #2120 and its three fixes.
At this head:
bash tests/kernel_set_check_test.sh:kernel_set_check: all cases ok.tools/copyright.py --check: rc 0.tools/ci/ci_targets_check.py --check: rc 0.- It merges cleanly onto main. CI
buildat 09b425f is green:100% tests passed, 0 tests failed out of 247.
#2120 is still redundant once this lands.
Refs #2106 and #2128. This branch is
main+ #2120 (a319324) + one commit that answers the three review points that have stood on #2120 across four heads.The three points
tests/kernel_set_check_test.shcarried a two-line notice, so the "Copyright notice on every file" step failed. It now carries the full Apache notice.layout.jsonthat shipped manifests list. Only.elf/.binentries are classified now. A listed JSON file is still held to its size and sha256.layer\d+_\d+/; it is nowlayer\d+_\d+[a-z]*/, solayer1_2081np/counts as layer-indexed.Proof
Five new arms in
tests/kernel_set_check_test.sh(ctest rowkernel_set_check). No device and no real kernel bytes; the fixtures are byte strings.At this head:
The same test file against #2120's script at
a319324:Not run: the script against a real shipped set. I found none installed at the usual paths on this box, so the proof is fixtures only.
Merging
This PR contains #2120 whole, so merging it makes #2120 redundant.
🤖 Generated with Claude Code