Skip to content

Feature/history panel#339

Open
ThomasMalletCodra wants to merge 49 commits into
developfrom
feature/history-panel
Open

Feature/history panel#339
ThomasMalletCodra wants to merge 49 commits into
developfrom
feature/history-panel

Conversation

@ThomasMalletCodra

Copy link
Copy Markdown
Contributor

No description provided.

PierreRaybaut and others added 30 commits May 15, 2026 06:42
Assisted-by: Claude Opus 4.7
Migrated from history panel legacy branch
After eba8385, plot_results creates a "Results" group in the signal
panel, breaking panel-wide index lookups. Use group-local lookups so
the test is robust against extra groups.

(cherry picked from commit 5e08f9c)
(cherry picked from commit b2c4965)
Split the history feature into dedicated modules, refresh the GUI wiring and widgets, and update the related tests and translations.
# Conflicts:
#	datalab/locale/fr/LC_MESSAGES/datalab.po
#	doc/locale/fr/LC_MESSAGES/release_notes/release_1.03.po
#	doc/release_notes/release_1.03.md
Follow-up to a review noting that ruff/pylint had not been run on the
History panel refactor after it was split into submodules. Cross-module
access to underscore-prefixed members triggered W0212, plus a batch of
other lint warnings that were addressed without disabling any checks.
Creation actions (new signal/image) were recorded in the history but, unlike process actions, could not be edited, recomputed or reverted. Editing a creation left downstream steps inconsistent. This makes creations first-class history actions: their parameters can be re-edited, the result is recomputed in place (keeping the UUID and downstream references), and the chain cascades correctly.

* [NEW] : Allow editing creation (new_object) parameters via dialog and recompute in place, preserving the output UUID so downstream actions stay linked

* [NEW] : Resolve target panel for UI creation actions so they replay and cascade like compute actions

* [CHG] : add_ui_entry now returns the created HistoryAction, enabling creation output_uuids to be registered for downstream resolution

* [CHG] : Restore/undo without saving now covers creation actions for both single action and full session

* [FIX] : Snapshot creation parameters on edit for proper export/import and revert
…ompute

Edit-mode replay opened parameter dialogs per selected action, each editing its own downstream chain. Overlapping chains caused repeated prompts and inconsistent state. Recompute also stopped at the edited action instead of cascading to the full downstream.

* [FIX] : Process selected actions once via edit_mode_replay_actions, with deduplication, session-order sorting and a re-entrance guard, instead of calling edit_mode_replay per action

* [FIX] : Replay only the selected actions; on param change, recompute in place then cascade fully downstream from the most upstream edited action

* [CHG] : Cancel restores parameter snapshots for already-edited actions
…macro objects recorded in history

Editing parameters in the 'Creation parameters' tab only warned that the object was modified in-place, leaving downstream computations stale; users had to redo them manually. Objects added programmatically (plugins, macros, remote control) were also absent from the history, and non-native cross-panel computes created a spurious creation entry duplicating the recorded compute.

* [CHG] : Apply creation parameters now finds the originating creation action (via output_to_action with creation-method fallback), snapshots the params, refreshes the tree and cascades recompute to downstream actions, replacing the static 'modified in-place' warning

* [NEW] : Objects added through add_object (plugins, macros, remote) are recorded as creation entries in the history, including the very first one

* [FIX] : Route non-native cross-panel computes directly to the target panel.add_object instead of mainwindow.add_object, avoiding a duplicate creation entry alongside the compute entry
…actions (C2/C3)

Interactive fit dialogs now record a UI history action targeting the signal
processor's new recompute_fit method, which reconstructs the fitted curve
headlessly via fitdialog.evaluate_fit at replay time (no dialog reopened).

- action.py: resolve signalprocessor/imageprocessor targets; translate the
  recorded source_uuid through uuid_remap on session replay.
- historysession_ops.py: scope captured state and panel_str to processor targets.
- processor/signal.py: thread fit_type/fit_x0 through the fit path, record one
  action per source object, add deterministic recompute_fit.
- Covered types: polynomial, linear, gaussian, lorentzian, voigt, multigaussian,
  multilorentzian. Other interactive fits remain interactive-only (graceful).
- Add integration test test_history_interactive_fit_replay.
…ior (P3a)

Safety net before architecture slimming: assert bounded recompute call count
(no replay loop), output identity (UUID + __number) preservation, source
immutability, and document current metadata-clearing semantics on cascade.
…e (P3b)

Introduce ObjectProp.apply_recomputed_object_in_place as the single source of
truth for applying a recomputed object onto an existing one in place. Both the
interactive Apply callback (edit mode) and the History cascade
(recompute_1_to_1_in_place) now route through it, removing duplicated logic and
unifying metadata semantics on the pre-history behavior (preserve the object's
metadata instead of clearing it). Update the P3a characterization test to
reflect the intentional metadata-preservation change.
…or (P3c)

Add an explicit optional 'param' argument to ObjectProp.apply_processing_parameters.
When provided it takes precedence over the Processing-tab editor state, turning the
interactive Apply path into a reusable, editor-independent pre-history entry point
(structural keystone to reduce future per-method history-compatibility work).
Backward compatible: param=None keeps the current editor/stored-params fallback.
Add a characterization test proving editor-independence via a decoy editor value.
… batch (P3c-B2)

Pass each object's stored param explicitly to apply_processing_parameters instead
of selecting the object to populate the Processing-tab editor. Removes the
per-object set_current_object workaround (no more highlighting each object during
batch recompute), made possible by the editor decoupling from P3c.
Recording no longer always appends to the last session. Each action now routes
to the active recording session of its panel (signal/image), auto-creating a
dedicated session per panel on first use, so signal and image pipelines stay in
separate sessions. Selecting a session (or one of its actions) while recording
makes it the active session for its panel, letting the user resume recording
into any session. The history tree adds each action under the correct session
item (add_action_to_tree gains an optional session_index, backward compatible).
Add a feature test locking the routing and resume-into-selected behavior.
Make each panel's active recording session visually obvious in the History
tree: its top-level item is shown in bold with a palette-derived tint and a
tooltip naming the panel. The highlight is keyed by session number so it
survives any tree repopulate (delete/replay/HDF5 reload), and it follows
active-session changes (selection, auto-create, panel switch). On a Signal/
Image tab switch, the current panel's active session is scrolled into view
and the highlight is refreshed, without forcing tree selection (avoids the
selection/sync recursion). Add a feature test locking the highlight behavior.
Add the French translation for the new 'Active recording session ({panel}).'
string introduced by the per-panel history highlight (A2) and finalize three
related history-session strings that were still fuzzy (new-session prompts and
'New history session'). Catalog now 100% translated.
Signal and Image objects store their UUID in metadata["__uuid"] rather than as
an attribute, so get_uuid() was generating a throwaway uuid4 on every call,
making object identity unstable across the history panel. On top of this, a
compute action that produced no output (failure or complete no-op) was still
recorded as a successful action in the history tree.

* [FIX] : Materialize object identity deterministically in get_uuid() by
  reusing set_uuid() on first access, instead of generating a transient
  uuid4 each time
* [FIX] : Replace the faulty direct o.uuid access with get_uuid(o) in the
  AI assistant builtin tools, since data objects have no .uuid attribute
* [FIX] : Drop object-producing compute actions (1_to_1, 1_to_n, n_to_1,
  2_to_1) from the history when they yield no output, while keeping UI
  actions (load, duplicate, interactive fit) and 1_to_0 analysis
* [NEW] : Add test_history_capture_outputs_drops_failed_compute covering the
  dropped failed compute plus retained UI action and 1_to_0 analysis
Introduce a new history panel that records the operations applied to each
signal and image, enabling users to review and deterministically replay the
processing steps that produced a given object. The work consolidates object
identity, per-panel session management, and a redesigned recompute pipeline so
that recorded histories stay consistent and reproducible across panels.

* [NEW] : Record processing operations per object into a dedicated history
  panel, with deterministic replay of the recorded action sequence
* [NEW] : Manage recording sessions per panel, routing each operation to the
  correct panel's active session and highlighting the active session
* [NEW] : Offer to start a new session when creating or loading an object
* [NEW] : Add a headless deterministic fit evaluator and record interactive
  curve fits as replayable actions
* [CHG] : Disable history auto-recording by default
* [CHG] : Persist action UUIDs and register produced outputs so replay can
  reliably reference the objects it creates
* [CHG] : Redesign cascade recompute around a 1-to-1 in-place reprocess of a
  single primitive, decouple parameter application from the editor, and drop
  the selection side-effect in batch reprocessing
* [CHG] : Lock cascade-recompute behavior with characterization tests
* [FIX] : Stabilize object identity using deterministic UUIDs and scope
  workspace-state compatibility per panel, removing false cross-panel
  incompatibility warnings
* [FIX] : Do not record a compute operation that failed
* [CHG] : Add French translations for the history panel strings
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.

3 participants