ui.algorithm_explanation: the page redirects without stopping execution #21

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

Severity: low (the rest of the page still runs after the redirect)

Where

  • app/ui/algorithm_explanation_ui/algorithm_explanation_controller.py:49-65, :93-98

Problem

  • If algorithm is missing, the controller calls to_home(), which clears the session, and then continues to st.session_state.algorithm, which raises AttributeError.
  • If the algorithm has no docs, it calls navigate_to("Algorithm") and continues to docs_path_mappings[...], which raises KeyError.
  • The FileNotFoundError branch also navigates without st.rerun(), so the page renders without content until the next interaction.
  • process_session_state is overridden without calling super().process_session_state(), so pending error/info messages are not shown on this page and appear later on another page.

Steps to reproduce

  1. Open the Algorithm Explanation page for an algorithm that has no documentation file (or with no algorithm in session state)

Expected behavior

The user is redirected with a message.

Actual behavior

A Streamlit exception page (AttributeError / KeyError), or an empty page until the next interaction.

Related: #52.

Fix

Call st.rerun() (or return) after each redirect, and call super().process_session_state().


from issues/BUG-021-algorithm-explanation-redirects-without-rerun.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** low (the rest of the page still runs after the redirect) ## Where - `app/ui/algorithm_explanation_ui/algorithm_explanation_controller.py:49-65`, `:93-98` ## Problem - If `algorithm` is missing, the controller calls `to_home()`, which clears the session, and then continues to `st.session_state.algorithm`, which raises `AttributeError`. - If the algorithm has no docs, it calls `navigate_to("Algorithm")` and continues to `docs_path_mappings[...]`, which raises `KeyError`. - The `FileNotFoundError` branch also navigates without `st.rerun()`, so the page renders without content until the next interaction. - `process_session_state` is overridden without calling `super().process_session_state()`, so pending error/info messages are not shown on this page and appear later on another page. ### Steps to reproduce 1. Open the Algorithm Explanation page for an algorithm that has no documentation file (or with no algorithm in session state) ### Expected behavior The user is redirected with a message. ### Actual behavior A Streamlit exception page (`AttributeError` / `KeyError`), or an empty page until the next interaction. Related: #52. ## Fix Call `st.rerun()` (or `return`) after each redirect, and call `super().process_session_state()`. --- from `issues/BUG-021-algorithm-explanation-redirects-without-rerun.md` (code analysis of commit 6bcc646, 2026-10-03)
Author
Owner

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

Review: partially correct.

The redirect fallthrough findings are supported, but return inside process_session_state() is not equivalent to st.rerun(). BaseController.start() continues with view selection and run() after that method returns; the explanation controller may then read an unset file_path and fail again. Use a rerun/stop or an explicit abort status handled by the outer controller. A return can end run() itself in the FileNotFoundError branch, but navigation still needs the appropriate rerun. Calling the base message-processing method remains a valid correction.

Code references: app/ui/algorithm_explanation_ui/algorithm_explanation_controller.py:49, app/ui/base_ui/base_controller.py:124.

Reviewed by **Codex (GPT-6)** against origin/main [`6bcc646eb464`](https://code.swisdata.eu/ffrauenberger/ProcessIntel/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4). **Review: partially correct.** The redirect fallthrough findings are supported, but `return` inside `process_session_state()` is not equivalent to `st.rerun()`. `BaseController.start()` continues with view selection and `run()` after that method returns; the explanation controller may then read an unset `file_path` and fail again. Use a rerun/stop or an explicit abort status handled by the outer controller. A `return` can end `run()` itself in the FileNotFoundError branch, but navigation still needs the appropriate rerun. Calling the base message-processing method remains a valid correction. Code references: [app/ui/algorithm_explanation_ui/algorithm_explanation_controller.py:49](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/ui/algorithm_explanation_ui/algorithm_explanation_controller.py#L49), [app/ui/base_ui/base_controller.py:124](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/ui/base_ui/base_controller.py#L124).
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#21
No description provided.