feat(router): support static script router config#3419
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3419 +/- ##
===========================================
+ Coverage 46.76% 53.50% +6.73%
===========================================
Files 295 493 +198
Lines 17172 38406 +21234
===========================================
+ Hits 8031 20550 +12519
- Misses 8287 16212 +7925
- Partials 854 1644 +790 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds static (application-scoped) router config injection support for ScriptRouter, enabling bootstrap configuration via RouterConfig without YAML parsing and aligning static compilation behavior with config-center updates. This addresses the gap noted in #3203 where RouterConfig already includes ScriptType/Script but ScriptRouter didn’t implement the static config interface.
Changes:
- Implement
SetStaticConfig(*global.RouterConfig)onScriptRouterto accept static script rules and compile them on set. - Ensure static updates replace any previously compiled script state (destroy old, compile new; disabled/invalid disables routing).
- Add regression tests covering enabled/disabled/unsupported/invalid static script configs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
cluster/router/script/router.go |
Adds SetStaticConfig to apply/compile static script router rules and manage prior compiled state. |
cluster/router/script/router_test.go |
Adds unit tests for static script config application, replacement, disablement, and invalid/unsupported cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| s.enabled = cfg.Enabled == nil || *cfg.Enabled | ||
| if !s.enabled { | ||
| logger.Infof("[Router][Script] static config is disabled, script=%s", cfg.Script) | ||
| return | ||
| } |
|
@yangpixi @Aetherance help review this, is this pr necessary? |
2e904b2 to
3a34450
Compare
|
|
The failed Integration Test appears to be runner infrastructure rather than a code failure. The failing step ended with |



What
SetStaticConfigsupport toScriptRouterfor application-scoped static router configs.Why
Issue #3203 tracks router follow-ups and explicitly calls out that
RouterConfigalready hasScriptTypeandScriptfields, butScriptRouterdid not implement the static config interface.Validation
Refs #3203