ui.export: the export page crashes when no graph exists #9

Open
opened 2026-10-06 13:45:53 +00:00 by ffrauenberger · 1 comment
Owner

Severity: medium (Export before a genetic run shows an exception page)

Where

  • app/ui/export_ui/export_controller.py:96-101, :212-243
  • app/ui/genetic_miner_ui/genetic_miner_controller.py:196-204
  • app/io_operations/export_operations.py:59-60

Problem

ExportController.process_session_state detects a missing graph but does not stop execution:

if self.mining_model.graph is None:
    st.session_state.error = "Graph not generated"
    navigate_to("Algorithm")          # only sets session_state.page – no st.rerun()

Execution continues with self.graph = None, and export_graph() calls ExportOperations.export_graph, which raises InvalidTypeException. That exception is not caught in ExportController.run.

The Genetic Miner does not mine automatically, so its graph is None until the user clicks Run. The Export button is enabled regardless (view.display_export_button(disabled=False) runs unconditionally).

Steps to reproduce

  1. Open the application
  2. Import a CSV log and select the Genetic Miner
  3. Without running the miner, click Export

Expected behavior

The Export button is disabled while no graph exists, or the user is redirected back with the message "Graph not generated".

Actual behavior

A Streamlit exception page (InvalidTypeException).

Fix

  • Call st.rerun() (or return) after navigate_to in process_session_state.
  • Disable the Export button while get_graph() is None.

from issues/BUG-009-export-page-crashes-when-no-graph-exists.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** medium (Export before a genetic run shows an exception page) ## Where - `app/ui/export_ui/export_controller.py:96-101`, `:212-243` - `app/ui/genetic_miner_ui/genetic_miner_controller.py:196-204` - `app/io_operations/export_operations.py:59-60` ## Problem `ExportController.process_session_state` detects a missing graph but does not stop execution: ```python if self.mining_model.graph is None: st.session_state.error = "Graph not generated" navigate_to("Algorithm") # only sets session_state.page – no st.rerun() ``` Execution continues with `self.graph = None`, and `export_graph()` calls `ExportOperations.export_graph`, which raises `InvalidTypeException`. That exception is not caught in `ExportController.run`. The Genetic Miner does not mine automatically, so its graph is `None` until the user clicks *Run*. The Export button is enabled regardless (`view.display_export_button(disabled=False)` runs unconditionally). ### Steps to reproduce 1. Open the application 2. Import a CSV log and select the Genetic Miner 3. Without running the miner, click *Export* ### Expected behavior The Export button is disabled while no graph exists, or the user is redirected back with the message "Graph not generated". ### Actual behavior A Streamlit exception page (`InvalidTypeException`). ## Fix - Call `st.rerun()` (or `return`) after `navigate_to` in `process_session_state`. - Disable the Export button while `get_graph()` is `None`. --- from `issues/BUG-009-export-page-crashes-when-no-graph-exists.md` (code analysis of commit 6bcc646, 2026-10-03)
Author
Owner

Reviewed by Codex (GPT-6) against origin/main 6bcc646eb464.

Review: partially correct.

The missing-graph crash is supported. The proposed return alternative is insufficient if added only inside process_session_state(): BaseController.start() calls that method and then unconditionally selects/renders the view and calls run() (lines 124–130). It can therefore continue exporting despite the return, possibly also with controller attributes left unset. Use st.rerun() after the redirect, st.stop(), or an explicit status that start() honors. Disabling Export while the graph is absent is also appropriate.

Code references: app/ui/export_ui/export_controller.py:96, app/ui/base_ui/base_controller.py:120.

Reviewed by **Codex (GPT-6)** against origin/main [`6bcc646eb464`](https://code.swisdata.eu/ffrauenberger/ProcessIntel/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4). **Review: partially correct.** The missing-graph crash is supported. The proposed `return` alternative is insufficient if added only inside `process_session_state()`: `BaseController.start()` calls that method and then unconditionally selects/renders the view and calls `run()` (lines 124–130). It can therefore continue exporting despite the return, possibly also with controller attributes left unset. Use `st.rerun()` after the redirect, `st.stop()`, or an explicit status that `start()` honors. Disabling Export while the graph is absent is also appropriate. Code references: [app/ui/export_ui/export_controller.py:96](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/ui/export_ui/export_controller.py#L96), [app/ui/base_ui/base_controller.py:120](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/ui/base_ui/base_controller.py#L120).
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#9
No description provided.