feat: Remote rendering 3.1c - register per-part triggers, serialize VTK access with lock, trigger payload validation - #52
Merged
LKasianAnsys merged 21 commits intoSep 2, 2026
Conversation
LKasianAnsys
force-pushed
the
feat/3.1c-triggers-lock-and-payload-validation
branch
from
August 28, 2026 20:08
d81f1c7 to
a6b0351
Compare
LKasianAnsys
changed the base branch from
main
to
feat/3.1b-per-part-apply-logic
August 28, 2026 20:09
LKasianAnsys
force-pushed
the
feat/3.1c-triggers-lock-and-payload-validation
branch
from
August 31, 2026 14:33
a6b0351 to
d857fc9
Compare
LKasianAnsys
force-pushed
the
feat/3.1b-per-part-apply-logic
branch
from
August 31, 2026 15:29
7b61414 to
0c50362
Compare
LKasianAnsys
force-pushed
the
feat/3.1c-triggers-lock-and-payload-validation
branch
from
August 31, 2026 15:29
59847e2 to
85b6630
Compare
…-lock-and-payload-validation
LKasianAnsys
marked this pull request as ready for review
August 31, 2026 17:23
margalva
previously approved these changes
Sep 2, 2026
margalva
approved these changes
Sep 2, 2026
LKasianAnsys
deleted the
feat/3.1c-triggers-lock-and-payload-validation
branch
September 2, 2026 20:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Addresses #18
Context
This is the 3rd of 5 PRs for user story 3.1 (#18) of the phased implementation plan (here) for adding remote rendering in VISOR.
Per-part visual state (visibility, opacity, diffuse color, color variable), is currently held client-side on
VisorPartStateand reaches the server only viagetAppStateAsyncwhen thesave_stateAPI is called. This story inverts that, makingVisorDatasetRegistrythe source of truth for per-part state by the end of 3.1.This PR is the third step: exposing the server-side apply methods as Trame triggers, plus a lock on the VTK operations from the scene coordinator layer. These triggers still have no callers in this PR. The client-initiated triggers are added in PR 4, and this is extended to save/load state in PR 5.
Notes
VisorSceneBase, taken by all ten public entry points there that touch VTK. This is the entrypoint into the VTK graph from the outside, so one lock there is comprehensive. It is scoped to this story: it serializes access only, and is not a general threading fix.ScenePartStateApiProtocol, declared in the app module so nothing imports a scene type. This is a type only, no runtime behaviour.Copilot Summary
This pull request introduces a new set of per-part rendering triggers for VISOR (3.1c), ensures robust payload validation for these triggers, and adds a thread-safe locking mechanism to serialize all VTK access in the scene. These changes increase the reliability and maintainability of the rendering workflow, especially in multi-threaded environments. The most important changes are grouped below:
Per-part trigger registration and API:
ScenePartStateApiand corresponding payload models for each per-part trigger inlocal_app.py, enabling type-checked, modular, and validated per-part state updates from the frontend [1] [2].LocalApp(set_part_visibility,set_part_opacity,set_part_diffuse_color,set_part_selected,set_part_color_variable,clear_part_color_variable) and delegated their handling to the injected scene API, with robust payload validation using Pydantic models [1] [2].LocalAppduring initialization, ensuring the triggers are routed correctly [1] [2] [3].Thread safety and VTK access serialization:
_vtk_lock) in the scene base class to serialize all server-side VTK mutations and rendering operations, preventing race conditions between the trame event loop and main thread [1] [2].apply_state,clear,populate_scene,finalize_scene,update_widgets,add_dataset,remove_dataset,update_variables_for_dataset,render,reset_camera) with_vtk_lockto ensure thread-safe access [1] [2] [3] [4] [5] [6] [7] [8].