Edge model: Atom track (ATOM-01, 02, 03, 04, 06) - #69
Open
ianmuchyri wants to merge 6 commits into
Open
Conversation
5 tasks
* Keep a blank externalId filter distinct from an omitted one normalize_external_id collapsed both "filter omitted" and "filter explicitly blank/whitespace" to None. The SQL callers bind that as `col IS NULL OR col = $n`, so a caller who passed a blank externalId filter (a mistake, or an attempt to match nothing) got back the full unfiltered authorized/listed set instead of zero rows. Every Some(_) input now stays Some(_): blank, NUL-bearing, and over-cap values normalize to a sentinel longer than MAX_EXTERNAL_ID_LEN, which the length CHECK constraint guarantees no stored row can equal. Only a genuinely omitted None still means "no filter". Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com> * Suppress object-group membership events on no-op removals remove_entity_from_object_group, clear_entity_object_groups, and their resource counterparts discarded the DELETE's affected-row count and always published entity.object_group.remove / entity.object_groups.clear (and the resource equivalents), even when zero rows were deleted — e.g. removing a membership that never existed, or clearing an already-empty set. Event consumers were told a change happened when nothing changed. delete_entity_object_groups_in_tx and delete_resource_object_groups_in_tx now return the deleted row count, and the four *_with_audit callers skip the event publish (but still commit) when it's zero — the same shape already used by add_entity_to_object_group_with_audit / add_resource_to_object_group_with_audit for the additive side, and by remove_group_member_with_audit for principal-group membership. Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com> --------- Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>
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
Consolidates the Atom-side work for the edge model plan — the entity model (Device,
is_gateway,gateways[], groups, sharing) needs five generic, non-IoT-specific capabilities from Atom, all now merged toedge:attributesContains(JSONB containment) exposed onentities()/groups(), matching whatresources()already had. Backs the gateway→devices reverse lookup.directPolicies(objectId:)— the reverse of the existing subject-forward policy lookup, answering "who has access to this object". Backs revocation and a sharing UI.external_idon entities — a foreign-key identifier (serial number, MAC, etc.) Atom stores and indexes but never interprets, unique per tenant.attributesContains,profileId,entityStatus,parentGroupId,includeDescendants,externalId) exposed onauthorizedObjectIds, mirroringentities().Each PR has its own description with full test plan and design notes; linked above.
ATOM-05(a proposedgatewayentity kind) was withdrawn during design — gateway is a capability (is_gateway), not a distinct kind — so it never shipped.This is a checkpoint before the Magistrala-side work (
pkg/atomclient, device/gateway API) begins, which depends on all five of these being available.Test plan
Each of the five PRs was independently verified (
cargo clippy -- -D warnings,cargo fmt --check, full DB-gated integration suite) before merging toedge. Two of the five (#65, #68) merged with real diff conflicts against work already onedge, hand-resolved and re-verified against a fresh database before pushing — see their PR descriptions for specifics. After all five landed, the completeedgeHEAD was independently re-checked out and the full suite re-run clean (only the two pre-existing AMQP-broker-dependent test files fail, unrelated to this work — they requireTEST_AMQP_URLand a live broker, not part ofmake db).