← Back to Pull requests

OSPP: feat(plugin-divide): add canary configuration and validated label-based canary routing. #7963

Closed
unknown closed this pull request without merging on Oct 23, 2026 03:22 UTC
View on GitHub
unknown unknown commented on Oct 21, 2026 13:10 UTC
Author

Summary

Adds optional, disabled-by-default Canary routing to the Divide plugin.

  • Add CanaryConfig with request conditions, traffic percentage, sticky key, partition labels, and an empty-pool fallback policy.

  • Validate configuration in Admin before persistence and in the gateway before cache replacement.

  • Use deterministic bucketing to assign requests to Stable or Canary, then reuse existing circuit breaking and load balancing within that partition.

  • Preserve legacy routing when Canary configuration is absent. A present but disabled configuration routes to Stable.
  • Partition-aware failover retries and metrics remain separate changes in the future. This PR rejects positive failover retries on rules containing Canary configuration.

    Example

    {
      "loadBalance": "roundRobin",
      "timeout": 3000,
      "retry": 0,
      "canary": {
        "enabled": true,
        "conditions": [
          {"paramType": "header", "paramName": "X-Region", "operator": "=", "paramValue": "east"}
        ],
        "matchMode": 0,
        "percentage": 10,
        "stickyKey": {"paramType": "header", "paramName": "X-User-Id"},
        "stableLabels": {"release": "stable"},
        "canaryLabels": {"release": "canary"},
        "fallbackPolicy": "STABLE"
      }
    }
    

    Architecture

    flowchart TD
        A["Admin: RuleServiceImpl"] --> B["CanaryConfigValidator"]
        B --> C["Existing rule.handle storage and data sync"]
        C --> D["DividePluginDataHandler: validate and cache"]
    
        R["Request matched by Selector / Rule"] --> E["DividePlugin"]
        D -. "Read configuration" .-> E
    
        E --> F["DefaultCanaryDecisionService<br/>Conditions + sticky-key bucketing"]
        F --> G["Select Stable / Canary nodes by labels"]
    
        U["DivideUpstreamDataHandler<br/>Cache both upstream pools"] --> G
    
        G --> H["Existing circuit breaker / half-open probes"]
        H --> I["Existing load balancer"]
        I --> J["HTTP forwarding"]
    

  • You have read the contribution guidelines.

  • You submit test cases (unit or integration tests) that back your changes.

  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.
  • Diff: 270 lines (+202 / -68) across 3 files Reviewer: Aias00 Review duration: 2292m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.63) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 270 lines diff across 3 files
    0.63
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.335
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #7963"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 62.6% (MEDIUM) · Higher = larger blast radius
    62.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.7% · Safe to merge
    24.7%
    Repository