Repository navigation
Conversation
…ests and mxcli are unchanged A local test run injects the test microflows, builds with mxbuild and boots. For an unchanged project, unchanged test files and an unchanged mxcli the injected model is the same as last time, so the deployment left in <project>/deployment is already the build this run would produce. The key is a content hash, never a timestamp: every file of the project folder (minus output/cache dirs), the generated endpoint and test microflow text, the mxcli executable and the mxbuild override. The record also pins the identity of deployment/model/model.mdp, so a build made by anything else in that folder (run --local, mxbuild by hand) is never taken for ours. Any doubt means a normal build.
…stale-model refusal Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
mendixlabs#1782) mxbuild rewrites theme-cache/web/theme.compiled.css on every build with a non-deterministic cache-busting query string on each font/asset url(), even with zero theme or model changes. Without this exclusion the hash key never repeats across two separate 'mxcli test' invocations on any app using the Atlas Core theme, so --reuse-build silently rebuilt every time and never paid for itself. Found by running --reuse-build twice in a row against a real app and seeing it rebuild both times; re-verified after the fix (reuse hit: 12.15s vs ~60-67s miss). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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 #1782.
What
Adds
mxcli test --reuse-build. On a repeatmxcli testrun, if the projecttree, the generated test-endpoint/test-microflow MDL, the mxcli executable
and the mxbuild path/flags all hash to the same key as the build currently
on disk (pinned to
deployment/model/model.mdp's identity so a build madeby anything else is never mistaken for ours), skip injection and the
mxbuildrebuild and boot straight from the existingdeployment/.--constantvalues are runtime configuration, not model, so differentconstants don't invalidate reuse.
Why
Repeat
mxcli testruns during iterative test-writing pay a fullinject+mxbuild+boot cycle every time, even when only a test file changed
and the model is untouched.
Real-app numbers (with denominators)
Measured against a copy of a real ~280MB Mendix app
(
~/mta-lab/w/r1test, 14 tests across 3.test.mdlfiles), machine loadnoted at each measurement (1-minute load average). An earlier pass on this
same app was re-run after it turned out that pass had not recorded load,
and the machine was later found to be running at load 44-58 from unrelated
concurrent sessions during parts of this work — the numbers below are the
re-confirmed ABAB set, captured while load was climbing back from a 13.38
trough (13-32 band throughout, well below the 44-58 band seen elsewhere):
--reuse-build)--reuse-build, no build recorded yet (builds)--reuse-buildsteady-state hit--reuse-buildsteady-state hit (repeat)5.5x reduction (66s rebuild vs 12s reuse hit) in the "I changed a test, not
the model" loop, 14/14 green on every run.
A real bug found and fixed during this work
The first working version did not exclude
theme-cache/from the hashedproject tree.
mxbuildrewritestheme-cache/web/theme.compiled.cssonevery build with a non-deterministic cache-busting query string on every
font/asset
url()(Atlas_Styling.ttf?<token>), even with zero theme ormodel change. Because that file lives inside the project tree, it was
counted as a build input — so the hash key never repeated across two
separate
mxcli testinvocations on any app using the Atlas Core theme(effectively all of them), and
--reuse-buildwas a complete no-op on realapps despite passing synthetic unit tests. Fixed by adding
theme-cachetothe skip-dir set; re-verified on the real app (12.15s reuse hit vs the prior
~60-67s miss on every single call).
How it was tested
cmd/mxcli/testrunner/reusebuild_test.go:go test ./cmd/mxcli/testrunner/... -run 'TestHashProjectTree|TestReusableBuild|TestTestBuildKey|TestForgetBuild|TestRecordBuild' -v→ all PASS.scope):
@expect→ red;--reuse-buildof that build stays red;restoring the file → rebuild, green.
affected test;
--reuse-buildreuses that red build, stays red;reverting the bug → rebuild, green.
return) → build failscleanly, never reports a pass.
deployment/model/model.mdp→ correctly detected as stale (identity mismatch), falls back to a
full rebuild.
whether to skip inject+build+boot; it never touches
execution/assertion/rollback behavior.
Known limitation (not a bug)
Interleaving a plain (non-
--reuse-build) run between two--reuse-buildruns invalidates the chain: the plain run's own inject-then-cleanup
round-trip changes the project tree enough that the following
--reuse-buildcall correctly (safely) misses and rebuilds — the intendedfail-safe, but it means strict alternation between the two modes never
shows the steady-state number, only sustained
--reuse-builduse does.Checklist (CONTRIBUTING.md)
make buildsucceedsmake lintpassesmake test— unit tests for the touched package pass; full-reposuite run is in progress (will update before marking ready for
review)
only mxcli's own test-runner build-reuse decision, not generated MDL,
BSON serialization, or any entity/microflow model shape
Marked as draft until the full
make testrun is confirmed green andCI passes.
🤖 Generated with Claude Code