Skip to content

use string subject IDs in PRE_DEFINED_EXTRA_FIELDS_READ_GRANT_OBJECT …#2384

Merged
thjaeckle merged 1 commit intoeclipse-ditto:masterfrom
beyonnex-io:fix-mising-missing-extra-fields
Apr 1, 2026
Merged

use string subject IDs in PRE_DEFINED_EXTRA_FIELDS_READ_GRANT_OBJECT …#2384
thjaeckle merged 1 commit intoeclipse-ditto:masterfrom
beyonnex-io:fix-mising-missing-extra-fields

Conversation

@hu-ahmed
Copy link
Copy Markdown
Contributor

@hu-ahmed hu-ahmed commented Mar 31, 2026

Summary

  • Fix: ThingEventEnricher now produces PRE_DEFINED_EXTRA_FIELDS_READ_GRANT_OBJECT
    header with string subject IDs instead of integer indices, matching the format
    expected by DittoCachingSignalEnrichmentFacade
  • Add ReadGrant.toJson() to serialize grants as {"/path": ["subject1", "subject2"]}
  • Remove dead code: IndexedReadGrant and ReadGrantIndexer (no remaining usages)
  • Add regression tests verifying string format in both ReadGrantCollectorTest
    and ThingEventEnricherTest

Root cause

ReadGrantIndexer.index() converted ReadGrant to an indexed format where
subject IDs are replaced by integer indices to reduce header size:

{"/attributes": [0]}                                      

Where 0 maps to a subject ID string. But
DittoCachingSignalEnrichmentFacade.filterAskedForFieldSelectorToGrantedFields()
compares the array values directly against the requesting connection's authorization
subject ID strings. JsonValue(integer) never equals JsonValue(string),
so the filter returned an empty field selector, causing all pre-defined extra fields
to be silently dropped from enriched events.

Impact

All connections relying on pre-defined extra fields enrichment (e.g.
extraFields=attributes) received events with empty extra, causing
downstream consumers to fail when attempting to read expected fields.

@hu-ahmed hu-ahmed force-pushed the fix-mising-missing-extra-fields branch from a3a0118 to de213fd Compare March 31, 2026 17:20
@thjaeckle thjaeckle added the bug label Apr 1, 2026
@thjaeckle thjaeckle added this to the 3.9.0 milestone Apr 1, 2026
Copy link
Copy Markdown
Member

@thjaeckle thjaeckle left a comment

Choose a reason for hiding this comment

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

@hu-ahmed thanks for the fix - just a minor comment to adjust

@hu-ahmed hu-ahmed force-pushed the fix-mising-missing-extra-fields branch from de213fd to 5036e30 Compare April 1, 2026 07:59
Copy link
Copy Markdown
Member

@thjaeckle thjaeckle left a comment

Choose a reason for hiding this comment

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

Thanks @hu-ahmed LGTM 👍

@thjaeckle thjaeckle merged commit 9add82e into eclipse-ditto:master Apr 1, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants