Repository navigation
[Core] Handle JSONEncoding in encoding equality hashes - #360
Merged
Merged
Conversation
earocorn
pushed a commit
that referenced
this pull request
Nov 10, 2026
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.
Summary
JSONEncodingwithout sending it through the unsupported SWE XMLencoding serializer;
structure/encoding comparisons;
combined structure/JSON hash.
Problem
DataComponentChecks.getEncodingEqualsHashCode()serializes everyDataEncodingwithSWEUtils.writeEncoding(..., V2_0). The SWE XML writer hasno representation for
JSONEncoding, so equality comparison throws:This is reachable when
SystemTransactionHandler.addOrUpdateDataStream()compares an existing datastream with a newly registered definition. A first
registration can succeed, but module restart, repeated Connected Systems API
metadata registration, or downstream datastream reconciliation can fail once
the JSON-encoded stream already exists.
Serving existing resources and posting observations to an already provisioned
datastream do not themselves require this comparison. Nodes that register or
reconcile JSON datastream metadata do.
Fix
JSONEncodinghas no configurable SWE encoding properties. Hash a delimitedSWE/2.0/JSONEncodingfamily marker for that interface and preserve theexisting SWE serializer path for all other encoding families. Both
encoding-only and combined structure/encoding hashes call the same helper.
The marker is NUL-delimited so it cannot collide with the UTF-8 XML emitted for
the existing encoding families.
Validation
./gradlew :sensorhub-core:test --tests org.sensorhub.utils.TestDataComponentChecks --rerun-tasks --no-daemon --console=plain— 10 passed, 0 failed, 0 skipped.
./gradlew :sensorhub-core:test --rerun-tasks --no-daemon --console=plain— 238 passed, 0 failed, 0 errors, 0 skipped across 28 suites.
./gradlew build --no-daemon --console=plain— did not pass because the unrelated threaded SensorML test
TestSMLProcessing.testReadAndExecNestedChainsWithThreadsintermittentlyproduced
15.56instead of20.16. The same test passed when immediatelyrerun alone with
--rerun-tasks; no SensorML source is changed by this patch.datastreams. Three consecutive process starts re-registered the unchanged
streams without deleting or migrating the datastore.
The first local full-suite attempt encountered an unrelated full
/tmpfilesystem and failed 10 temporary-file setup cases. The counted full-suite
result above used an alternate JVM temporary directory on a filesystem with
free space; the formerly failing cases and complete suite then passed.