Skip to content

Fix batch dispatch of multiple attribute events to the same asset - #3477

Merged
wborn merged 7 commits into
mainfrom
bugfix/assets-dispatch-batch
Oct 28, 2026
Merged

wborn merged 7 commits into
mainfrom
bugfix/assets-dispatch-batch

Conversation

@ebariaux

@ebariaux ebariaux commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #3476.

AssetsFacade.dispatch rejected valid batches containing multiple attribute events for the same asset because it compared the event count with the number of matching assets. Validate distinct target asset IDs so these batches are accepted, while forwarding every original event in its supplied order.

Retain the existing scope checks and reject the whole batch if the scoped lookup does not return every target. Unit tests cover repeated and distinct targets across global, realm and asset scopes, plus partial lookup results representing missing or out-of-scope targets. Enable the standard manager/src/test/groovy directory alongside the existing test directory.

Validation: ./gradlew --offline --no-daemon :manager:test --tests org.openremote.manager.rules.facade.AssetsFacadeTest — 24 tests passed. The initial regression cases were confirmed failing before the fix.

No breaking API changes; this restores valid batch dispatch behavior.

Checklist

  • 1. Acceptance criteria of the linked issue(s) are met
  • 2. Tests are written and all tests pass (targeted suite: 24 tests)
  • 3. Changes are manually tested by you and the reviewer
  • 4. Documentation is written or updated (not required for this bugfix)

Discovered during the rules facade scoping review tracked in #2675; this is a separate functional bug fix.

@ebariaux ebariaux added the Bug Error or issue in the system label Oct 23, 2026
@ebariaux ebariaux self-assigned this Oct 23, 2026
@ebariaux
ebariaux requested a review from a team October 23, 2026 14:25
@wborn
wborn added this pull request to the merge queue Oct 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 28, 2026
@wborn
wborn added this pull request to the merge queue Oct 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 28, 2026

@wborn wborn left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Several newly added tests are failing @ebariaux. Can you have a look?

Failed tests:

  • org.openremote.manager.rules.facade.AssetsFacadeTest > asset scope dispatches every event in order for a single event
  • org.openremote.manager.rules.facade.AssetsFacadeTest > asset scope dispatches every event in order for distinct targets
  • org.openremote.manager.rules.facade.AssetsFacadeTest > asset scope dispatches every event in order for mixed repeated and distinct targets
  • org.openremote.manager.rules.facade.AssetsFacadeTest > asset scope dispatches every event in order for two events for one target
  • org.openremote.manager.rules.facade.AssetsFacadeTest > asset scope rejects the whole batch for foreign-realm with repeated permitted targets: false
  • org.openremote.manager.rules.facade.AssetsFacadeTest > asset scope rejects the whole batch for foreign-realm with repeated permitted targets: true
  • org.openremote.manager.rules.facade.AssetsFacadeTest > asset scope rejects the whole batch for missing with repeated permitted targets: false
  • org.openremote.manager.rules.facade.AssetsFacadeTest > asset scope rejects the whole batch for missing with repeated permitted targets: true
  • org.openremote.manager.rules.facade.AssetsFacadeTest > asset scope rejects the whole batch for outside-subtree with repeated permitted targets: false
  • org.openremote.manager.rules.facade.AssetsFacadeTest > asset scope rejects the whole batch for outside-subtree with repeated permitted targets: true

@sonarqubecloud

Copy link
Copy Markdown

@ebariaux
ebariaux requested a review from wborn October 28, 2026 15:50
@wborn
wborn added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 78a8d8a Oct 28, 2026
23 checks passed
@wborn
wborn deleted the bugfix/assets-dispatch-batch branch October 28, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Error or issue in the system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AssetsFacade.dispatch rejects batches with multiple events for the same asset

2 participants