Private
Public Access
fix(post_de_cruft_iter4): fix 3 new failures revealed by full batched run
1. tier-1-unit-core::test_app_controller_warmup_done_ts_none_until_completed
- Race condition: warmup_done_ts was set before the test could read it
(warmup runs in a background thread that can complete in milliseconds).
- Fix: use defer_warmup=True + call start_warmup() explicitly so we can
observe the initial state before warmup begins.
2. tier-1-unit-core::test_fetch_models_aggregates_per_provider_errors
- Race condition: _fetch_models submits do_fetch to the IO pool; the
test asserted _model_fetch_errors synchronously before the worker ran.
- Fix: call wait_io_pool_idle() before asserting the side effect.
- Test passes in isolation but fails when run as part of the full file
(IO pool is hot from prior tests).
3. tier-3-live_gui::test_context_sim_live
- Production bug: _do_generate mutated the frozen ProjectContext dataclass
returned by flat_config (flat['files'] = ...). flat_config was converted
from dict[str, Any] to ProjectContext dataclass by cruft_elimination_20260627
Phase 2 but the consumer code wasn't updated.
- Fix: call flat.to_dict() to get a mutable dict before mutation.
- Same bug existed in /api/project endpoint (returns the ProjectContext
directly; json.dumps fails silently on dataclass), now also calls
to_dict() at the wire boundary.
This commit is contained in:
@@ -460,6 +460,9 @@ def test_fetch_models_aggregates_per_provider_errors():
|
||||
# do_fetch is the inner function; we need to access it. Easiest: call _fetch_models
|
||||
# and inspect the resulting side effect on all_available_models.
|
||||
ctrl._fetch_models("anthropic")
|
||||
# _fetch_models submits do_fetch to the IO pool; wait for it to complete
|
||||
# before asserting on the side effect.
|
||||
assert ctrl.wait_io_pool_idle(timeout=5.0), "do_fetch did not complete"
|
||||
# Per-provider errors should be accumulated in self._model_fetch_errors
|
||||
assert "gemini" in ctrl._model_fetch_errors
|
||||
assert isinstance(ctrl._model_fetch_errors["gemini"], ErrorInfo)
|
||||
|
||||
Reference in New Issue
Block a user