Repository navigation
release-check: auth_post works on an image that has curl but no wget - #1079
Conversation
`got`/`got_slow` try wget first and pass their arguments through unchanged, but a POST body is spelled
differently by the two tools: wget takes `--post-data`, curl takes `--data`. On an image with wget absent
and curl present, every `auth_post` row therefore read an EMPTY body and reported "no answer" for a server
that had answered - a false FAIL, on exactly the installed-to-disk run the release check exists to prove.
Measured on this box, same server, same request, PATH containing curl but not wget:
old auth_post: 0 bytes (row says "did not answer")
new auth_post: 627 bytes (the real reply)
And with wget present the reply is unchanged (640 bytes on the same request), so the stick's behaviour does
not move.
`post_fetch` now owns the POST path and picks its fetcher (wget when present, else curl, never passing a
wget flag to curl). `RELEASE_CHECK_FETCHER=wget|curl` forces one, which is how both branches were exercised
here; the self-test is unchanged and passes.
Found while exercising a new release-check row against a live server rather than reading it: the row worked
with wget and silently measured nothing without it.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 9385fc1 — I reproduced the false FAIL and then the fix, against a real POST server, and the self-test still passes.
The bug, reproduced at the level it happens (wget's flag handed to curl, which is what the old got/got_slow did when wget was absent — an image with curl but no wget):
$ curl -sf --post-data='{"model":"m"}' http://127.0.0.1:18094/v1/chat/completions
curl: option --post-data={"model":"m"}: is unknown
-> 0 bytes <- the row says "did not answer", the server answered
$ curl -sf --data '{"model":"m"}' -H 'Content-Type: application/json' …
-> {"got": 13, "echo": "{\"model\":\"m\"}"} (40 bytes) <- what post_fetch does now when _f=curl
So the diagnosis is exact: the flags are not interchangeable, post_fetch now spells the body per fetcher (--data for curl, --post-data for wget), and the row that was false-FAILing reads the real reply.
The new post_fetch is the right shape, and better than a minimal fix would have been: it picks the fetcher once (RELEASE_CHECK_FETCHER override, then command -v wget), and then has one branch per tool with the body spelled correctly in each, headers included. That means the Authorization: Bearer path cannot drift between the two tools either — which is the same class of defect one step over, since an auth header is spelled --header by both but a body is not.
bash os/mini/release-check.sh --self-test → PASS at this head, so the verdict logic the row feeds is unaffected (including the "ciphertext changed after hashing → FAIL" and "sealed set with no manifest → FAIL" cases).
Worth carrying to the rest of the file: the same wget-first assumption is how got/got_slow are written (wget … || curl … with the same arguments), so any other row that passes a body through got has the identical hole. I checked the ones in this file and auth_post was the only body-carrying caller; a grep -n 'got .*--data\|got .*--post-data' in review is the cheap way to keep it that way.
Not verified: the row on an actual image built without wget — that is the author's run (0 → 627 bytes). What I can stand behind is the mechanism, reproduced here, and that the file's own gate is green.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
… of them inside the split's file, and the moved block survives it main went bd7d451 -> cb5866e -> 05da4d8 while the five gate rows were being re-measured, and one of the twelve commits edits the file the split is built around: npu/forward/src/q4nx_forward.cpp +38/-5 (#1087 rope-scaling refusal by name, #1072 the batch phase counters zeroed BEFORE BatchPhases snapshots them) npu/forward/include/q4nx_rope.h +72 (new: q4nx_rope_declared_type / q4nx_rope_type_supported) npu/pack_import.cpp/.h +97 (#844 final-norm import from the .fconst tail envelope) app/, config/, docs/, tests/, tools/, os/ (laya-first #1069, determinism tool #1068, serve logging #1074, onnx pricing #1076, puppy vm-check #1080, release-check #1079/#1071) third_party/llama.cpp pin bump 6e42864a6 (#1075) Textually clean (`git merge-tree --write-tree` produced no CONFLICT), which is exactly the case that was NOT clean the last time main landed in that file — so the merge was checked by what the compiler and the tests say, not by "auto-merging" messages: - #1072 moved `BatchPhases bph` / `BatchPhaseScope _batch_scope` / `tp_bs` so the counters are zeroed before the snapshot is taken. Those symbols live in npu/forward/include/q4nx_lh.h in this branch (the move this PR exists for); the statement order is main's and is carried over verbatim, so the reordering lands on the header's definitions unchanged. - The moved set is still defined exactly once: `inline StepPhases g_ph` (q4nx_lh.h:116), `phprof_on`/`ph_ms` (q4nx_lh.h, one each), `inline bool g_in_batch` (:131), `struct BatchPhaseScope` (:132), `lh_dump_layer_host` — and q4nx_forward.cpp no longer defines any of them. - `BatchPhases` remains a local struct in q4nx_forward.cpp (one definition), which is where main keeps it. Build: `cmake --build build-p4 --target onebit -j4` under ~/lb/thermal-run.sh -> rc 0, 16 objects rebuilt (warm tree; the pin bump and the two touched TUs). Tests: `ctest` **87/87, 0 failed** (85 passed, 2 skipped: mtp_batch_all, gdn_batch_order — the same two that skip on main). Consequence, stated rather than implied: the five gate rows measured on A=bd7d451a are VOID and are being re-run against A built at this main; this commit carries no numeric claim of its own.
What
got/got_slowtry wget first and pass their arguments through unchanged — but a POST body is spelleddifferently by the two tools: wget takes
--post-data, curl takes--data. On an image with wget absentand curl present, every
auth_postrow therefore read an empty body and reported "no answer" for a serverthat had answered: a false FAIL, on exactly the installed-to-disk run the release check exists to prove.
Measured before/after
Same server, same request,
PATHcontaining curl but not wget:With wget present the reply is unchanged (
640 byteson the same request), so the stick's behaviour does notmove — the fix only takes effect where the old path silently measured nothing.
How
post_fetchnow owns the POST path: it picks its fetcher (wget when present, else curl) and never passes awget flag to curl.
RELEASE_CHECK_FETCHER=wget|curlforces one, which is how both branches were exercisedhere.
auth_postkeeps its signature, so every existing row is unchanged../os/mini/release-check.sh --self-testpasses (it never touched the fetchers, so it is unchanged); thefetcher paths were proven against a live lemond, not by reading.
Why it is worth a PR of its own
Found while exercising a new release-check row (the
laya-autorow, #1071) against a live server insteadof reading it: the row worked with wget and silently measured nothing without it. The same defect sits under
every POST row in the file, which is why this is separate from #1071 rather than folded into it.