mining.fuzzy: mining crashes or shows a stale graph when only one activity remains #6

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

Severity: critical (the first run crashes when the filters leave one activity)

Where

  • app/mining_algorithms/fuzzy_mining.py:106-114, :829-868

Problem

__calculate_first_rule removes node i when counter == len(events) - 1. With exactly one event both sides are 0, so the only node is always removed. nodes_after_first_rule is then empty, and generate_graph runs:

if not nodes_after_first_rule:
    self.graph.add_start_node()
    self.graph.add_end_node()
    self.graph.create_edge("Start", "End")
    return

This writes into the existing self.graph instead of creating a new graph:

  • On the first mining run, self.graph is None, which raises an uncaught AttributeError: 'NoneType' object has no attribute 'add_start_node'.
  • On later runs, self.graph is the previous graph, which already has a Start node. This raises DuplicateNodeException, which is caught as a GraphException: the user sees "Do not change the parameters while mining" and the old graph stays on screen (see #8).

Steps to reproduce

  1. Open the application
  2. Import a log with a single distinct activity
  3. Select the Fuzzy Miner

Alternatively: on any log, set Node Frequency (normalized) or SPM high enough that only one activity remains.

Expected behavior

Mining completes and shows an empty graph with only Start and End nodes.

Actual behavior

  • First run: Streamlit exception page (AttributeError).
  • Later runs: misleading warning "Do not change the parameters while mining", and the previous graph stays visible.

Possibly the same bug as upstream GitHub issue SWISDATA/processintel#27 (self.graph is None when no significant node is left on the first run).

Fix

Use self.graph = self.graph_converter.build_empty_graph(rankdir="TB") (as already done at line 65) before adding Start/End, and/or special-case len(events) == 1 in the first rule.


from issues/BUG-006-fuzzy-miner-crashes-when-one-activity-remains.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** critical (the first run crashes when the filters leave one activity) ## Where - `app/mining_algorithms/fuzzy_mining.py:106-114`, `:829-868` ## Problem `__calculate_first_rule` removes node *i* when `counter == len(events) - 1`. With exactly one event both sides are `0`, so the only node is always removed. `nodes_after_first_rule` is then empty, and `generate_graph` runs: ```python if not nodes_after_first_rule: self.graph.add_start_node() self.graph.add_end_node() self.graph.create_edge("Start", "End") return ``` This writes into the existing `self.graph` instead of creating a new graph: - On the first mining run, `self.graph` is `None`, which raises an uncaught `AttributeError: 'NoneType' object has no attribute 'add_start_node'`. - On later runs, `self.graph` is the previous graph, which already has a `Start` node. This raises `DuplicateNodeException`, which is caught as a `GraphException`: the user sees *"Do not change the parameters while mining"* and the old graph stays on screen (see #8). ### Steps to reproduce 1. Open the application 2. Import a log with a single distinct activity 3. Select the Fuzzy Miner Alternatively: on any log, set *Node Frequency (normalized)* or *SPM* high enough that only one activity remains. ### Expected behavior Mining completes and shows an empty graph with only Start and End nodes. ### Actual behavior - First run: Streamlit exception page (`AttributeError`). - Later runs: misleading warning *"Do not change the parameters while mining"*, and the previous graph stays visible. Possibly the same bug as upstream GitHub issue [SWISDATA/processintel#27](https://github.com/SWISDATA/processintel/issues/27) (`self.graph` is `None` when no significant node is left on the first run). ## Fix Use `self.graph = self.graph_converter.build_empty_graph(rankdir="TB")` (as already done at line 65) before adding Start/End, and/or special-case `len(events) == 1` in the first rule. --- from `issues/BUG-006-fuzzy-miner-crashes-when-one-activity-remains.md` (code analysis of commit 6bcc646, 2026-10-03)
Author
Owner

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

Review: partially correct.

Reproduced the first-run AttributeError with a single retained activity. The proposed fix needs one correction: DFGConverter.build_empty_graph() already adds Start, End and their connecting edge. Replace the entire lines 110–114 branch with assignment to that helper followed by return; inserting the helper assignment before the existing add_start_node()/add_end_node() calls would raise DuplicateNodeException. Whether a one-activity log should instead preserve its visible activity is a separate model-behavior decision.

Code references: app/mining_algorithms/fuzzy_mining.py:110, app/converters/dfg_converter.py:34.

Reviewed by **Codex (GPT-6)** against origin/main [`6bcc646eb464`](https://code.swisdata.eu/ffrauenberger/ProcessIntel/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4). **Review: partially correct.** Reproduced the first-run `AttributeError` with a single retained activity. The proposed fix needs one correction: `DFGConverter.build_empty_graph()` already adds Start, End and their connecting edge. Replace the entire lines 110–114 branch with assignment to that helper followed by `return`; inserting the helper assignment before the existing `add_start_node()`/`add_end_node()` calls would raise `DuplicateNodeException`. Whether a one-activity log should instead preserve its visible activity is a separate model-behavior decision. Code references: [app/mining_algorithms/fuzzy_mining.py:110](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/mining_algorithms/fuzzy_mining.py#L110), [app/converters/dfg_converter.py:34](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/converters/dfg_converter.py#L34).
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#6
No description provided.