Skip to content

sdk changes to retrieve upstrem#2577

Merged
Krishanx92 merged 1 commit into
wso2:mainfrom
tharindu1st:aws-authentication
Jul 10, 2026
Merged

sdk changes to retrieve upstrem#2577
Krishanx92 merged 1 commit into
wso2:mainfrom
tharindu1st:aws-authentication

Conversation

@tharindu1st

Copy link
Copy Markdown
Contributor

sdk changes to retrieve upstrem

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6f07d1fd-4d01-462f-8a95-5b33da853955

📥 Commits

Reviewing files that changed from the base of the PR and between 1fe5fd3 and ab4f652.

📒 Files selected for processing (5)
  • sdk/core/policy/v1alpha2/action.go
  • sdk/core/policy/v1alpha2/context.go
  • sdk/core/policy/v1alpha2/types.go
  • sdk/core/policyengine/upstream.go
  • sdk/core/policyengine/upstream_test.go

📝 Walkthrough

Walkthrough

Adds UpstreamInfo metadata conversion and exposes resolved upstream details and main/sandbox upstream slot selection through policy request contexts and actions.

Changes

Upstream routing policy support

Layer / File(s) Summary
Upstream information contract
sdk/core/policyengine/upstream.go, sdk/core/policyengine/upstream_test.go
Defines UpstreamInfo, converts it to and from metadata maps, and tests complete, partial, and invalid inputs.
Policy upstream routing fields
sdk/core/policy/v1alpha2/types.go, sdk/core/policy/v1alpha2/context.go, sdk/core/policy/v1alpha2/action.go
Adds main and sandbox slot types, exposes resolved upstream information in RequestContext, and adds upstream slot selection to request modification actions.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description is too vague and does not include the required Purpose, Goals, Approach, tests, or other template sections. Expand the PR description to fill the template sections, especially Purpose, Goals, Approach, User stories, tests, docs, and environment details.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and correctly points to the SDK upstream retrieval changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Krishanx92
Krishanx92 merged commit 30b1808 into wso2:main Jul 10, 2026
6 of 7 checks passed
// These are valid at the header phase because routing decisions do not require
// the request body to be available.
UpstreamName *string // route to a named upstream definition (nil = no change)
UpstreamSlot *UpstreamSlot // route to the API's main or sandbox upstream slot instead of the slot implied by the current vhost (nil = no change); requesting a slot the API doesn't have configured is a no-op (logged, not an error)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not required right?

// URL. This is the shared wire shape used on both sides of the xDS route-config
// channel between gateway-controller and policy-engine.
type UpstreamInfo struct {
ClusterName string `json:"cluster_name" yaml:"cluster_name"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ClusterName is an internal thing. Why do we need to expose it?

// ToMap converts UpstreamInfo into a structpb-compatible map for embedding as a
// nested object in xDS route-config metadata (structpb.Struct only accepts
// string/bool/number/nil/slice/map values, not arbitrary structs).
func (u UpstreamInfo) ToMap() map[string]interface{} {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need this func?


// UpstreamInfoFromMap decodes an UpstreamInfo from the generic map produced when
// the xDS metadata struct is unmarshalled back to JSON on the consumer side.
func UpstreamInfoFromMap(m map[string]interface{}) UpstreamInfo {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And this func?

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