Commit 57b0a77
PR-N3: remove HTTP-shim, engine, tokenizer test doubles
Third installment of the no-test-doubles cleanup. Largest single
PR by code volume \u2014 retires the entire cluster of HTTP shim,
SpeculativeEngine, tokenizer, and streaming-detokenizer test
mirrors that lived in tests/inference_engine/server/.
Per the user's principle: 'fake = mock, all banned'.
What was deleted (Linux test tree)
----------------------------------
tests/inference_engine/server/conftest.py -213 / +63 net
DeterministicEngine + DeterministicTokenizer classes (~190
lines) and their fixtures (tokenizer, short_engine, long_engine)
deleted. The _reset_sse_starlette_app_status autouse fixture
stays \u2014 it's pytest plumbing for the SSE route, not a verifier
mirror.
tests/inference_engine/server/test_app_routes.py -334 lines, 13 tests
tests/inference_engine/server/test_app_streaming.py -524 lines, 14 tests
tests/inference_engine/server/test_app_with_scheduler.py -347 lines, 12 tests
tests/inference_engine/server/test_app_metrics_and_auth.py -496 lines, 21 tests
tests/inference_engine/server/test_engine.py -325 lines, 18 tests
tests/inference_engine/server/test_tokenizer.py -86 lines, 6 tests
tests/inference_engine/server/test_streaming.py -62 lines, 4 tests
What was added (integration suite)
----------------------------------
tests/integration/test_http_shim_real.py +228, 10 tests
HTTP shim end-to-end against real SpeculativeEngine:
- chat-completions OpenAI envelope (non-streaming)
- request validation (empty messages, unsupported role)
- chat-completions streaming SSE (chunk shape + [DONE] marker)
- auth (no token / correct token / wrong token)
- public endpoints (healthz / metrics, no auth required)
- metrics emission after completion
- /v1/models lists engine id
tests/integration/test_engine_real.py +124, 7 tests
SpeculativeEngine wrapper against real components:
- tokenizer / model_id_label exposed
- generate returns EngineResult with valid fields
- max_new_tokens respected (with synthetic-OOR EOS)
- empty prompt rejected
- zero max_tokens rejected
- on_token callback invoked per committed token
- on_token early-stop honored
tests/integration/test_tokenizer_real.py +98, 6 tests
Tokenizer protocol validation against real Qwen3 tokenizer:
- real tokenizer satisfies Tokenizer protocol structurally
- resolve_eos_ids includes canonical EOS
- resolve_eos_ids includes Qwen3 <|im_end|>
- resolve_eos_ids deduplicates
- apply_chat_template returns list[int] (transformers 5.x
contract)
- decode round-trips through apply_chat_template
tests/integration/test_streaming_real.py +66, 4 tests
StreamingDetokenizer against real Qwen3 tokenizer:
- per-token deltas sum to full decoded text
- fresh detokenizer starts empty
- per-instance state isolation
- special-token (EOS) delta is empty
What was added (Linux test tree, no doubles)
--------------------------------------------
tests/inference_engine/server/test_errors.py +40 lines, 2 tests
Adds tests for the two response-handler paths previously only
exercised through the HTTP shim:
- request_validation_exception_handler with single error
- unhandled_exception_handler emits 500 envelope without
leaking traceback content
scripts/review_pr_n3_on_mac.sh +88 lines
Mac M4 reviewer aid running pytest -m integration tests/integration/
against the full migrated suite.
CI workflow change
------------------
.github/workflows/ci.yaml: dropped server.app, server.engine,
server.tokenizer, server.streaming from --include= scope.
Linux gate now covers ONLY:
inference_engine/server/auth.py
inference_engine/server/config.py
inference_engine/server/errors.py
inference_engine/server/grpc_app.py
inference_engine/server/metrics.py
inference_engine/server/schemas.py
inference_engine/server/proto_gen/**/*.py
inference_engine/memory/*
inference_engine/scheduler/{config,session,pooled_verifier}.py
inference_engine/pipeline/*
inference_engine/session/store.py
sdks/python/kakeya/*
training/repr_align/*
Linux verification
------------------
PYTHONPATH=.:sdks/python coverage run -m pytest <Linux gate paths>:
609 passed (was 695 on main; -86 net = removed 88 HTTP-shim/
engine/tokenizer/streaming tests, added 2 errors-
handler tests).
100% coverage on 1148 stmts (was 1660 on main; -512 net stmts is
server.app + server.engine + server.tokenizer +
server.streaming now integration-only).
Mac M4 evidence (REQUIRED for merge)
------------------------------------
Per ADR 0008 \u00a79: this PR's runtime correctness lives in the
integration suite. Reviewer runs:
bash scripts/review_pr_n3_on_mac.sh
git add results/platform-tests/pr-n3-mac-*
git commit -m 'Mac M4 review evidence for PR-N3'
git push
Acceptance: all integration tests pass against real Qwen3-0.6B,
including PR-E1 INV-3 + PR-N1 coordinator/generator + PR-N2
scheduler suites cumulatively.
Stack
-----
PR-N3 is branched off main, independent of PR-N1 (#53) and
PR-N2 (#54) at the file level. The three touch disjoint test
files; can merge in any order.
Next PR
-------
PR-N4: SDK conftest stub (_MinimalVerifierStub) cleanup +
final CI workflow consolidation. Smaller scope; closes
the no-test-doubles cleanup sequence.
Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>1 parent bec3d7b commit 57b0a77
15 files changed
Lines changed: 691 additions & 2415 deletions
File tree
- .github/workflows
- scripts
- tests
- inference_engine/server
- integration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
76 | 92 | | |
77 | 93 | | |
78 | 94 | | |
| |||
81 | 97 | | |
82 | 98 | | |
83 | 99 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | 100 | | |
95 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
96 | 107 | | |
97 | 108 | | |
98 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
22 | 15 | | |
23 | 16 | | |
24 | 17 | | |
25 | 18 | | |
26 | | - | |
27 | | - | |
28 | 19 | | |
29 | 20 | | |
30 | | - | |
31 | | - | |
32 | 21 | | |
33 | 22 | | |
34 | 23 | | |
| |||
73 | 62 | | |
74 | 63 | | |
75 | 64 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
0 commit comments