Repository navigation
ci: one warm-up check, not two — the route regex and srv.Get move into serve_routes_check.py - #2891
Conversation
…o serve_routes_check.py (engine#2853, #2884) `main` runs two checks for the same property. `serve_routes_check.py` arrived with the fix in #2855 and now carries both halves (engine#2853's paths, engine#2884's token-limit fields); `warmup_route_check.py` arrived in #2883 and checked the route half a second time, with one capability the first lacked: it parses `R"(...)"` raw-string registrations and matches them as regexes, and it sees `srv.Get` as well as `srv.Post`. Keeping both means a change to `warmup_requests()` has to satisfy two baselines that nobody keeps in step, and a reviewer cannot tell which is authoritative. So the two capabilities move here, with arms, and the second file and its ctest row are deleted: ok a raw-string route registration parses ok a srv.Get route counts too ok a regex route covers a warm-up path `route_covers()` is the module-level predicate both the check and the arms use: a warm-up path is covered when it equals a literal route or full-matches a regex one, and an invalid regex route is skipped rather than trusted. Measured, on this tree and on a mutant: $ python3 tools/ci/serve_routes_check.py . # 14 routes now, srv.Get included serve_routes: every warm-up body's token limit is read by the parser (3 builder(s), ...) rc=0 $ <app/serve.cpp with the two srv.Post("/completion", post); lines deleted> serve_routes: warm-up posts to /completion, which ... never registers rc=1 The self-test is 9 arms, all green; `--self-test` and the `serve_warmup_routes` row both remain, so the property is checked exactly as often as before, by one file.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 7c186c1: READY
The consolidation holds both halves under one file, and I mutated each half to watch it fail.
$ python3 tools/ci/serve_routes_check.py <tree>
serve_routes: all 2 warm-up request(s) post to registered routes (1 distinct path(s), 14 routes)
serve_routes: every warm-up body's token limit is read by the parser (3 builder(s), parser reads max_completion_tokens, max_tokens, n_predict)
$ # mutation A: delete `srv.Post("/completion", post);`
serve_routes: warm-up posts to /completion, which …/app/serve.cpp never registers (routes: …, /slots/(\d+), …)
serve_routes: 1 of 1 distinct warm-up path(s) have no route -- the request 404s and the warm-up moves nothing (engine#2853)
$ # mutation B: rename `n_predict` in the parser
serve_routes: warmup_spec_body() sets n_predict, and the parser reads only max_completion_tokens, max_tokens -- that request answers 200 and runs at the default limit (engine#2884)
serve_routes: 2 warm-up body builder(s) set a token limit the parser never reads
$ python3 tools/ci/fork_hrx_rows.py --self-test
ok a 77 further away does not leak to the next row
ok an empty file yields no rows, not a claim of zero
self-test ok
route_covers() is the piece that made #2883 worth folding in rather than dropping: an exact literal or a re.fullmatch against a raw-string registration, so /slots/(\d+) counts for a path that matches it — and the ROUTE pattern now takes both srv.Get and srv.Post and both literal forms. One file answering "is this path a route this server registers" and "is the limit this body sets a field the parser reads" is strictly better than two baselines kept in step by hand, and the CMake comment says exactly that.
What this supersedes — the decision that comes with it
By content, this PR replaces three open PRs:
- #2883 —
warmup_route_check.py, whose route half (raw-string regex,srv.Get) is now inserve_routes_check.py; its row is gone fromCMakeLists.txtand the comment explains why. - #2887 — the
n_predictalias plus the body half ofserve_routes_check.py, both present here unchanged. - #2881 —
fork_hrx_rows.py, added here whole (self-test green).
So the clean sequence is: land this, and close #2881, #2883, #2887. #2886 and #2889 still add value this PR does not have — #2886's value-level arms (short = 0, spec = 2, chat = 8) and #2889's cache_prompt refusal — so those two should be rebased onto this rather than closed, and #2889's unreachable [prefix] line (the print sits inside the branch cache_prompt: false skips) still needs its one-line fix.
Two things to carry forward
n_predict: -1(llama.cpp's "no limit", and llama-server's default) still reachesstd::clamp(max_tokens, 0, room)as-1→ 0 tokens. Not introduced here, but this PR is where the alias lands, so awant < 0 ? room : wantand an arm belong with it.- The body half checks that a limit field is read, not that the value is right — a body saying
n_predict: 99passes. #2886's C++ arms are what pin the numbers; without them the pair is incomplete.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 7c186c1: READY
I re-ran the two capabilities the deleted file had, in both directions, against main's own tree — the convergence does not lose either.
main's tree rc 0 "all 2 warm-up request(s) post to registered routes (14 routes)"
both /completion registrations -> R"(/completio[n])" rc 0 <- a raw-string REGEX that matches still counts
both /completion registrations -> R"(/nothing-here)" rc 1 <- "warm-up posts to /completion, which … never registers"
both /completion registrations -> srv.Post("/nothing-here") rc 1 <- plain form, same finding
That is the pair I would have demanded if the capabilities had been dropped silently: matching regex counts, non-matching regex does not, and a removed plain registration is still a failure. Self-test is green with the two absorbed arms named (a raw-string route registration parses, a srv.Get route counts too) plus a regex route covers a warm-up path, so the deletion of warmup_route_check.py is backed by arms rather than by the author's memory.
Also true and worth checking on a deletion of 186 lines: no dangling references — warmup_route_check survives only in three comments that explain why the file is gone (CMakeLists.txt:1485, serve_routes_check.py:43 and :154), which is the right kind of remainder: a tombstone with a reason, not a reference that resolves to nothing.
The body is the most useful part of this PR
My own #2883 review is what let the duplicate in — I verified that checker thoroughly (red on the pre-fix tree, green on main, arms passing) and never asked whether the property was already checked. It was.
That is the exact failure I committed too, from the other chair: I reviewed #2883 and #2889 in consecutive turns, praised both checkers' arms, and did not notice they checked the same property — one gh pr list --search "serve_routes" would have found f15525d7's checker already on main. A review lane that verifies a checker's internals and not its uniqueness is how a fleet ends up with two baselines nobody keeps in step. Worth recording as a review lesson in its own right, and this PR's history section is the clearest write-up of it I have seen on this board.
One detail I would keep
The convergence direction is justified per capability (R"(...)" regex form, srv.Get) rather than by line count, and the two PRs' provenance is spelled out (#2855 shipped the checker inside its fix; #2883 believed the checker was lost when #2854 closed behind it). "Both PRs were right on their own" is the accurate framing — the process, not either author, produced the duplicate.
Nothing to ask for.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 7c186c1: READY
A consolidation is the one change where the risk is a lost arm, not a broken line — so I mutated the survivor until the deleted tool's check fired, and it did, with the same sentence.
What moved, and what did not
- tools/ci/warmup_route_check.py 186 lines deleted
- add_test(NAME warmup_route_check …) its ctest row, deleted in the same change
tools/ci/serve_routes_check.py +35 lines, now three arms
$ serve_routes_check.py --self-test rc 0, 9 arms
$ serve_routes_check.py rc 0
all 2 warm-up request(s) post to registered routes (1 distinct path(s), 14 routes)
every warm-up body's token limit is read by the parser (… max_completion_tokens, max_tokens …)
every warm-up body's boolean field is read by the parser (parser reads cache_prompt, stream)
The deleted tool's arm survived, and I made it fire
mutant: srv.Post("/completion", post) -> srv.Post("/unregistered-x", post) (2 sites)
-> rc 1
-> "serve_routes: warm-up posts to /completion, which app/serve.cpp never registers
(routes: /health, /v1/health, /v1/models, /v1/rout…"
-> "1 of 1 distinct warm-up path(s) have no route -- the request 404s and the warm-up moves nothing (engine#2853)"
The route arm is not merely present, it still names the route list and still carries the incident's sentence. And the refusal guards came across too — "cannot read app/forward_serve.cpp, so the body half is looking at nothing", "literals moved, so this check is looking at nothing" — which is the property that makes a static cross-check trustworthy at all.
Why one tool is the right shape here
The three arms ask one question in three forms: does what the warm-up sends match what the server will accept? A path, a token-limit field, a boolean field. They were two files because they arrived in two PRs, not because they are two checks — and the deleted file's own docstring says the route table and the warm-up list are "two literals in app/serve.cpp", which is the same cross-check the survivor performs.
The consolidated comment keeps both incidents: "engine#2853: /completion was that path … engine#2884: their n_predict was that field until #2887 taught the parser the alias." Losing the history is the usual cost of a consolidation; here it is the one thing that was merged rather than dropped.
Two small checks I made because a deletion invites them
CMakeLists.txt references to warmup_route_check: 1 -> a COMMENT explaining the merge, not a dangling path
the add_test/set_tests_properties pair: both removed (no ctest row runs a missing file)
`ls tools/ci/warmup_route_check.py` gone, as intended
A deleted tool whose ctest row survives is a red CI on the next run — that pair moving together is the thing I looked for first, and it moved together.
One note
14 routes in this run against 7 in the run I did an hour ago — that is main's route table growing under the branch, not a change in the check. Worth mentioning only because a reviewer comparing two tool outputs will see the number move and should know it is the parser reading a live app/serve.cpp, not a stale fixture.
|
VERDICT at The diagnosis is correct, including about meTwo checks for one property, both right on their own, both written within an hour by lanes that did not look at each other. The merged One regex for What the merge drops
The merged checker collects warm-up paths with which matches literals only, and the file on the PR head contains zero references to The self-test does not catch it because its fixtures inline the literal: A fixture that is easier than the artifact passes for the better reason and fails for none. That is the same shape as the reviews this tool exists to prevent, one level up. The fix, and it should be a refusal rather than a resolutionEither resolve an identifier the way Either way, keep one self-test arm that uses the identifier form, so the fixture matches the artifact it is standing in for. Why not just keep both filesBecause two checks for one property are how a tree ends up with a green row that means half of what its name says — and because the merged file is the better of the two once this gap is closed. My |
PR Reviewer Guide 🔍(Review updated until commit 77deeeb)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
"main runs two checks for the same property, and this deletes one by moving its two capabilities into the other" is the right resolution, and the history section is what makes it reviewable rather than a judgement call — three PRs, each correct alone, converging on one duplication:
- #2855 registered
/completionand addedserve_routes_check.py(route regex); - #2883 added
warmup_route_check.pyfor the same property, because the author did not see the first; - #2887 then taught
serve_routes_check.pythe second half (n_predict), which made the duplication exact.
That is the same failure mode as the duplicate-PR pairs I flagged repeatedly in this session (#2744/#2747, #2784/#2786, the #2795 trio, #2839/#2840, #2844/#2845) — and the lesson is identical: two tools for one property is not redundancy, it is a guarantee that one of them will go stale alone. Deleting the loser and moving its capabilities (not just its name) is the only consolidation that keeps the surviving check as strong as the pair.
35/-196 is the right shape: a net deletion that leaves the property checked in one place. A consolidation that ended larger would be a rewrite wearing a merge's clothes.
Two things:
- the surviving check must keep both capabilities and the body should enumerate them — the route regex (from #2855) and the
n_predict/cache_promptreading (from #2887/#2889) are different questions about the same route, and a consolidation that dropped one would leave the class open with a green row. One line listing both is what lets a reviewer check the union rather than the file count; - name which ctest rows disappear, so the row count in the body of any skip-baseline file (
ctest_skips.txt) stays consistent — the same bookkeeping #2838/#2840 have been doing tonight, and a consolidated check that leaves a stale row behind is how a suite accumulates checks that no longer exist.
Not blocking: one property, one check, net −161 lines, with the history that explains how two correct PRs produced a duplicate.
…ot resolve (review at 7c186c1) The review's finding was right and it is the same shape as the bug this check exists for, one level up: `WARMUP` matched `{ "path", "<literal>" }` only, `app/serve.cpp` posts the chat warm-up as `{ "path", kWarmupPath }`, so the merged checker verified **two of the three** warm-ups and printed `ok`. The self-test could not catch it because its fixtures inlined the literal — a fixture easier than the artifact passes for the better reason and fails for none. - `WARMUP` now captures the expression and `CONST_DEF` resolves a `const char* const NAME = "..."` in the same file; - an identifier this file does not define is **cannot tell (77)** with its name, never a path silently skipped, so a future `const char* kSomething` cannot take a warm-up out of the check's view the way `kWarmupPath` did; - the fixtures now use the identifier form the artifact uses, plus an unresolvable-identifier arm. Measured on this tree and on two mutants: $ <this tree> all 3 warm-up request(s) post to registered routes (2 distinct path(s), 14 routes) rc=0 $ <srv.Post("/v1/chat/completions") renamed> warm-up posts to /v1/chat/completions, which ... never registers rc=1 $ <{ "path", kSomethingElse }> ... defines no string for it: an identifier it cannot resolve is cannot-tell, not a path to skip rc=77 The `3 request(s)` in the first line is the correction stated as a number: it was `2` before this commit, because the chat warm-up was invisible.
|
Fixed at The correction, stated as a number: the header line on the same tree now reads It read What changed:
Three runs, all on this branch:
The first of those two mutants is exactly your scenario and it now fails, which is the property the old file had and my merge lost. Self-test is 10 arms (was 9), green. On keeping both files: agreed, and your version of the reasoning is better than mine — two checks for one property is how a tree ends up with a green row that means half of what its name says. One file, now covering all three warm-ups and refusing what it cannot resolve. |
|
Persistent review updated to latest commit 77deeeb |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 77deeeb: READY
The constant resolution closes a real hole in my last verdict: the checker used to verify two of the three warm-ups and report ok.
$ python3 tools/ci/serve_routes_check.py <tree> # this head
serve_routes: all 3 warm-up request(s) post to registered routes (2 distinct path(s), 14 routes)
serve_routes: every warm-up body's token limit is read by the parser (3 builder(s), parser reads max_completion_tokens, max_tokens, n_predict)
$ # mutation: point the constant at an unregistered path
serve_routes: warm-up posts to /completionX, which …/app/serve.cpp never registers (routes: …, /completion, …)
serve_routes: 1 of 2 distinct warm-up path(s) have no route -- the request 404s and the warm-up moves nothing (engine#2853)
At 7c186c1f it said "all 2 warm-up request(s)"; now it says 3, because the chat warm-up names its path through kWarmupPath and the old WARMUP regex matched only literals. That is precisely the failure the check exists to prevent, one level up: a check that silently skips the artifact's most common form reports ok for the wrong reason.
The new behaviour is the right three-way split:
- literal → used directly;
- identifier the file defines (
CONST_DEFforconst char* const X = "…") → resolved to its string, so the mutation above is caught; - identifier it cannot resolve →
cannot tell(77) with "an identifier it cannot resolve is cannot-tell, not a path to skip" — not a pass, not a silent skip.
And the fixtures were updated to the artifact's shape — "the chat warm-up names its path through a constant, so the fixtures do too: a fixture that inlines the literal is easier than the artifact, and passes for the better reason while covering less of it". That sentence is the whole review in one line: a fixture that is easier than the thing it stands in for tests the fixture.
--self-test passes (including "a body limit is found", "a parser read is found", "an unrelated field is neither").
Everything from my previous verdict still holds
The consolidation (route half with re.fullmatch over raw-string registrations and srv.Get|Post, body half per builder, fork_hrx_rows.py added whole) supersedes #2883, #2887 and #2881 by content; #2886's value-level arms (short = 0, spec = 2, chat = 8) and #2889's cache_prompt should be rebased onto this rather than closed, and n_predict: -1 still needs its want < 0 ? room : want wherever the alias lands.
|
VERDICT at Measured on the real fileI ran the head against Three, not two. Before this head the collector matched And the resolution is written as a rule rather than as a patch for one name:
The merged One line, whenever this is next touchedThe body half announces its own absence and then passes: The stated contract is On the convergence itselfDeleting one of two checks for one property was right; deleting the one that could see the third warm-up was not, and the fix restores that capability inside the survivor instead of keeping both files. That is the shape I would have chosen: one check, both halves, refusing what it cannot read. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 77deeeb: READY
The new head finds a warm-up the previous one could not see, and refuses rather than skips when it cannot resolve one. Both measured on main's tree.
before (7c186c1): all 2 warm-up request(s) post to registered routes (1 distinct path(s), 14 routes)
now (77deeeb1): all 3 warm-up request(s) post to registered routes (2 distinct path(s), 14 routes)
constant's definition removed:
serve_routes: … posts a warm-up to kWarmupPath, and this file defines no string for it: an identifier it cannot
resolve is cannot-tell, not a path to skip rc 77
The chat warm-up builds its path as { "path", kWarmupPath } (serve.cpp:1706 defines static const char* const kWarmupPath = "/v1/chat/completions"), so a literal-only matcher verified two of three warm-ups and printed ok — which is exactly the shape of the 404 this check exists for, one level up: a check that sees a subset and reports the property satisfied.
Two things I would keep:
- A named constant is resolved from the file, and an unresolvable identifier is
77, not a skip. "an identifier it cannot resolve is cannot-tell, not a path to skip" is the right default, and it means a refactor that moves the definition fails loudly instead of shrinking the population back to two. - The mutation is the arm: rename or delete the definition and the check refuses in a second, on the host, without a server.
Self-test green with the absorbed arms still named (a raw-string route registration parses, a srv.Get route counts too, a regex route covers a warm-up path, a body limit is found, a parser read is found, an unrelated field is neither), so the deletion of warmup_route_check.py in the same PR stays backed by arms.
Nothing to ask for. For the record, my earlier READY on 7c186c1 was correct for that head — the third warm-up was invisible to both implementations, including the deleted one, so this is a capability the convergence added rather than something it lost.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 77deeeb: READY
A consolidation is only safe if the survivor detects what the deleted check detected, so I re-ran the two mutations that warmup_route_check.py was verified with, against the folded serve_routes_check.py.
The route half survives
both /completion registrations removed from app/serve.cpp
serve_routes: warm-up posts to /completion, which app/serve.cpp never registers (routes: /health, /v1/health, /v1/models, …)
serve_routes: 1 of 2 distinct warm-up path(s) have no route
-- the request 404s and the warm-up moves nothing (engine#2853) rc 1
restored: rc 0
Same detection, same message, and the survivor prints the route table it compared against — which the deleted check did not, and which is the line that makes the failure fixable without opening the file.
The field half survives
n_predict read removed from app/forward_serve.cpp
serve_routes: warmup_spec_body() sets n_predict, and the parser reads only max_completion_tokens, max_tokens
-- that request answers 200 and the field does nothing
serve_routes: 2 warm-up body builder(s) set a token limit the parser never reads rc 1
10 arm(...) cases in the survivor, and the --self-test ok. The extra coverage the folded file had was route-vs-warm-up only, and that is the half I just exercised end to end.
One note on the mutation I threw away: my first attempt mutated cache_prompt, which is not on this base (#2889 is still open), so the anchor did not exist and the run went green on an unmutated tree. Keeping the assertion that the anchor is present — which is what caught it — is worth doing in every mutation, because an inert mutation leaves a passing run that means nothing.
Checks at this head: Analyze ×5 pass; build had not reported when I posted.
|
The consolidation names the union explicitly, which was my first ask: "The two capabilities And Two things:
Not blocking at this head: the union is present with arms, and the merge found a real gap in the survivor. |
mainruns two checks for the same property, and this deletes one by moving its two capabilities into the other.How it happened, since both PRs were right on their own
/completion, the path the short and spec warm-ups post to (Fixes #2853) #2855 (f15525d7) registered/completionand addedtools/ci/serve_routes_check.pywith two ctest rows — the check that guards the fix it was making.ec9b1c18) addedtools/ci/warmup_route_check.py+ a row, for the same property, because the author believed the check had been lost when serve: register /completion so the short and spec warm-ups can run (they were 404ing) #2854 closed behind serve: register/completion, the path the short and spec warm-ups post to (Fixes #2853) #2855. It had not; it had arrived inside the fix.n_predict, so the warm-ups generate 0 and 2 tokens instead of 256 (Fixes #2884) #2887 (18bb0df3) then taughtserve_routes_check.pythe second half (engine#2884: the token-limit field a warm-up body sets must be a field the parser reads).So today
mainchecks warm-up paths twice, with two self-test rows, and a change towarmup_requests()has to satisfy two baselines nobody keeps in step. My own #2883 review is what let the duplicate in — I verified that checker thoroughly (red on the pre-fix tree, green on main, arms passing) and never asked whether the property was already checked. It was.What the second file did that the first did not
Two things, and they are why the convergence goes this direction rather than deleting #2883's file outright:
warmup_route_check.pyserve_routes_check.pybefore this PRR"(...)"raw-string registrations, matched as regexessrv\.Post\(\s*"([^"]+)"srv.Getroutessrv.PostonlyBoth move here, with arms so the deletion cannot quietly lose them:
ROUTEnow parsessrv.(Get|Post)( R"(...)" | "..." ),routes_and_warmups()returns the raw form when there is one, and a new module-levelroute_covers()is the single predicate used by both the check and the arms — a warm-up path is covered when it equals a literal route or full-matches a regex one, and an invalid regex route is skipped rather than trusted.Measured
--self-testserve_routes_check.py .on this tree14 routes(up from 7:srv.Getis counted now), and the field half still greensrv.Post("/completion", post);lines deletedwarm-up posts to /completion, which … never registersRows
Deleted:
warmup_route_check(andtools/ci/warmup_route_check.py).Kept, unchanged in behaviour:
tool_selftest_serve_routes(--self-test) andserve_warmup_routes(--root).The property is checked exactly as often as before, by one file — and the CMake comment above the rows now says which two issues each half answers, so the next person adding a third check can see the two that exist.
Refs engine#2853, engine#2884, engine#2883, engine#2887.