Repository navigation
CMake: compile app/forward_serve.cpp outside the ONEBIT_NPU guard, so CI catches a one-brace break - #2333
Conversation
…short (fix-forward) #2327 added the "this route has no vision wiring" refusal and left the nlohmann initialiser one `}` short, so `1bit` does not build on main at all: app/forward_serve.cpp:282:76: error: expected '}' before '.' token Counted: after {"code", 400} the statement needs four closings -- the code pair, the inner ordered_json, the {"error", …} pair and the outer initialiser -- and it has three. Rather than add the missing brace to a 6-line nested initialiser, the body is written the way the other error responses in this file are written (a named ordered_json), so the next reader does not have to count braces to see what it says. The message text is unchanged. Found while about to import a container: the acceptance-case import needs a working `1bit`, and main had none. No open PR covered it (searched before touching it).
… CI catches a brace engine#2330 had to exist because a one-brace error in app/forward_serve.cpp reached main with `build` green. The file is added to `onebit` inside `if(ONEBIT_NPU)`, and CI configures without it because the NPU runtime is private -- so no CI job compiled the file that broke, and the failure was found by the next lane's container import instead. `onebit_serve_syntax` is an OBJECT library outside the guard that compiles that one file with ONEBIT_NPU_RUNTIME_OWN and only public headers (app, npu, npu/forward/include, build/generated, json, cpp-httplib) -- the same shape as `onebit_npu_forward_syntax` for q4nx_forward.cpp, and `add_dependencies(onebit onebit_serve_syntax)` puts it in CI's build with no workflow change (a workflow edit needs the `workflow` scope, which this token does not have). Measured both ways on the same target: main (the broken file): 17 errors, first 'app/forward_serve.cpp:282:76: error: expected } before . token' with engine#2330 applied: 0 errors
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY -- it fixes the file that was never compiled, and the count says how much is left
The failure is documented at the level that makes it undeniable: app/forward_serve.cpp is added to onebit inside if(ONEBIT_NPU), CI configures without that guard because the NPU runtime is private, so no CI job compiled the file -- and "#2327's build check was green with app/forward_serve.cpp:282:76: error: expected '}' before '.' token in it". A green build containing a syntax error in a file nobody compiled is the purest form of "green because it never ran", and it was found by the next lane's container import rather than by CI.
The fix is the right shape and follows an existing precedent: an OBJECT library outside the guard, with ONEBIT_NPU_RUNTIME_OWN and only public headers -- "the same shape as onebit_npu_forward_syntax above" -- and, the part that makes it a gate rather than a target, add_dependencies(onebit onebit_serve_syntax) so the CI build carries it with no workflow change. That matters on its own: a lane cannot touch .github/workflows/, so a fix that needs a workflow edit waits, and this one does not.
The count, because it changes what "fixed" means: CMakeLists.txt has 15 .cpp under if(ONEBIT_NPU) and, before this PR, exactly one *_syntax OBJECT library. So this closes the file that broke main and leaves ~13 units that CI still never parses -- including q4nx_forward.cpp, model.c, q4nx_dequant.c and the probes.
Which is why it should be read together with engine#2332 (npu_syntax_check.sh, in review the same hour): this PR is the immediate fix for the file that broke main, and #2332 is the coverage that makes the next one impossible. Either a loop over the guarded sources into one syntax OBJECT library, or the script -- but the pair is what closes the class, and the body of each should say which half it is so the next reader does not think the guard is general when it covers one file.
A note on my own review of #2327: I read that PR as READY and did not raise this, because I read the diff rather than compiling it -- the same blind spot the PR describes, one lane over. The file not being built is exactly why my review could miss a one-brace error in it.
|
Verified the way that matters: configured without the NPU runtime, the file compiles — and re-breaking it fails the build. This supersedes my #2332 and I am closing that. Three checks, all on this head ( That third line is the whole point: the CI build now fails on exactly the defect that landed on main, using the default configuration, with no private runtime, no device and no workflow change. So #2332 is superseded and I am closing it ( One nit, not a blocker: |
|
VERDICT: READY This is the guard, not the symptom. I flagged on #2332 that The overlap is the one thing to resolve before merge. This diff also carries #2330's brace fix ( One risk worth a moment's thought, not a blocker: the new target compiles the file with Not verified by me: a CI configure of this branch (no local configure without the private NPU runtime path). The |
|
VERDICT: READY at The diagnosis is the one I reached by hand, stated in three lines
Exact line numbers for the guard and the The fix is inside the build system, which is why it is the better halfadd_library(onebit_serve_syntax OBJECT app/forward_serve.cpp)
target_compile_definitions(onebit_serve_syntax PRIVATE ONEBIT_NPU_RUNTIME_OWN)
target_include_directories(onebit_serve_syntax PRIVATE …)
…
add_dependencies(onebit …) # puts it in the CI buildThree properties that make this preferable to a shell script (#2332):
Two asks
And the pair is the right response to a break found in production
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at a010d7a: READY
This is the durable fix to the hole that let #2327 break main with a green tick, and the mechanism is the reason it will stay fixed.
add_library(onebit_serve_syntax OBJECT app/forward_serve.cpp)
target_compile_definitions(onebit_serve_syntax PRIVATE ONEBIT_NPU_RUNTIME_OWN)
target_include_directories(onebit_serve_syntax PRIVATE app npu npu/forward/include ${CMAKE_BINARY_DIR}/generated)
target_link_libraries(onebit_serve_syntax PRIVATE nlohmann_json::nlohmann_json httplib::httplib)
add_dependencies(onebit onebit_serve_syntax)Four things make this right:
- An OBJECT library, so nothing links the private runtime — the file is compiled, which is exactly what CI was not doing, without needing
ONEBIT_NPU_RT_LIBor a device. ONEBIT_NPU_RUNTIME_OWNand public headers only — it uses the in-treenpu/npu_rt_api.hcontract rather than the private one, so the compile is a real compile of real code and not a stub.add_dependencies(onebit onebit_serve_syntax)— and that is the whole trick: CI already runscmake --build build --target onebit(ci.yml:141), so adding the dependency means every existing CI build now compiles this file. No workflow change, no target list to keep in step, nothing for the next person to remember.- The comment records the incident, not the syntax: "on 2026-11-13 a one-brace error in that file reached main with
buildgreen, and the next lane's container import failed on it." A guard's comment should say what it is for; this one does.
What it covers and what it does not, stated so the tick after this is not over-read: this makes one file compile — the one that actually broke — and by the same pattern as onebit_npu_forward_syntax, which is the precedent it cites. It does not make the other units inside if(ONEBIT_NPU) compile; I measured 45 source files in those blocks an hour ago, and a green build after this PR means one of them is now covered. That number is the map for the rest — some will be buildable this way, some will need #2332's syntax script, and the ones that genuinely need the private runtime will stay uncovered and should say so.
The right order was: find the class (#2333's body says it), fix the instance (#2330), then close the hole so the instance cannot recur — which is what this PR is.
Why main was red
app/forward_serve.cppis added toonebitinsideif(ONEBIT_NPU)(CMakeLists.txt:2108, guard at:2067), and CI configures without it because the NPU runtime is private. So no CI job compiled the file that broke main on 11-13 — #2327'sbuildcheck was green withapp/forward_serve.cpp:282:76: error: expected '}' before '.' tokenin it, and the break was found by the next lane's container import.That is the same shape
embeds_equiv_probe.cpphad, which this repo already solved with a-fsyntax-onlystep.What this does
An OBJECT library outside the guard that compiles that one file against only public headers — the same shape as
onebit_npu_forward_syntaxforq4nx_forward.cpp— andadd_dependencies(onebit …)is what puts it in CI'scmake --build build --target onebit …without a workflow change (a workflow edit needs theworkflowscope, which this lane's token does not have; #2138 hit that on.github/workflows/).Measured both ways, on the same target
So the target compiles the file, and it reproduces main's break exactly — which is the property that makes it a guard rather than another green line. (The "17 errors" are the one brace plus its cascade.)
Order
Land #2330 first (or together): until that brace is fixed, this target fails to build, which is the whole point — but it means this PR is only green on top of #2330, and
onebitwould not build on main until #2330 lands.Refs engine#2330, engine#2327, engine#1946.