refactor(gui): drop Review page + normalization gate
Home is now the only entry point: the "Run analysis" button on the upload section IS the review step (findings render inline via render_findings_panel). Tool pages no longer gate on a passed normalization — running the analyzer is sufficient context. Removed: - src/gui/pages/0_Review.py - src/gui/components/gate.py (re-export seam) - require_normalization_gate() in src/gui/components/_legacy.py - "review" section enum in tools_registry.py - Data Review entry in app.py navigation - require_normalization_gate() calls + imports in all nine tool pages - tests/gui/test_gate.py (whole file) - TestReviewWorkflow in tests/gui/test_workflows.py - 0_Review entry in tests/gui/test_smoke.py PAGE_SLUGS - stash_upload's normalization_result+normalization_for stashing - stash_upload_without_gate (was the gate's negative-path helper) 2017 tests pass (16 retired with the gate flow). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1264,45 +1264,6 @@ class _StashedUpload:
|
||||
return self._data
|
||||
|
||||
|
||||
def require_normalization_gate() -> None:
|
||||
"""Block the calling tool page until the upload has passed the gate.
|
||||
|
||||
Tool pages should call this immediately after their imports. When the
|
||||
current session upload has not been normalized — no
|
||||
``normalization_result``, the result is for a different upload, or the
|
||||
result didn't pass — the user is shown a banner and a button to jump
|
||||
to the Review page; the rest of the page is short-circuited via
|
||||
``st.stop()``.
|
||||
|
||||
Pages that genuinely don't need a clean dataframe (rare) can opt out
|
||||
by simply not calling this.
|
||||
"""
|
||||
import hashlib
|
||||
has_upload = st.session_state.get("home_uploaded_bytes") is not None
|
||||
if not has_upload:
|
||||
# No upload yet — let the page's own uploader handle it; the gate
|
||||
# will kick in once a file is present.
|
||||
return
|
||||
|
||||
upload_hash = hashlib.sha256(
|
||||
st.session_state["home_uploaded_bytes"]
|
||||
).hexdigest()
|
||||
result = st.session_state.get("normalization_result")
|
||||
matched = (
|
||||
result is not None
|
||||
and st.session_state.get("normalization_for") == upload_hash
|
||||
and getattr(result, "passed", False)
|
||||
)
|
||||
if matched:
|
||||
return
|
||||
|
||||
name = st.session_state.get("home_uploaded_name") or _t("gate.default_name")
|
||||
st.warning(_t("gate.warning", name=name))
|
||||
if st.button(_t("gate.open_review"), type="primary"):
|
||||
st.switch_page("pages/0_Review.py")
|
||||
st.stop()
|
||||
|
||||
|
||||
def pickup_or_upload(
|
||||
*,
|
||||
label: str,
|
||||
|
||||
Reference in New Issue
Block a user