Skip to content

DEV-1124: honour the hardware in ShimmerVerObject.compareVersions - #314

Merged
MAzalya merged 1 commit into
masterfrom
DEV-1124_compareversions_hardware
Oct 2, 2026
Merged

MAzalya merged 1 commit into
masterfrom
DEV-1124_compareversions_hardware

Conversation

@marknolan

@marknolan marknolan commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Fixes DEV-1124.

Defect

ShimmerVerObject.compareVersions(svo, hardwareVersion, fwId, …) never passed the hardware on, and neither did the instance compareVersions(hardwareVersion, fwId, …), which delegates to it. Both called the hardware-agnostic UtilShimmer.compareVersions, so a gate written as "Shimmer3 LogAndStream ≥ x" also matched a Shimmer3R. The two platforms' LogAndStream versions overlap (both FW_ID 3), which is exactly where the hardware check matters.

Fix

  • The method now calls the hardware-aware 10-argument UtilShimmer.compareVersions, where ANY_VERSION still matches every hardware.
  • This is how ShimmerDevice.isThisVerCompatibleWith(hw, …) and ShimmerBluetooth.isThisVerCompatibleWith(hw, …) already behaved.

Impact: latent, no current caller changes result

Every caller was audited in Shimmer-Java-Android-API, Shimmer-Advance-API and ConsensysApps:

Caller Why the result doesn't change
ShimmerDevice.isHWAndFWSupportedBtBleControl / isHWAndFWSupportedUsbControl / isSupportedRn4678ErrorDetection Each already checks isShimmerGen3() / isShimmerGen3R() alongside the call
ShimmerDevice.isSupportedSrProgViaDock BtStream/LogAndStream exist only on Shimmer3/3R; Shimmer3R is also covered by isShimmerGen3R()
ShimmerDevice.isSupportedDerivedSensors (via isVerCompatibleWith(svo, hw, …)) Also ORs isShimmerGen3R() / isShimmerGenGq() / isShimmerGen4(); tested
LiteProtocol.writeLEDCommand BOILER_PLATE firmware exists only on Shimmer2R

This removes a trap for the next gate. DEV-1123's new gate (#313) had to bypass this method because of it.

Testing

  • New API_00023_ShimmerVerObjectHardwareGateTest (5 tests):
    • both overloads reject the other platform's hardware;
    • ANY_VERSION matches both;
    • version and firmware ID still decide;
    • isSupportedDerivedSensors stays true for Shimmer3 ≥ 0.3.17 and for Shimmer3R.
  • Proof it catches the bug: with the old method body restored, 2 of the 5 fail.
  • cd ShimmerDriver && ./gradlew test: 124 tests, 0 failures.

Siblings (CLAUDE.md §4)

  • C#: compareVersions has no hardware-taking overload; its callers check the hardware explicitly.
  • Web SDK: atLeast plus explicit hardware checks.
  • pyshimmer and Swift: no equivalent helper.

None of them has this defect.

🤖 Generated with Claude Code

The static compareVersions(svo, hardwareVersion, fwId, ...) and the
instance compareVersions(hardwareVersion, fwId, ...) that delegates to it
never passed the hardware on, so a gate written as "Shimmer3 LogAndStream
>= x" also matched a Shimmer3R. The two platforms' LogAndStream versions
overlap, which is exactly where the hardware check matters. It now calls
the hardware-aware UtilShimmer.compareVersions, where ANY_VERSION still
matches every hardware.

No existing caller changes result: each already checks isShimmerGen3()
or isShimmerGen3R() alongside, or uses firmware that exists on only one
hardware. API_00023 covers both overloads, ANY_VERSION, and the one gate
that reached it with a hardware it relied on being ignored
(isSupportedDerivedSensors).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@MAzalya MAzalya 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.

ok looks good

@MAzalya
MAzalya merged commit e39e1cd into master Oct 2, 2026
2 checks passed
@MAzalya
MAzalya deleted the DEV-1124_compareversions_hardware branch October 2, 2026 05:58
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.

2 participants