Skip to content

refactor(modules): thread a MatchContext through the matcher engine - #379

Open
TBX3D wants to merge 1 commit into
vmfunc:mainfrom
TBX3D:lane/match-context
Open

refactor(modules): thread a MatchContext through the matcher engine#379
TBX3D wants to merge 1 commit into
vmfunc:mainfrom
TBX3D:lane/match-context

Conversation

@TBX3D

@TBX3D TBX3D commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

checkMatchers and checkMatcher take (resp, body), so a matcher type that needs anything else, the request url, how long the round trip took, extractor output, forces another signature change through 13 call sites.

collect that per-response state into a MatchContext built once at each of the two call sites, single request and chain step, and thread it instead. the classic matcher types read Resp and Body exactly as before and their tests are unmodified. extraction does move above the matcher check in executeHTTPRequest so an expression can read extractor values; runExtractors has no side effects and the finding is still only built on a match, so the order change is not observable.

checkMatchers/checkMatcher took (resp, body), so every matcher type that
needs anything else (the request url, how long the round trip took,
extractor output) forces another signature change through the whole engine
and all of its callers.

collect the per-response state into a MatchContext built once at each of the
two call sites (single request and chain step) and thread that instead. no
matcher behavior changes: the classic types read Resp and Body exactly as
before.

extraction moves above the matcher check in executeHTTPRequest. runExtractors
is side-effect-free and the finding is only built on a match, so the order is
behavior-preserving, and it lets a matcher read extractor values from the
context. in a chain step the context carries the running variable set, so a
matcher there also sees earlier steps' values.
@TBX3D
TBX3D requested a review from vmfunc as a code owner July 31, 2026 02:30
@github-actions github-actions Bot added size/m <200 lines changed modules changes to scan modules tests test changes labels Jul 31, 2026
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@a38ba0a). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #379   +/-   ##
=======================================
  Coverage        ?   64.94%           
=======================================
  Files           ?       88           
  Lines           ?     7874           
  Branches        ?        0           
=======================================
  Hits            ?     5114           
  Misses          ?     2368           
  Partials        ?      392           

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

Copy link
Copy Markdown

pr summary

6 files changed (+63 -30)

category files
go source 6
tests 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modules changes to scan modules size/m <200 lines changed tests test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants