Repository navigation
feat(acts): assertion DSL and variable substitution - #61
Merged
JakubWorek merged 1 commit intoSep 9, 2026
Merged
Conversation
JakubWorek
force-pushed
the
jakubworek/acts-assertions
branch
from
September 7, 2026 07:53
37dcf1d to
3a54d9c
Compare
mykytanetipa
approved these changes
Sep 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the two pure layers the runner sits on:
assertions.pyevaluates the DSL against a response,variables.pyresolves{{...}}, reads dot-paths and holds a test's captures. Neither performs I/O.The interesting part is telling an operator map from a path descent. Spec §5.2 makes
expect.bodymirror the response by nesting while §5.4 puts operators in a map, so{status: {state: FOO}}and{type: array, count_gte: 1}have the same syntax. The rule that works is that a key is an operator when it is a known name and its argument is well-formed for that operator. Both halves are load-bearing:{type: array, count_gte: 1, items: [...]}mixes operators with a third key, andREST-PD-001asserts on an RFC 9457 body whose members really are namedtype,titleandstatus. Over the whole corpus this classifies 203 operator keys and 397 field keys, with exactly one - thattype- resolving to a field despite an operator's name.One ambiguity survives and cannot be resolved: a field named
typeexpected to equal the string"string". Nothing in A2A hits it and the format offers no escape, so it is documented rather than handled.itemsis implemented as the single extension operator. §5.1 has no way to say "an array of at least one element whose elements look like X", because one YAML node cannot be both the map operators need and the list §5.2 requires; the corpus needs it anyway and inventsitemsat five sites with JSON Schema semantics. Unlike thecompat.pydefects this one has no spec-legal target to rewrite to, so it lives in the evaluator.Notes
Three choices the spec does not make, all resolved the same way - an assertion must never report success having compared nothing:
anyandall, and passes fornone, which is genuinely satisfied by having no elements.AssertionResult.checkscounts real comparisons, so a caller can tell "passed" from "asserted nothing".MISSINGis a distinct sentinel rather thanNonebecause JSON has null:{exists: true}passes for a present null and{absent: true}fails for it, and only those two operators tolerate an absent value at all.Substitution distinguishes a whole-string reference, which yields the value with its type, from an embedded one, which interpolates - a captured integer has to stay an integer for an exact match.
201 tests.
Failure.as_detail()emits §13.3'sfailure-detaildirectly; the runner suppliesstep_id, the one field this layer cannot know.