Skip to content

fix(codegen): skip assertions that depend on an unmapped do-step#191

Merged
MattDevy merged 1 commit into
mainfrom
fix/es-functional-assertions
Apr 17, 2026
Merged

fix(codegen): skip assertions that depend on an unmapped do-step#191
MattDevy merged 1 commit into
mainfrom
fix/es-functional-assertions

Conversation

@MattDevy
Copy link
Copy Markdown
Contributor

Summary

  • Fixes the FAIL: expected queries = [object Object] and FAIL: expected acknowledged = true failures in the ES functional matrix.
  • Root cause: when a do step is skipped because the CLI action isn't registered (or its catch clause is unsupported), $RESPONSE is stale or empty — but the generator still rendered the downstream match / is_true / set / comparison steps, which then asserted against wrong data.
  • renderSteps now tracks whether the most recent do produced a response. Assertions/set steps that follow a skipped do are emitted as skip-comments instead of real commands, until the next executed do resets the response. renderDo returns 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 lone match after the unmapped esql.list_queries is now commented out.
  • test/functional/es/ingest/10_basic.sh — four orphan assertions are skipped; the real ingest simulate step and its .docs check still run.

Stack

Based on #190 which is based on #187. Merge order: 187 → 190 → this.

Test plan

  • npm run test:unit green (two new tests: one asserts orphan assertions are skipped, one asserts assertions after a mapped do still render)
  • Regenerate against ES 9.1.0 locally and confirm both target scripts no longer emit the spurious FAIL lines
  • Buildkite ES matrix shows zero expected queries = [object Object] or expected acknowledged = true failures

@MattDevy MattDevy requested a review from margaretjgu April 17, 2026 14:33
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 2.62s
✅ REPOSITORY gitleaks yes no no 8.17s
✅ REPOSITORY git_diff yes no no 0.04s
✅ REPOSITORY secretlint yes no no 1.91s
✅ REPOSITORY trivy yes no no 13.66s
✅ TYPESCRIPT eslint 2 0 0 2.24s

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

Base automatically changed from fix/codegen-invalid-bash to main April 17, 2026 14:50
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
@MattDevy MattDevy force-pushed the fix/es-functional-assertions branch from 50a74cc to a31e4c3 Compare April 17, 2026 14:57
@MattDevy MattDevy merged commit 91c8e34 into main Apr 17, 2026
18 of 19 checks passed
@MattDevy MattDevy deleted the fix/es-functional-assertions branch April 17, 2026 15:00
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.

ES functional tests: assertion failures in esql/30_queries.sh and ingest/10_basic.sh

1 participant