Commit 0f2493b
PR-N2: remove DeterministicEngine + DeterministicTokenizer from scheduler tests
ADR 0008 / no-test-doubles cleanup, second installment. PR-N2
retires the scheduler-side engine/tokenizer test doubles and
migrates their dispatch / admission-control / lifecycle tests to
tests/integration/ where they run against a real SpeculativeEngine
over Qwen3-0.6B.
Per the user's principle: 'fake = mock, all banned'. PR-N1 cleared
the verifier protocol mirrors; PR-N2 clears the
scheduler-conftest engine + tokenizer mirrors. PR-N3 will tackle
the HTTP shim's separate copies and engine subtypes; PR-N4 will
clean up the SDK conftest stub + final CI consolidation.
What was deleted
----------------
tests/inference_engine/scheduler/conftest.py
-197 / +62 lines net. DeterministicEngine and
DeterministicTokenizer classes (~120 lines) deleted. Their
fixtures (tokenizer, short_engine, long_engine, slow_engine,
reject_scheduler, queue_scheduler) deleted. The slab-pool
fixtures (slab_config, small_pool, single_pool) stay \u2014
they're verifier-independent and consumed by the new Linux-
side validation tests.
tests/inference_engine/scheduler/test_scheduler.py
-421 lines. 20 tests against DeterministicEngine. Migrated
selectively (see Added).
What was added
--------------
tests/integration/test_scheduler_real.py +422 lines, 12 tests
Scheduler integration tests against the real SpeculativeEngine:
- construction validation (pool size match)
- happy path: submit + iter_tokens \u2192 COMPLETED + slab
released
- admission control: REJECT (pool exhausted), QUEUE
(admit-after-completion)
- cancellation (mid-stream + idempotent-after-completion)
- engine error propagation (parametric error injector wraps
the real engine; same composition pattern PR-N1 used for
gRPC error-mapping tests)
- 3-way concurrency (all complete)
- shutdown (cancels active + rejects pending)
- active_count zeros after drain
The migrated tests use looser assertions than the originals
(real engine output varies); structural invariants are what
matters for scheduler correctness.
tests/integration/conftest.py +82 lines
- Existing pytest_collection_modifyitems hook (auto-marks
everything under tests/integration/ with @pytest.mark.integration).
- New session-scoped real_speculative_engine fixture
(Qwen3-0.6B + SparseLogitsProposer + SpeculativeDecoder +
SpeculativeEngine wrapper). Mirrors the long-standing fixture
under tests/system/conftest.py but uses 0.6B not 1.7B to
match the rest of the integration suite.
tests/inference_engine/scheduler/test_scheduler_validation.py
+102 lines, 5 tests
Pre-engine validation paths on Linux:
- construction validation (pool dim mismatch)
- submit() argument validation: empty prompt, zero
max_new_tokens, empty EOS
All run with engine=None; the validation rejects before the
scheduler enqueues a worker that would consult the engine.
scripts/review_pr_n2_on_mac.sh +88 lines
Mac M4 reviewer aid. Runs pytest -m integration
tests/integration/ and produces pr-n2-mac-integration-tests-
<unix>.json under results/platform-tests/.
What stays in place
-------------------
tests/inference_engine/scheduler/test_pooled_verifier.py
Still uses _FakeVerifier / _RaisingVerifier. PR-D2 retires
PooledVerifier entirely; cleanup before then is throwaway.
tests/inference_engine/server/conftest.py
Has its own copy of DeterministicEngine + DeterministicTokenizer
used by the HTTP shim tests. PR-N3 scope.
tests/inference_engine/server/test_app_*.py + test_engine.py +
test_tokenizer.py + their server-specific subtypes
(_RaisingEngine, _ProxyEngine, _AlwaysHoldingEngine,
_KVAwareSlowEngine, _BrokenTokenizer, _EmptyTemplateTokenizer,
_NoEosTokenizer)
PR-N3 scope.
CI workflow change
------------------
.github/workflows/ci.yaml: dropped --cov=inference_engine.scheduler
in favor of explicit per-module coverage:
- inference_engine.scheduler.config (Linux \u2713)
- inference_engine.scheduler.session (Linux \u2713)
- inference_engine.scheduler.pooled_verifier (Linux \u2713; via test_pooled_verifier.py exempt)
- inference_engine.scheduler.scheduler (integration only)
Also pre-emptively switched to the coverage-run pattern (was
`pytest --cov=` before; the GitHub-hosted runner's
torch+pytest-cov interaction surfaced as SIGSEGV during PR-N1).
Linux verification
------------------
PYTHONPATH=.:sdks/python coverage run -m pytest <Linux gate paths>:
680 passed (was 695 on main, -15 net = removed 20 scheduler
FakeEngine tests, added 5 verifier-independent
validation tests).
100% coverage on 1456 stmts (was 1660 on main; -204 net stmts
is inference_engine.scheduler.scheduler 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_n2_on_mac.sh
git add results/platform-tests/pr-n2-mac-*
git commit -m 'Mac M4 review evidence for PR-N2'
git push
Acceptance: all integration tests pass against real Qwen3-0.6B,
including PR-N1's coordinator/generator suites and the INV-3
byte-exact GA gate (PR-E1). The Mac evidence is load-bearing
because Linux CI cannot exercise the scheduler+real-engine path.
Stack
-----
PR-N2 is branched off main, independent of PR-N1 (#53). The two
touch disjoint test files; can merge in either order. Once both
land, PR-N3 cleans up the HTTP shim's doubles + subtypes.
Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>1 parent bec3d7b commit 0f2493b
7 files changed
Lines changed: 728 additions & 611 deletions
File tree
- .github/workflows
- scripts
- tests
- inference_engine/scheduler
- 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 | + | |
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
| |||
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
96 | 101 | | |
97 | 102 | | |
98 | 103 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
9 | 19 | | |
10 | 20 | | |
11 | 21 | | |
12 | 22 | | |
13 | | - | |
14 | | - | |
15 | 23 | | |
16 | 24 | | |
17 | 25 | | |
18 | 26 | | |
19 | 27 | | |
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 | | - | |
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 | 28 | | |
134 | 29 | | |
135 | 30 | | |
| |||
148 | 43 | | |
149 | 44 | | |
150 | 45 | | |
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 | | - | |
0 commit comments