Skip to content

fix(plugin): evaluate clock-based time conditions without request values - #8538

Open
sunnysabor wants to merge 1 commit into
apache:masterfrom
sunnysabor:fix/clock-based-time-conditions
Open

sunnysabor wants to merge 1 commit into
apache:masterfrom
sunnysabor:fix/clock-based-time-conditions

Conversation

@sunnysabor

Copy link
Copy Markdown
Contributor

Problem and change

TimeBefore and TimeAfter use the gateway clock when the condition has no parameter name. The shared predicate factory currently returns false before calling either judge if parameter extraction returns an empty value. For example, a nameless time condition with a header parameter type yields an empty request value and never reaches the clock comparison.

Let both time judges evaluate when the parameter name is null or empty, matching their existing clock-mode check. Time conditions with a named request parameter still require a non-blank value. Other operators retain their existing behavior.

This follows up on #6555 and #8357, which addressed behavior inside the time judges.

IssueSpec

IssueSpec-Mode: lightweight
IssueSpec-Reason: This change restores the time judges' existing clock-based behavior through the shared predicate factory, using the current configuration and APIs.
IssueSpec-Validation: The factory regression failed on master at 037d6f1 and passed with the patch. The 11-module reactor passed with ./mvnw -B -ntp -o -pl :shenyu-plugin-base -am test, including Checkstyle. The plugin-base module passed Apache RAT, and the branch diff passed git diff --check. The full repository install and deployed gateway tests were not run.

  • Read the contribution guidelines.
  • Added regression coverage for both time operators and the named-parameter controls.
  • Production code follows the repository code quality rules.
  • Ran ./mvnw clean install -Dmaven.javadoc.skip=true.

@Aias00 Aias00 left a comment

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.

Stream Agent analysis

Targeted fix lets clock-based TIME_BEFORE/TIME_AFTER conditions be evaluated through the shared predicate factory when no request parameter name is configured; adds regression coverage for both operators and named-parameter controls.

Evidence: ["Complete diff attachment (complete_diff=true) read in full: PredicateJudgeFactory.java reorders the blank-realData guard and adds usesCurrentTime(), exempting TimerBefore/TimerAfter judges with an empty paramName from the early false so clock-mode comparison runs; named-param conditions and BlankPredicateJudge behavior are unchanged, and instanceof on a possibly-null judge is safe.","PredicateJudgeFactoryTest.java adds testClockBasedTimeConditionsWithoutRequestValue covering both operators with null/empty paramName and null/blank realData (assertTrue) plus named-param controls (assertFalse).","CI metadata: 70 checks, diagnosis CI_PASSED, no failed checks (also confirming the new judge class references compile); no tests were executed by this review. Supplementary source-file reads were unavailable, but both complete file patches were present in the attachment."]

Next steps: []

Verdict: PASS; publication: APPROVE (EXPLICIT_PASS)

Findings: []

Scope: captured GitHub evidence only; no local tests were executed.

Task: abbda943-a014-4ac4-aafc-f67dcc8a4a7f Commit: 33032a0827479a9970690aeab88d019c4555c2b5

This branch has not been deployed

No deployments
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.

2 participants