Skip to content

Conversation

@takaokouji
Copy link

Summary

When multiple nodes have data with the same name (e.g., "my variable"), the meshV2 sensor value block should return the most recently modified value.

Proposed Changes

  • Updated remoteData structure to include timestamps for each data key: { nodeId: { key: { value: string, timestamp: number } } }
  • Modified handleDataUpdate and fetchAllNodesData to store Date.now() when receiving or fetching data
  • Updated getRemoteVariable to iterate through all nodes and return the value with the largest timestamp
  • Added unit tests in test/unit/mesh_service_v2_timestamp.js to verify the timestamp-based selection logic
  • Updated existing integration test test/integration/extensions/mesh-v2-variable-sync.test.js to match the new remoteData structure

Test Coverage

  • New unit test: test/unit/mesh_service_v2_timestamp.js
  • Updated integration test: test/integration/extensions/mesh-v2-variable-sync.test.js
  • All tests passed with npm test

Resolves: smalruby/smalruby3-gui#492

- Update remoteData structure to include timestamps for each data key
- Modify handleDataUpdate and fetchAllNodesData to store timestamps
- Update getRemoteVariable to return most recently modified value
- Add unit tests for timestamp-based variable retrieval
- Update integration tests to match new remoteData structure

Resolves: smalruby/smalruby3-gui#492

Co-Authored-By: Gemini <noreply@google.com>
@takaokouji takaokouji merged commit 3eb2d86 into develop Jan 1, 2026
1 check passed
@takaokouji takaokouji deleted the feature/issue-492-mesh-v2-last-modified branch January 1, 2026 10:14
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.

meshV2: Use last modified value when multiple nodes have same data name

2 participants