Skip to content

Bugfix/hashing and mf4 saving - #215

Open
AndraeCarotta wants to merge 14 commits into
masterfrom
bugfix/hashing-and-mf4-saving
Open

AndraeCarotta wants to merge 14 commits into
masterfrom
bugfix/hashing-and-mf4-saving

Conversation

@AndraeCarotta

Copy link
Copy Markdown
Contributor

No description provided.

@AndraeCarotta AndraeCarotta self-assigned this Sep 20, 2026
@AndraeCarotta AndraeCarotta added the bugfix Something isn't working label Sep 20, 2026
@AndraeCarotta
AndraeCarotta requested a review from a team September 20, 2026 22:12
@AndraeCarotta AndraeCarotta linked an issue Sep 20, 2026 that may be closed by this pull request
@AndraeCarotta
AndraeCarotta force-pushed the master branch 2 times, most recently from 358a194 to 35823c5 Compare September 20, 2026 23:13
@AndraeCarotta
AndraeCarotta force-pushed the bugfix/hashing-and-mf4-saving branch 6 times, most recently from d25e59b to 2c5cfb1 Compare September 21, 2026 21:43
@AndraeCarotta
AndraeCarotta force-pushed the bugfix/hashing-and-mf4-saving branch 4 times, most recently from 1807288 to 50c6aea Compare September 29, 2026 21:05
@AndraeCarotta
AndraeCarotta force-pushed the bugfix/hashing-and-mf4-saving branch 2 times, most recently from ffdd925 to cc7ea36 Compare October 6, 2026 22:23
@AndraeCarotta
AndraeCarotta requested a review from Jonny3 October 6, 2026 22:24
@AndraeCarotta
AndraeCarotta force-pushed the bugfix/hashing-and-mf4-saving branch from cc7ea36 to fc67499 Compare October 6, 2026 22:41
@AndraeCarotta
AndraeCarotta enabled auto-merge (squash) October 6, 2026 22:50
@AndraeCarotta
AndraeCarotta force-pushed the master branch 5 times, most recently from e42a133 to b63f158 Compare October 8, 2026 00:10

@Jonny3 Jonny3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good but lets clean a little.

"""Return the source hashes in this object's data dependency tree.

Args:
cache (dict[str, AresDataInterface]): Cache used to resolve data dependencies.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cache (dict[str, AresDataInterface]): Cache used to resolve data dependencies.
cache (Mapping[str, AresDataInterface]): Cache used to resolve data dependencies.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and I guess MApping is a list

logger.warning(
f"Unequal signal length detected for '{signal.label}': "
f"got {signal.shape[0]}, expected {expected_length}."
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break loop after detection of unequal shape?

@typechecked
def get_origin_hashes(
self,
cache: Mapping[str, "AresDataInterface"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in Class itself it is:
cache: ClassVar[dict[str, "AresDataInterface"]] = {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments ares-data-interface

visited.add(self.hash)

dependencies = [
cache[dependency] for dependency in self.dependencies if dependency in cache

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should think about claling depedency_hahes

Comment thread ares/plugins/merge.py Outdated
origin_hashes = instance.get_origin_hashes(
cast(Mapping[str, AresDataInterface], cache)
)
else:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even with tpying i'd like to write
elif isinstance(instance, AresParamInterface) instead of else. and for security add an else: with logger.error() if we want.

Comment thread ares/plugins/merge.py Outdated
if instance is None:
continue
if isinstance(instance, AresDataInterface):
origin_hashes = instance.get_origin_hashes(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
origin_hashes = instance.get_origin_hashes(
origin_hashes: set[str] = instance.get_origin_hashes(

Comment thread ares/plugins/merge.py Outdated
continue
if isinstance(instance, AresDataInterface):
origin_hashes = instance.get_origin_hashes(
cast(Mapping[str, AresDataInterface], cache)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also here consider the datatype, ClassVAr vs Mapping

Comment thread ares/plugins/merge.py
origin_hashes = instance.get_origin_hashes(
cast(Mapping[str, AresParamInterface], cache)
)
for origin_hash in origin_hashes:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setdefault is not necessary here or we should simplify. "origin_hashes" is a set so it's unique. so default is not necessary since no other same value can exist.

Comment thread ares/plugins/merge.py
if combination_list not in combinations:
combinations.append(combination_list)

return combinations

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have to step in this but looks okay!

@AndraeCarotta
AndraeCarotta force-pushed the bugfix/hashing-and-mf4-saving branch 2 times, most recently from fe0ece0 to 64052be Compare November 5, 2026 19:57
@AndraeCarotta
AndraeCarotta force-pushed the bugfix/hashing-and-mf4-saving branch 7 times, most recently from 1161a1d to 7a6a727 Compare November 17, 2026 22:56
@AndraeCarotta
AndraeCarotta requested a balanced review from Copilot November 17, 2026 23:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical defects can corrupt merge ancestry, truncate preferred signals, and mix channel values across sources.

7 open issues
What changed in this PR

This PR updates ARES data merging and MF4 persistence to preserve duplicate
signals and separate timebases, while adding source-aware selection for
simulation inputs.

Changes:

  • Adds common-source and Cartesian merge modes, duplicate-data controls, and
    dependency-origin traversal.
  • Preserves duplicate MF4 channels and groups writes by source and timebase.
  • Adds regression tests, workflow examples, and documentation for the new behavior.
File Description
test/​utils/​test_select_signals_by_source_priority.py Tests source ordering and fallback selection.
test/​pydantic_models/​test_workflow_model.py Tests merge options and runtime source-priority reset.
test/​plugins/​test_merge.py Tests combinations, precedence, and duplicate retention.
test/​interfaces/​parameter/​test_ares_parameter_interface.py Updates duplicate-filter method references.
test/​interfaces/​data/​test_mf4_handler.py Tests separate timebases and duplicate-channel round trips.
test/​interfaces/​data/​test_ares_signal.py Adds timestamp casting and shape-validation tests.
test/​interfaces/​data/​test_ares_data_interface.py Updates interface tests and adds origin-matching coverage.
README.md Documents merge modes and duplicate-data controls.
examples/​workflow/​parameter_interface/​param_merge.wf.json Demonstrates explicit parameter merge modes.
examples/​workflow/​data_interface/​data_merge.wf.json Demonstrates source-aware merging and duplicate precedence.
examples/​Makefile Builds the simulation unit required by the merge example.
examples/​data/​data_example_7_mf4.py Generates input and reference-output signals.
examples/​data/​data_example_5_6mf4.py Generates multidimensional MF4 example data.
ares/​utils/​select_signals_by_source_priority.py Adds duplicate-label selection by source priority.
ares/​pydantic_models/​workflow_model.py Adds merge configuration and runtime source priority.
ares/​plugins/​simunit.py Selects input sources and warns on missing simulation results.
ares/​plugins/​merge.py Implements merge strategies and duplicate handling.
ares/​interface/​parameter/​jsonparam_handler.py Updates duplicate filtering and a docstring type.
ares/​interface/​parameter/​dcm_handler.py Uses the renamed duplicate filter.
ares/​interface/​parameter/​ares_parameter_interface.py Adds origin/source queries and renames duplicate filtering.
ares/​interface/​data/​mf4_handler.py Preserves occurrences and writes separate source/timebase groups.
ares/​interface/​data/​ares_signal.py Changes validation errors, annotations, and docstrings.
ares/​interface/​data/​ares_data_interface.py Adds origin/source queries and removes stored resampling defaults.
ares/​core/​pipeline.py Supplies simulation source priority from workflow ordering.
.vscode/​launch.json Adds simulation preparation before debugging.

Review effort: Balanced

Comment thread ares/interface/data/mf4_handler.py Resolved
Comment thread ares/plugins/merge.py Resolved
Comment thread ares/plugins/simunit.py Resolved
Comment thread ares/interface/data/ares_signal.py Resolved
Comment thread ares/interface/data/mf4_handler.py Resolved
Comment thread ares/plugins/simunit.py Resolved
@AndraeCarotta
AndraeCarotta force-pushed the bugfix/hashing-and-mf4-saving branch from abe358c to 130099e Compare November 24, 2026 20:35
@AndraeCarotta
AndraeCarotta force-pushed the bugfix/hashing-and-mf4-saving branch 3 times, most recently from 6f41c19 to 1859948 Compare November 24, 2026 22:42
@AndraeCarotta
AndraeCarotta force-pushed the bugfix/hashing-and-mf4-saving branch from 1859948 to 49440cf Compare November 24, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Something isn't working prio 1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug Report: check for correct hash-calculation

3 participants