Repository navigation
Conversation
…he test endpoint's new call route (experiment) (cherry picked from commit 788952fac01c7326dd349a68563ca4fe426229b1)
…del refusal (cherry picked from commit 0bbbd586127b3c2a0ce6df9b0b5eed6c8efced79)
Covers the pure-Go, runtime-independent logic: ParseCallCases (single object vs array form, missing-flow rejection, invalid JSON) and checkModelNotStale (no deployment, fresh model, and the core safety property — a project/javasource file edited after the build is refused rather than silently tested against the old model). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> (refs mendixlabs#1788)
This branch has not been deployed
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.
Closes #1788
Why
A single-flow logic edit currently costs a full
mxcli testcycle (regenerate test MDL,mxbuild, boot/reload the runtime, run the suite) even though the actual flow-plus-assertion cost, once the app is already running, is a few milliseconds. This adds a second, opt-in route for that narrower case: checking one or a few flows against a live app without touching test MDL files at all.What changed
New command
mxcli test call <cases.json|-> [--repeat N], requires an app already booted withmxcli run --local --test-endpoint:cmd/mxcli/cmd_test_call.go— CLI wiring.cmd/mxcli/testrunner/call.go— case parsing (ParseCallCases, single object or array), stale-model check (checkModelNotStale).cmd/mxcli/testrunner/endpoint.go/endpoint_call.go— newcallroute on the existing test endpoint.Case shape:
{flow, params, setup, expect, throws, rollback}.params/setupbuild objects via$new(create),$find(lookup),$ref(reuse a$named object fromsetup), nested associations inline.expect:[{path, op, value}], evaluated before rollback.pathsupports$result,$<param>, association hops (e.g./Member/Member), andcount:Entity[xpath]for row counts.opis= != < <= > >= contains isnull notnull.throwsasserts the flow raised.This reuses the existing
--test-endpointtransaction-and-rollback machinery (Core.microflowCall) and the sameknown.contains(flow)microflow allowlist the pre-existingrunroute already enforces — it is not a new security surface, just a second entry point into the same gated mechanism.The all-or-nothing diff is purely additive: 5 files, 744 insertions, 0 deletions — no existing code path is touched.
How tested
Unit:
→
ok github.com/mendixlabs/mxcli/cmd/mxcli/testrunner 13.442s, all green, including 2 new tests (TestParseCallCases...,TestCheckModelNotStale...) plus the full pre-existing suite (watch-loop, stale-flow, mtime tests) unaffected.Real app (
~/mta-lab/w/rt1, E1 procurement domain, 8 pre-existing cases — 5x invoice pay/approve/dispute, 2x price/qty matching, 1x ERP posting), each step's 1-minute load average fromuptimenoted:@expect(mutated expected value on case 120-1)ACT_Invoice_Payspliced to skip a status check) +mxcli run restartactual: PAIDwhereAPPROVEDwas expectedInvoice(count=1, pre-rollback); independent call B counts the same rowError: the model changed after the running app was built (...) a call now would test the OLD model and could report a stale green[CE1613];run restartreportsfailed: initial build failed; call never reachable — never a false green--repeat 20, 8 cases/round--repeat 20run)Repro commands:
Regression evidence
Diff touches only the 5 new/extended files listed above — no existing
run/testcode path is modified, confirmed viagit diff --stat origin/main...HEAD. Fullcmd/mxcli/testrunnersuite green before and after on this branch.Known limitation
Additive and opt-in: does not replace file-based
mxcli test(no test discovery, no watch mode of its own — seemxcli test --watch, #1786, for that loop). Requires an app already booted with--test-endpoint.Checklist
go test ./cmd/mxcli/testrunner/...green🤖 Generated with Claude Code