Repository navigation
Repair the two studio test suites #9410 left behind - #9437
Conversation
#9410 added the llama-server tuning group. Two test-side consequences were not carried with it, and both are red on main. chat-adapter.ts gained imports of serverTuningLoadPayload, committedServerTuningState and clearedServerTuningState. test_chat_autoload_failure_gate.py slices a region of that file and runs it against a PREAMBLE of stubs, so the three names were undefined and 70 scenarios failed. The stubs mirror server-tuning-fields.ts rather than returning nothing, because serverTuningLoadPayload spreads into the /load payload these scenarios assert on. apply-inference-status-to-store.ts now seeds six values through resolveBatchSizeSeed rather than two, so a hardcoded count of two in test_model_picker_contracts.py failed. The count now tracks the number of call sites and additionally pins that every one of them is told modelChanged from the same local, which is the anti-drift property the assertion existed for and is stronger than the number it replaces.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: acc03a2779
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # which is the property actually under test. | ||
| seed_calls = len(re.findall(r"resolveBatchSizeSeed(?:<[^>]*>)?\(\{", status)) | ||
| assert seed_calls >= 2, "the batch pair alone should be two seeds" | ||
| assert re.findall(r"modelChanged: (\w+)", status) == ["slotsModelChanged"] * seed_calls |
There was a problem hiding this comment.
Scope modelChanged matches to seed calls
The right-hand regex scans the entire apply-inference-status-to-store.ts, while seed_calls counts only resolveBatchSizeSeed calls. If this file later adds an unrelated object containing modelChanged: someOtherValue, this contract fails even when every seed is still wired correctly; conversely, an unrelated modelChanged: slotsModelChanged can mask a seed that omitted the property. Extract and validate the argument block for each matching seed call instead of comparing it with all modelChanged properties in the file.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and the masking direction is the serious one: an unrelated modelChanged: slotsModelChanged could stand in for a seed that omitted the property, so the assertion could pass while the invariant it exists for was broken. Fixed in d32e4a1: each resolveBatchSizeSeed call's own argument block is extracted with parens balanced and checked individually. Verified by mutation, dropping modelChanged from one real seed call is now caught, and an unrelated modelChanged elsewhere no longer affects the result. One thing the per-call scan surfaced: this file discusses resolveBatchSizeSeed (modelChanged) in a comment, which a raw scan counts as a seventh call site, so comments are stripped first.
A whole-file scan for modelChanged had it both ways: an unrelated one elsewhere in the file would fail the contract with every seed wired correctly, and an unrelated one could equally stand in for a seed that omitted the property, so the assertion could pass while the invariant was broken. Each resolveBatchSizeSeed call's own argument block is now checked, with parens balanced so a nested call survives. Comments are stripped first because this file discusses resolveBatchSizeSeed (modelChanged) in prose, which a raw scan counts as a seventh call site.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d32e4a1a3d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # in prose, and a scan that counted that sentence as a call site would fail on a | ||
| # wording change. | ||
| seed_args = _call_arguments(_code_only(src), "resolveBatchSizeSeed") | ||
| assert len(seed_args) >= 2, "the batch pair alone should be two seeds" |
There was a problem hiding this comment.
Require every status seed call
The lower bound only proves that two resolveBatchSizeSeed calls remain. If any of the four server-tuning seed calls and its corresponding state spreads are removed, the code still compiles and this contract still passes because the two batch calls satisfy len(seed_args) >= 2; model changes would then retain stale tuning controls or baselines. Assert the required incoming fields/call sites explicitly so the new per-call property check also detects a missing seed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not taking this one. The lower bound does not weaken anything: the assertion it replaced was count == 2, which also passed if the four tuning seeds were deleted, so a removal guard is coverage this test never had rather than something this PR gave up. This PR exists to unbreak main, and adding a required-call-site inventory here would mean every future knob has to edit this test to stay green, which is the maintenance cost without the drift protection the per-call check already provides. The gap you describe is real, but it belongs where the consequence is observable, a behavioural test on applyActiveModelStatusToStore asserting a model change reseeds the tuning controls, not an inventory in a test whose stated remit is that the wiring which exists is consistent. server-tuning-settings.test.ts already covers the payload, commit and clamp behaviour of the four.
|
These two are the whole of
Merging both clears |
Repo tests (CPU)is red onmainand has been failing every PR that runs it. On a clean checkout ofmain(e91f9720b):All 71 come from #9410 (
5786a0ead, "Studio: add Mmap/Mlock, draft KV cache dtype, Checkpoints and Cache RAM to Run settings"). The product code from that PR is fine and is not touched here. What did not travel with it was the test-side consequences of two of its changes.1. The sliced-harness stubs (70 failures)
tests/studio/test_chat_autoload_failure_gate.pydoes not importchat-adapter.ts. It slices a region out of it, prepends aPREAMBLEof stubs, writesharness.tsinto a temp directory and runs it under node. The temp directory has no module resolution, so every name the sliced region uses has to exist inPREAMBLE.#9410 added three imports to
chat-adapter.ts:The file's own guard caught this and said exactly what to do:
So the guard worked. Nobody added the stubs.
They are added here mirroring
server-tuning-fields.tsrather than as neutral no-ops.serverTuningLoadPayloadspreads into the/loadpayload that these scenarios assert on, so a stub that always returned{}would keep passing if the real one started sending a field. The three functions are pure and import nothing, so copying them is cheap, and the name-level guard above is what catches drift.2. A hardcoded count that the same PR outgrew (1 failure)
test_hydration_clears_the_batch_baselines_for_a_batchless_modelasserted:apply-inference-status-to-store.tsused to seed two values throughresolveBatchSizeSeed, the batch pair. #9410 deliberately routed the four tuning knobs through the same seed, with the reasoning in the source:Six call sites, so the assertion failed
6 == 2. The code is right and the number was stale.The assertion the test wanted, per its own comment, is that the seeds cannot drift apart ("The batch pair is told the same thing, from the same local, so the two cannot drift"). That is now what it checks:
This is strictly stronger than the count it replaces. The old form only counted occurrences; this pins that every seed call site is told
modelChangedfrom the same local, so one of them being wired to a different value fails even though the totals still match. It also stops being wrong the next time the group grows.Result
Same command,
tests/studio, four workers:mainate91f9720bOnly the two test files change. No product code is touched.