Skip to content

Asset-identity model + merge-by-identity#488

Draft
mfaferek93 wants to merge 6 commits into
mainfrom
feat/asset-identity-merge
Draft

Asset-identity model + merge-by-identity#488
mfaferek93 wants to merge 6 commits into
mainfrom
feat/asset-identity-merge

Conversation

@mfaferek93

Copy link
Copy Markdown
Collaborator

Closes #482

Adds an AAS-Nameplate-aligned AssetIdentity (manufacturer, model, serial, hardware/firmware/software version, network endpoint, role) plus an extensible map to the Component entity. Identity is merged across sources by a configurable precedence ranked on Component.source, with per-field provenance, wired through the discovery and peer-aggregation paths. JSON is backward compatible: identity is emitted only when set.

Tested: identity / merge-pipeline / peer-client / entity-merger suites pass.

Add an AssetIdentity nameplate (manufacturer, model, serial, hardware/
firmware/software version, network endpoint, role) plus an extensible
key-value map to the Component entity, AAS Nameplate-aligned. Merge
identity across sources by a configurable precedence with per-field
provenance, integrated into the discovery merge pipeline. JSON is
backward compatible: identity is emitted under x-medkit only when set.

Refs #482
Parse x-medkit.identity in peer aggregation and gap-fill remote identity
on an id collision (was silently dropped). Rank merge precedence on the
canonical Component.source tag instead of the free-form layer name, so
protocol reads actually outrank the manifest. Drop the unused identity-key
API and correct the README to match what the pipeline does.

Refs #482
Copilot AI review requested due to automatic review settings June 30, 2026 17:24

Copilot AI 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.

Pull request overview

This PR introduces an AAS Nameplate-aligned asset identity model for Component and wires it through discovery merging and peer aggregation so identity survives end-to-end (including per-field provenance), while keeping JSON backward compatible by only emitting identity when populated.

Changes:

  • Add AssetIdentity to the Component model and emit it under x-medkit.identity only when non-empty (with optional _provenance).
  • Implement identity merge logic with configurable source precedence and per-field provenance tracking; integrate it into the discovery merge pipeline and peer entity merging.
  • Extend peer parsing to round-trip x-medkit.identity and add unit tests for the model, merge behavior, pipeline integration, and peer round-trip.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ros2_medkit_gateway/test/test_peer_client.cpp Adds a peer round-trip + merge test ensuring x-medkit.identity is preserved through fetch + merge.
src/ros2_medkit_gateway/test/test_merge_pipeline.cpp Adds merge-pipeline tests for identity precedence + provenance and configurability.
src/ros2_medkit_gateway/test/test_asset_identity.cpp New unit tests for AssetIdentity JSON behavior and merge rules.
src/ros2_medkit_gateway/src/discovery/merge_pipeline.cpp Integrates identity merge into component identity field-group merging and seeds provenance on the base component.
src/ros2_medkit_gateway/src/core/aggregation/peer_client.cpp Parses x-medkit.identity from peer component JSON so identity isn’t dropped.
src/ros2_medkit_gateway/src/core/aggregation/entity_merger.cpp Gap-fills local component identity from peer components using identity merge + provenance stamping.
src/ros2_medkit_gateway/README.md Documents the identity model, JSON keys, AAS mapping intent, and precedence/provenance behavior.
src/ros2_medkit_gateway/include/ros2_medkit_gateway/discovery/merge_pipeline.hpp Exposes set_identity_merge_config() on the merge pipeline.
src/ros2_medkit_gateway/include/ros2_medkit_gateway/core/discovery/models/component.hpp Adds AssetIdentity identity to Component and conditionally emits it in JSON.
src/ros2_medkit_gateway/include/ros2_medkit_gateway/core/discovery/models/asset_identity.hpp New AssetIdentity type with typed fields, extra map, provenance map, and JSON (de)serialization.
src/ros2_medkit_gateway/include/ros2_medkit_gateway/core/discovery/identity_merge.hpp New merge implementation with configurable source precedence and per-field provenance handling.
src/ros2_medkit_gateway/CMakeLists.txt Registers the new test_asset_identity target.

@mfaferek93 mfaferek93 marked this pull request as draft June 30, 2026 17:30
@mfaferek93 mfaferek93 self-assigned this Jun 30, 2026
to_json() now returns {} for an empty identity instead of emitting a
lone _provenance block. stamp_identity_provenance() is a no-op for an
empty source so it no longer writes empty-valued _provenance entries.
Corrected set_identity_merge_config() docstring after key-strategy removal.

Refs #482
@mfaferek93 mfaferek93 force-pushed the feat/asset-identity-merge branch from 3f74174 to 36c5e31 Compare June 30, 2026 18:01
The SSE handler tests inject entity-cache state directly, but the node's
graph-event refresh_cache() reconciles it to the live ROS graph and wipes
node_to_app, dropping x-medkit. ASan widened the window so a refresh landed
between injection and fault delivery. Stop the refresh drivers in the fixture.

Refs #482
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.

Asset-identity model + merge-by-identity

2 participants