From b05051ed55fc6380c089edd7130fbb52cf5a094a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 8 Nov 2026 14:45:15 +0000 Subject: [PATCH] Fix Windows CI: keep the surface dropdown's options without PySCF The VA.2/VW.7 resolution in #164 cut the Isosurface "Surface" dropdown down to "orbital" when PySCF is missing. The Windows CI job runs without PySCF, and three TestAppSurfaceDispatch tests (which mock cube generation) set it to density / ESP / spin -> TraitError "Invalid selection", failing main's CI since the #164 merge (runs 465-468; every Linux job, lint and mypy were green). Pin the surface kind by hiding the dropdown at "orbital" instead of removing options, so users still cannot pick density/ESP without PySCF and the widget has one shape everywhere. Reproduced locally by patching quantui.engines.is_pyscf_available to False: 3 failed before, 62 passed after (test_surfaces, test_viewer_audit, test_app_viewer, test_frontier_cubes); with PySCF 84 passed. Contributions: - Claude (Opus 5.5): code edits, review, and conceptual discussion - Jonathan Schultz: overall vision, planning, review, and orchestration Co-authored-by: Jonathan Schultz Co-authored-by: Claude Opus 5.5 --- quantui/app_builders.py | 7 +++++-- tests/test_viewer_audit.py | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/quantui/app_builders.py b/quantui/app_builders.py index 6f436b2d..0b8dd639 100644 --- a/quantui/app_builders.py +++ b/quantui/app_builders.py @@ -3196,8 +3196,11 @@ def _plot_export_row(prefix: str) -> widgets.HBox: # a result can be drawn (VW.7); density, spin, ESP and the gallery # could only fail, so they are removed and the panel says so (viewer # audit VA.2). The orbital controls stay: show_orbital_diagram only - # reveals them when the result has saved cubes. - app._iso_surface_dd.options = [("Molecular orbital", "orbital")] + # reveals them when the result has saved cubes. The surface kind is + # pinned by hiding its dropdown (value stays "orbital"); its options + # are left intact so the dispatch code and its tests see one widget + # shape with or without PySCF. + app._iso_surface_dd.value = "orbital" app._iso_surface_dd.layout.display = "none" iso_body.children = ( widgets.HTML( diff --git a/tests/test_viewer_audit.py b/tests/test_viewer_audit.py index d588d630..a2a3166b 100644 --- a/tests/test_viewer_audit.py +++ b/tests/test_viewer_audit.py @@ -198,7 +198,9 @@ def _walk(w): assert any("no PySCF" in str(getattr(w, "value", "")) for w in widgets) assert app._iso_generate_btn in widgets # VW.7 path stays reachable assert app._orb_gallery_btn not in widgets - assert [v for _, v in app._iso_surface_dd.options] == ["orbital"] + # Only orbitals can be drawn: the surface-kind dropdown is hidden at "orbital". + assert app._iso_surface_dd.layout.display == "none" + assert app._iso_surface_dd.value == "orbital" def test_orbital_controls_shown_without_pyscf_only_with_saved_cubes(