Skip to content

recorded(match): evaluate on the engine (verify includeRequests) so repeated-key and JSON-body array rules (rift#1553/#1579) match - #350

Merged
EtaCassiopeia merged 1 commit into
masterfrom
fix/rift-337-recorded-match-on-engine
Oct 28, 2026
Merged

EtaCassiopeia merged 1 commit into
masterfrom
fix/rift-337-recorded-match-on-engine

Conversation

@EtaCassiopeia

Copy link
Copy Markdown
Collaborator

Closes #337

Why

Imposter.recorded(RequestMatch) and Space.recorded(RequestMatch) filtered the journal with PredicateEvaluator, a JVM copy of Mountebank's predicate rules. On rift 0.24.0 it disagrees with the engine on:

  • repeated query keys and headers (rift#1553);
  • JSON-body objects and arrays, null, number spelling and missing fields (rift#1579);
  • inject predicates, which it threw on.

This is the third time it has drifted (#330, #335). The triage comment on #337 explains the decision.

What

  • recorded(match) makes one POST /imposters/:port/verify call with includeRequests (embedded: rift_verify) and returns the engine's matches in journal order. A space adds its flowId. A non-recording imposter still gets an empty list.
  • A verify reply missing the requested requests array is a CommunicationError rather than a silent empty list (RecordedRequests.readMatched).
  • PredicateEvaluator is no longer called. It is @Deprecated(since = "0.3.8", forRemoval = true). rift-scala excludes it in FacadeCoverage.
  • Docs: the recorded(match) javadoc on Imposter/Space and docs/design/sdk-api.md (§§ verify, match grammar table).

Tests

  • New RecordedMatchOnEngineTest (4 tests):
    • the literal verify body for an imposter and for a space;
    • no journal fetch;
    • engine order is kept;
    • an empty result;
    • a reply missing requests is an error.
  • VerifyIntegrationTest: two tests that pinned the client-side filter now assert the engine call. The obsolete client-filter case was removed from SpaceRecordedTest.
  • New RecordedMatchArraysIT (live, all lanes), checking seven rules from 0.24:
    • query array subset;
    • query deepEquals multiset;
    • scalar matches any value of a repeated key;
    • body array subset;
    • 1.0 matches 1;
    • a missing body field reads "";
    • array expectation over a repeated header.
  • Local runs: full verify on engine v0.24.0 (macOS arm64, JDK 21) passed on SPAWN and EMBEDDED, XPathRecordedMatchIT included.

🤖 Generated with Claude Code

…rules apply

recorded(match) filtered the journal with a JVM copy of Mountebank's
predicate rules. That copy drifted from the engine three times (#330,
#335, and rift 0.24.0's repeated-key and JSON-body array rules), so a
filter could disagree with what the engine matched. It now asks the
engine's verify with includeRequests, as verify itself does since #127:
one call, the engine's answer, and inject predicates work too.

PredicateEvaluator is no longer called and is deprecated for removal.

Closes #337
@EtaCassiopeia
EtaCassiopeia merged commit b56d439 into master Oct 28, 2026
32 of 34 checks passed
@EtaCassiopeia
EtaCassiopeia deleted the fix/rift-337-recorded-match-on-engine branch October 28, 2026 00:20
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.

recorded(match): evaluate on the engine (verify includeRequests) so repeated-key and JSON-body array rules (rift#1553/#1579) match

1 participant