Skip to content

Add optional JetStream domain config to the natsstore plugin (PER-13735) - #5

Merged
omer9564 merged 2 commits into
mainfrom
omer/per-13735-add-jetstream-domain-config
Jun 15, 2026
Merged

Add optional JetStream domain config to the natsstore plugin (PER-13735)#5
omer9564 merged 2 commits into
mainfrom
omer/per-13735-add-jetstream-domain-config

Conversation

@omer9564

Copy link
Copy Markdown
Contributor

What

Adds an optional domain key to the plugin config. When set, the JetStream context is created with nats.Domain(domain), scoping JetStream API calls to $JS.<domain>.API instead of the default $JS.API. Documented in the README config table and covered in the JSON-marshaling test.

Why

The cloud NATS cluster is activating a JetStream domain (cloud, permitio/cloud-pdp#50). Edge/leafnode-connected OPA instances must address the cloud JetStream through the domain-scoped prefix; direct connections are unaffected either way. Empty (the default) preserves current behavior.

Follow-ups

  • permit-opa: bump opa-nats to the next tag once this merges (v0.0.6)
  • cloud-pdp: inject domain into the permit-opa chart's plugin config

Testing

  • go build ./..., gofmt, go vet — clean
  • go test ./pkg/natsstore/ — 123 passed; the 2 failures (TestPluginFactory_Validate/_New) need a live NATS server and fail identically on clean main

🤖 Generated with Claude Code

Adds a `domain` plugin option; when set, the JetStream context is created
with nats.Domain so API calls are scoped to $JS.<domain>.API. Empty preserves
the default domain-less prefix, so existing deployments are unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 11, 2026

Copy link
Copy Markdown

PER-13735

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds support for an optional JetStream domain in the natsstore plugin configuration, enabling domain-scoped JetStream API calls when required (e.g., across leafnode boundaries) while preserving existing behavior by default.

Changes:

  • Add domain to plugin config (Config) and document it in the README configuration table.
  • Create JetStream context with nats.Domain(domain) when configured.
  • Extend JSON marshal/unmarshal test coverage to include the new domain field.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
README.md Documents the new domain configuration option and its effect on JetStream API prefixing.
pkg/natsstore/nats_client.go Passes optional nats.Domain(...) when creating the JetStream context.
pkg/natsstore/config.go Adds Domain field to the plugin configuration struct with explanatory comments.
pkg/natsstore/config_test.go Updates JSON marshaling test to assert Domain round-trips correctly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/natsstore/nats_client.go Outdated
… JetStream init succeeds

Addresses review comments:
- #5 (comment) (@copilot-pull-request-reviewer)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@zeevmoney zeevmoney left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated Review - the PR looks clean, found nothing.

@omer9564
omer9564 merged commit 4c68fc5 into main Jun 15, 2026
4 checks passed
@omer9564
omer9564 deleted the omer/per-13735-add-jetstream-domain-config branch June 15, 2026 09:56
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.

3 participants