Skip to content

Ensure Records are treated as separate namespaces for IDs#63

Merged
amitchone merged 2 commits into
mainfrom
false-positive-duplicate-ids
May 15, 2026
Merged

Ensure Records are treated as separate namespaces for IDs#63
amitchone merged 2 commits into
mainfrom
false-positive-duplicate-ids

Conversation

@amitchone

@amitchone amitchone commented May 11, 2026

Copy link
Copy Markdown
Collaborator

Fixes a bug whereby RecordMembers with a common ID (but different parent IDs for the record) would be falsely flagged as duplicates:

struct RecordA
{
    ThingSet::ThingSetReadWriteRecordMember<TS_ID_EUI, TS_ID_RECORD_A, "eui", uint64_t> eui;
...

struct RecordB
{
    ThingSet::ThingSetReadWriteRecordMember<TS_ID_EUI, TS_ID_RECORD_B, "eui", uint64_t> eui;
...

ThingSetReadOnlyProperty<uint64_t> eui{ TS_ID_EUI, TS_ID_DEVICE, "rEUI" };

...

ThingSetReadOnlyProperty<std::array<RecordA, NUM_RECORD_A>> recordAs{ TS_ID_RECORD_A, TS_ID_ROOT, "As" };

ThingSetReadOnlyProperty<std::array<RecordB, NUM_RECORD_B>> recordBs{ TS_ID_RECORD_B, TS_ID_ROOT, "Bs" };

The above would flag TS_ID_EUI as duplicated.

This change prevents this from happening, essentially treating records as namespaces keyed on the parent ID. IDs must still be unique within a namespace, but it is now possible to have common IDs between namespaces. I.e., in the case where one device is handling several different record types from different devices.

@amitchone amitchone requested a review from garethpotter May 12, 2026 13:01
@ethan-duckett-brill

Copy link
Copy Markdown
Contributor

All looks good to me but I don't seem to be able to approve!

@amitchone amitchone merged commit 88a830a into main May 15, 2026
6 checks passed

@garethpotter garethpotter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is good and how it should have worked in the first place. Pleased to infer from this that you are now ingesting data from multiple device types.

Comment on lines +9 to +12
// >>> NOTE <<<
//
// If this test binary links successfully, static init didn't trip the
// spurious dedup assert which is a regression in itself

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is this comment regarding?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This was in regards to the alpha and beta members of the two records. Pre-this-fix, this wouldn't build, so any build failure linked to these properties is a regression

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Pleased to infer from this that you are now ingesting data from multiple device types.

Yes, we're at quite an exciting point now where we are working on system integration as a whole - keep an eye on this space!

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.

4 participants