Align use-case smokes with canonical workspace recipes

The 3.10.0 milestone was about making the advertised smoke pack trustworthy enough to act like a real release gate. The main drift was in the repro-plus-fix scenario: the recipe docs were SDK-first, but the smoke still shelled out to CLI patch apply and asserted a human summary string.\n\nSwitch the smoke runner to use the structured SDK patch flow directly, remove the harness-only CLI dependency, and tighten the fake smoke tests so they prove the same structured path the docs recommend. This keeps smoke failures tied to real user-facing regressions instead of human-output formatting drift.\n\nPromote make smoke-use-cases as the trustworthy guest-backed verification path in the top-level docs, bump the release surface to 3.10.0, and mark the roadmap milestone done.\n\nValidation:\n- uv lock\n- UV_CACHE_DIR=.uv-cache uv run pytest --no-cov tests/test_workspace_use_case_smokes.py\n- UV_CACHE_DIR=.uv-cache make check\n- UV_CACHE_DIR=.uv-cache make dist-check\n- USE_CASE_ENVIRONMENT=debian:12 UV_CACHE_DIR=.uv-cache make smoke-use-cases
This commit is contained in:
Thales Maciel 2026-03-13 13:30:52 -03:00
parent cc5f566bcc
commit 79a7d71d3b
12 changed files with 59 additions and 74 deletions

View file

@ -54,6 +54,7 @@ class _FakePyro:
self._workspace_counter = 0
self._shell_counter = 0
self._clock = 0.0
self.patch_apply_count = 0
def _tick(self) -> float:
self._clock += 1.0
@ -336,6 +337,7 @@ class _FakePyro:
original = target.read_text(encoding="utf-8")
updated = original.replace("broken\n", "fixed\n")
target.write_text(updated, encoding="utf-8")
self.patch_apply_count += 1
workspace.last_activity_at = self._tick()
return {"workspace_id": workspace_id, "changed": updated != original, "patch": patch}
@ -452,6 +454,8 @@ def test_use_case_docs_and_targets_stay_aligned() -> None:
repo_root = _repo_root()
index_text = (repo_root / "docs" / "use-cases" / "README.md").read_text(encoding="utf-8")
makefile_text = (repo_root / "Makefile").read_text(encoding="utf-8")
assert "trustworthy" in index_text
assert "guest-backed verification path" in index_text
for recipe in WORKSPACE_USE_CASE_RECIPES:
assert (repo_root / recipe.doc_path).is_file(), recipe.doc_path
recipe_text = (repo_root / recipe.doc_path).read_text(encoding="utf-8")
@ -478,22 +482,11 @@ def test_run_all_use_case_scenarios_with_fake_pyro(
fake_pyro = _FakePyro(tmp_path / "fake-pyro")
monkeypatch.setattr(smoke_module, "Pyro", lambda: fake_pyro)
monkeypatch.setattr(time_module, "sleep", lambda _seconds: None)
monkeypatch.setattr(
smoke_module,
"_run_pyro_cli",
lambda *args, cwd: (
fake_pyro.write_workspace_file(
args[3],
"message.txt",
text="fixed\n",
),
f"[workspace-patch] workspace_id={args[3]} total=1\n",
)[1],
)
smoke_module.run_workspace_use_case_scenario("all")
assert fake_pyro._workspaces == {}
assert fake_pyro.patch_apply_count == 1
def test_run_workspace_use_case_scenario_rejects_unknown() -> None:
@ -505,18 +498,6 @@ def test_main_runs_selected_scenario(monkeypatch: pytest.MonkeyPatch, tmp_path:
fake_pyro = _FakePyro(tmp_path / "fake-pyro-main")
monkeypatch.setattr(smoke_module, "Pyro", lambda: fake_pyro)
monkeypatch.setattr(time_module, "sleep", lambda _seconds: None)
monkeypatch.setattr(
smoke_module,
"_run_pyro_cli",
lambda *args, cwd: (
fake_pyro.write_workspace_file(
args[3],
"message.txt",
text="fixed\n",
),
f"[workspace-patch] workspace_id={args[3]} total=1\n",
)[1],
)
monkeypatch.setattr(
"sys.argv",
[
@ -531,3 +512,17 @@ def test_main_runs_selected_scenario(monkeypatch: pytest.MonkeyPatch, tmp_path:
smoke_module.main()
assert fake_pyro._workspaces == {}
assert fake_pyro.patch_apply_count == 1
def test_repro_fix_scenario_uses_structured_patch_flow(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
fake_pyro = _FakePyro(tmp_path / "fake-pyro-repro-fix")
monkeypatch.setattr(smoke_module, "Pyro", lambda: fake_pyro)
monkeypatch.setattr(time_module, "sleep", lambda _seconds: None)
smoke_module.run_workspace_use_case_scenario("repro-fix-loop")
assert fake_pyro.patch_apply_count == 1