fix(codegen): skip assertions that depend on an unmapped do-step#191
Merged
Conversation
✅MegaLinter analysis: Success
See detailed reports in MegaLinter artifacts MegaLinter is graciously provided by OX Security |
3 tasks
Assertions (match/is_*/length/comparison/contains) and `set` steps read $RESPONSE, which is written by the preceding `do`. When a do-step is skipped — because the CLI action isn't registered or the catch clause is unsupported — $RESPONSE is stale or empty, so downstream assertions would run against the wrong data and emit spurious failures like: FAIL: expected queries = [object Object] FAIL: expected acknowledged = true renderSteps now tracks whether the most recent do produced a response and emits a skip-comment for any assertion/set that follows a skipped do, until the next executed do resets the response. renderDo returns a boolean so the caller knows whether to trust $RESPONSE. Closes #189
50a74cc to
a31e4c3
Compare
Merged
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
FAIL: expected queries = [object Object]andFAIL: expected acknowledged = truefailures in the ES functional matrix.dostep is skipped because the CLI action isn't registered (or itscatchclause is unsupported),$RESPONSEis stale or empty — but the generator still rendered the downstreammatch/is_true/set/ comparison steps, which then asserted against wrong data.renderStepsnow tracks whether the most recentdoproduced a response. Assertions/setsteps that follow a skippeddoare emitted as skip-comments instead of real commands, until the next executeddoresets the response.renderDoreturns a boolean so the caller knows whether to trust$RESPONSE.Closes #189.
Scripts previously failing, now clean
test/functional/es/esql/30_queries.sh— the lonematchafter the unmappedesql.list_queriesis now commented out.test/functional/es/ingest/10_basic.sh— four orphan assertions are skipped; the realingest simulatestep and its.docscheck still run.Stack
Based on #190 which is based on #187. Merge order: 187 → 190 → this.
Test plan
npm run test:unitgreen (two new tests: one asserts orphan assertions are skipped, one asserts assertions after a mappeddostill render)expected queries = [object Object]orexpected acknowledged = truefailures