Skip to content

fix(router): fix wrong option configuration, add script-related options#3221

Merged
AlexStocks merged 1 commit intoapache:developfrom
yangpixi:dev-router-option
Feb 20, 2026
Merged

fix(router): fix wrong option configuration, add script-related options#3221
AlexStocks merged 1 commit intoapache:developfrom
yangpixi:dev-router-option

Conversation

@yangpixi
Copy link

Description

relation: #3203

Checklist

  • I confirm the target branch is develop
  • Code has passed local testing
  • I have added tests that prove my fix is effective or that my feature works

@sonarqubecloud
Copy link

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.90%. Comparing base (60d1c2a) to head (88a2b5d).
⚠️ Report is 738 commits behind head on develop.

Files with missing lines Patch % Lines
cluster/router/options.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3221      +/-   ##
===========================================
+ Coverage    46.76%   47.90%   +1.13%     
===========================================
  Files          295      463     +168     
  Lines        17172    33750   +16578     
===========================================
+ Hits          8031    16168    +8137     
- Misses        8287    16278    +7991     
- Partials       854     1304     +450     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Alanxtl Alanxtl linked an issue Feb 19, 2026 that may be closed by this pull request
@Alanxtl Alanxtl added ☢️ Bug 3.3.2 version 3.3.2 labels Feb 19, 2026
Copy link
Contributor

@Alanxtl Alanxtl left a comment

Choose a reason for hiding this comment

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

lgtm

@AlexStocks AlexStocks merged commit 34f7dbc into apache:develop Feb 20, 2026
10 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes critical bugs in the router options configuration and adds support for script-related options to enable the ScriptRouter functionality. According to the linked issue #3203, ScriptRouter existed but had its registration commented out, and these changes are part of making it functional.

Changes:

  • Fixed WithRuntime function to correctly set opts.Router.Runtime instead of incorrectly setting opts.Router.Force
  • Fixed WithEnabled function to correctly set opts.Router.Enabled instead of incorrectly setting opts.Router.Force
  • Added WithScript function to configure the script content for ScriptRouter
  • Added WithScriptType function to configure the script type (e.g., JavaScript, Groovy) for ScriptRouter

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

Comment on lines 62 to 108
@@ -93,5 +93,16 @@ func WithTags(tags []global.Tag) Option {
return func(opts *Options) {
opts.Router.Tags = tags
}
}

func WithScript(script string) Option {
return func(opts *Options) {
opts.Router.Script = script
}
}

func WithScriptType(scriptType string) Option {
return func(opts *Options) {
opts.Router.ScriptType = scriptType
}
}
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

Test coverage is missing for the option functions in this file. Following the established pattern in the codebase (such as metrics/options_test.go and otel/trace/options_test.go), each WithXxx function should have a corresponding TestWithXxx test case. Please add tests for WithRuntime, WithEnabled, WithScript, and WithScriptType to verify they correctly set their respective fields in opts.Router.

Copilot uses AI. Check for mistakes.
@yangpixi yangpixi deleted the dev-router-option branch February 20, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.3.2 version 3.3.2 ☢️ Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[讨论] dubbo-go router report

5 participants