Skip to content

Fix: block pipeline node switch during active edit session + Perf: edit session remap cache (B3, B4)#35

Open
pcolt wants to merge 6 commits into
mainfrom
perf/improve-edit-session
Open

Fix: block pipeline node switch during active edit session + Perf: edit session remap cache (B3, B4)#35
pcolt wants to merge 6 commits into
mainfrom
perf/improve-edit-session

Conversation

@pcolt

@pcolt pcolt commented May 22, 2026

Copy link
Copy Markdown
Collaborator

Note: PR #32 is merged. This PR now targets main directly. Merge this before PR #37.

Overview

Closes #33. Completes B3 and B4 from Step 1 of #34 (B5 deferred).

Pipeline lock: while an edit session is active, on_active_pipeline_item_change now blocks node switches, emits a warning, and resets state.active_pipeline_item so the pipeline panel snaps back visually. No UI-level intercept is possible — VListItemGroup has no pre-change hook — so the bounce (write → callback → reset) is the right approach and is invisible in practice.

Edit session remap cache (B3, B4): previously every pick during an edit session triggered a servermanager.Fetch() (B3, O(mesh) transfer) and rebuilt coordinate-based cell/point-ID maps (B4, O(n_cells) Python loop). These structures are now built once at session begin by set_edit_target_dataset() and reused per pick as O(1) lookups. source_dataset is passed in from export_active_dataset_for_editing, which already has it, so no extra Fetch is needed at session start either. The four cache fields are cleared together at session end by clear_edit_target_dataset().

Summary

  • state_handlers.py: guard in on_active_pipeline_item_change blocks node switches during edit sessions; emits warning and resets state.active_pipeline_item
  • handler_registration.py: passes edit_session to register_state_handlers
  • paraview_backend.py: set_edit_target_dataset() builds four remap caches (_edit_source_dataset, _edit_source_point_indexes, _edit_target_cell_map, _edit_point_id_map) at session begin; remap methods use caches when available; type hints added to edit-session fields and methods; source/display property docstrings improved
  • paraview_controllers.py: passes source_dataset from export_active_dataset_for_editing to set_edit_target_dataset to skip a redundant Fetch at session begin
  • edit_session.py: from __future__ import annotations, type hints on all instance variables and method signatures
  • docs/logic_flows.md: §5b merged into a single table with Lifetime column; §6c now shows the remap step in both native and fallback paths
  • CLAUDE.md: documents pipeline lock behavior and remap cache

Test plan

  • pytest -q tests/test_state_handlers.py — 7 tests pass including test_pipeline_node_switch_blocked_during_edit_session
  • pytest -q tests/test_paraview_backend.py — includes 4 new remap cache tests (test_set_edit_target_dataset_builds_remap_caches, test_set_edit_target_dataset_clears_caches_on_clear, test_remap_cell_ids_uses_cached_source_without_fetch, test_remap_surface_keys_uses_cached_point_id_map)
  • All 170 unit tests pass
  • Manual: load a mesh, begin edit session, click a different pipeline node → warning notification appears, pipeline panel snaps back, no node switch occurs

pcolt added 3 commits May 22, 2026 09:53
Add bottleneck table (B1–B7) and three-step plan to TODO.md (issue #34).
Promote performance work to Priorità alta; reorder backend refactor to
start from self-contained modules (display, coloring, pipeline) rather
than selection, which has too many cross-cutting backend dependencies.

Update docs/logic_flows.md §5a: clarify that working_dataset is
independent for mutations but picks still go through the ParaView source
and are remapped back; fix misleading note at session-begin diagram.
Adds a guard in on_active_pipeline_item_change that ignores node-switch
events when edit_session.active is True, shows a warning notification,
and resets state.active_pipeline_item to snap the pipeline panel UI back
to the correct node.
@pcolt
pcolt requested a review from luca-heltai May 22, 2026 10:30
…p cache

Build four remap structures once at session begin (set_edit_target_dataset)
instead of on every pick: _edit_source_dataset (avoids re-Fetch),
_edit_source_point_indexes, _edit_target_cell_map, _edit_point_id_map.
Pass source_dataset from export_active_dataset_for_editing to avoid a
redundant Fetch at session start as well.

Also adds type hints to edit_session.py and edit-session methods in
paraview_backend.py, improves source/display property docstrings, merges
the §5b naming conventions into a single table with a Lifetime column,
fixes a missing remap step in the §6c diagram, and documents the pipeline
lock behavior in CLAUDE.md.
…ds (B5 investigation)

Both PassThroughPointIds and PassThroughCellIds on GeometryFilter produce
output-geometry indices through the proxy/Fetch round-trip in ParaView 6.1,
not source topology IDs. Update the docstring in _surface_keys_from_selected_dataset
and the §6c note in docs/logic_flows.md to reflect both ruled-out variants.

See PR #31 (PassThroughPointIds) and issue #34 (PassThroughCellIds).
@pcolt pcolt changed the title Fix: block pipeline node switch during active edit session Fix: block pipeline node switch during active edit session + Perf: edit session remap cache (B3, B4) May 26, 2026
@pcolt
pcolt changed the base branch from refactor/ui to main May 28, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit session silently decouples from active source when pipeline node is switched mid-session

1 participant