Skip to content

fix(plugin): preserve dynamic candidate matching after cache warmup - #8106

Merged
Aias00 merged 2 commits into
apache:masterfrom
yangjj-iso:feat/7981-positive-match-cache
Oct 26, 2026
Merged

Aias00 merged 2 commits into
apache:masterfrom
yangjj-iso:feat/7981-positive-match-cache

Conversation

@yangjj-iso

@yangjj-iso yangjj-iso commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7981.

A path cache can retain a generic selector or rule and bypass a competing condition that would win for a later request on the same path. Require the entire enabled candidate set to be path-determined before storing a positive result.

Validation on Microsoft OpenJDK 17.0.18 through mvnw.cmd:

  • All 14 execution-path regressions/controls pass: six header/query/method selector/rule cases, two URI-only/disabled-candidate controls, four deterministic time-boundary cases and two rewritten-path cases. Removing the respective fixes reproduces the six dynamic, four timed and two rewritten-path failures; the URI-only controls pass.
  • The complete 11-module affected reactor passes unit tests and Checkstyle, including all 320 shenyu-plugin-base tests, with zero failures/errors/skips in that module.
  • Apache RAT passes across the affected reactor; git diff --check passes.

Tests use real BaseDataCache, MatchDataCache and matching, Spring mock exchanges, and a controlled clock for time predicates. No deployed gateway or Docker E2E run is claimed. The existing Byte Buddy agent was supplied for local Mockito attachment.

  • Regression tests included.
  • Full repository clean install (affected reactor validation is recorded above).

@yangjj-iso
yangjj-iso marked this pull request as ready for review October 26, 2026 03:54

@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.

Approved. This is the correct fix for #7981. getRawPath() now uses the rewritten raw path consistently with matching, and positive caching is gated on every enabled selector/rule being path-determined (the PATH_ONLY_OPERATORS whitelist excludes time predicates such as TimeAfter/TimeBefore and header/query conditions). The 278-line PositiveMatchCacheTest covers header/query/method shadowing, time predicates, and rewritten-URI consistency. Note: #7984 is a duplicate with a correctness gap (it only checks paramType==uri and would still cache TimeAfter/TimeBefore) - recommend closing #7984 in favor of this PR.

@Aias00
Aias00 merged commit 9d07ba0 into apache:master Oct 26, 2026
51 checks passed
@Aias00 Aias00 added this to the 2.7.2 milestone Nov 13, 2026
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.

[BUG] URI-only positive match cache shadows more specific selectors with dynamic conditions

2 participants