Skip to content

fix(scopes): namespace data update entry topics with scope ID - #954

Closed
Tyagiquamar wants to merge 2 commits into
permitio:masterfrom
Tyagiquamar:fix/scoped-data-update-topic-namespacing
Closed

Tyagiquamar wants to merge 2 commits into
permitio:masterfrom
Tyagiquamar:fix/scoped-data-update-topic-namespacing

Conversation

@Tyagiquamar

Copy link
Copy Markdown

Summary

Ensures data update entry topics published via \POST /scopes/{scope_id}/data/update\ are properly scope-namespaced ({scope_id}:data:{topic}) to match OPAL client subscription topic expectations.

Problem

When a data update was posted to \POST /scopes/{scope_id}/data/update, \publish_data_update_event\ in \opal_server/scopes/api.py\ rewrote each entry's topics to \data:{topic}.

Although \ScopedServerSideTopicPublisher\ published to the channel {scope_id}:data:{topic}, the \DataUpdate\ payload received by the client contained \�ntry.topics = ['data:{topic}']. Since scoped OPAL clients subscribe to {scope_id}:data:{topic}, the client's topic check (\set(entry.topics).isdisjoint(self._data_topics)) evaluated to \True, causing every scoped data entry to be skipped as non-matching.

Solution

  1. Scope-prefix entry topics in \publish_data_update_event\ as {scope_id}:data:{topic}.
  2. Guard \ScopedServerSideTopicPublisher.publish\ to avoid double-prefixing when topics are already scope-namespaced.

Closes #920

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
@netlify

netlify Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for opal-docs canceled.

Name Link
🔨 Latest commit 4fc4d58
🔍 Latest deploy log https://app.netlify.com/projects/opal-docs/deploys/6aec00cfacf695a18dfe3160

@Tyagiquamar

Copy link
Copy Markdown
Author

Hi, friendly ping for review on this PR when you have a moment. Happy to address any feedback. Thanks!

@Tyagiquamar

Copy link
Copy Markdown
Author

Hi, just following up on this when you get a chance. The branch is up to date and checks are green. If it looks good from your side, it should be ready to merge. Happy to make any changes if needed. Thanks!

…spacing

Signed-off-by: Mohd Quamar Tyagi <104281681+Tyagiquamar@users.noreply.github.com>
@zeevmoney

Copy link
Copy Markdown
Member

Thank you for this.

#949 fixes the same problem, adds a regression test, and leaves the shared publisher unchanged. We're going with #949 and closing this as a duplicate.

Thanks for contributing.

@zeevmoney zeevmoney closed this Nov 6, 2026
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.

Scoped POST /scopes/{scope_id}/data/update never reaches the scoped agent (entry topics not scope-namespaced)

2 participants