How to build MR Moqui from source, the build packages and their features, the ./moq tasks, the Rust tests and lints,
and running the component specs of moqui test. Running and deploying are in Run-Deploy. The
JavaScript test APIs are in JS-Testkit (the server specs of moqui test),
JS-Test-Client (the specs that test a running server from outside) and
JS-Test-Load (load scripts).
- Build: Windows, native code and C libraries
- Packages: features, profiles, the embedded Postgres archive, the embedded runtime and programs, the instance archive, build cost, the compile cache, the desktop app, the Android app
- The moq script
- Validation: before a commit, reading the results, before a release
- Rust tests and lints
- Component specs: running, files and order, a spec file (the API is in JS-Testkit), agent evaluation
Prerequisites: Rust 1.99 or newer (rustc --version; quickjs-oxide declares 1.99, and rust-toolchain.toml pins
1.100.0) and bash, on Linux, macOS, or Windows (Windows has what a Windows build needs). A build with
embedded Postgres embeds the 18.6.0 archive that scripts/pg-payload.sh strip downloads once and strips of psql (it
links GPL readline); ./moq build runs that when the archive is missing. A fresh checkout needs Node 22.13 or later (22 or 24 LTS) and its bundled npm for ./moq build-js; the CI image uses Node
24.22.3 and npm 11.19.1.
The two npm projects install from exact locks with lifecycle scripts disabled. Each build checks the installed assets against
the reviewed manifest. ./moq verify-js rebuilds independently. audit-js checks the lockfiles and the dependency
versions inlined in copied library files (BUNDLED_COPIES in build/libs/manage.mjs). outdated-js compares each
pin with the registry, and update-js <package> <version> refreshes assets and notices. update-js --all takes the
newest release each ^pin admits, so a new major version is always its own update-js. Review the lock, manifest
and license changes together. Updates normally observe a 14-day cooldown. A reviewed security fix may use --security.
The server and the regression test runners use the built files directly.
./moq fonts-download --list shows the optional font packs. Add packs by name or remove them with --remove.
MOQUI_FONT_PACKS (a comma- or space-separated list) overrides the selection saved in this checkout. Every installed
pack ships in archives, embedded production runtimes and client apps. Xiaolai is in excalidraw-cjk; boards use
the viewer's system CJK face by default. The cjk, arabic, devanagari and cyrillic-greek packs provide
Unicode-range Noto faces for the shell.
./moq build # Maximal with the dev tools, target/release/moqui; --lite, --debug or
# --enterprise for the others; links any component crates in runtime/components/addon
scripts/pg-payload.sh strip # once: the Postgres archive the binary embeds, without psql
cargo build -p moqui # Debug, every feature: target/debug/moqui
cargo build --profile lite --no-default-features -F lite -p moqui # Lite: target/lite/moqui
cargo build --release -p moqui # Maximal with the dev tools: target/release/moqui
scripts/pg-payload.sh check # before a distribution: no psql or readline in what is embeddedTasks that run moqui build a missing binary themselves. ./moq build also links the crates of native components
(Native-Components), which plain cargo build does not.
The vault's browser module (crates/moqui-vault built to wasm32-unknown-unknown, served as the webroot's
js/vault/moqui_vault.wasm; Vaults) is not kept in git. scripts/vault-wasm.sh
builds it on demand, into target/vault-wasm and then the webroot, with a stamp beside it (moqui_vault.wasm.json)
that records what it was built from: the crate's sources, its workspace dependency lines, the Cargo.lock entries it
links, the release profile and rustc -V. A run with none of those changed builds nothing and takes well under a
second; --check only says whether it is missing or stale (exit 1), and --force builds it anyway. Its one tool
dependency beyond the toolchain is the wasm32-unknown-unknown target, which the script adds with rustup target add
for the toolchain rust-toolchain.toml pins when it is missing; without rustup it says what to install. ./moq build
(every package and --embed level) runs it before cargo, as do ./moq archive, podman/build.sh, the test and
accept tasks (once for the suites they start) and the tasks that run moqui with --nobuild (where a failure is only a
warning). A plain cargo build does not: run the script first for a build with the production or all runtime built
in, which refuses to build without the module (Embedded runtime and programs). Where
the module is missing, the vault screens answer that it is not built and the VaultModule client spec fails saying
so. The desktop and mobile shells will carry their own copy (plans/Vault-Instances.md §3.6); a shell build that
bundles it runs the script first.
The JS tasks build every component that has a build/js-build.json; the webroot's is the framework's own, built
first. build-js, verify-js, audit-js and outdated-js take component names to do only those. One component
that fails is reported and the others still build, and the task fails. update-js --component <name> updates
another component's pins.
{ "output": "screen/MyApp/libs", "projects": ["main"], "script": "build.mjs" }output, under the component'sscreen/, is where the built files go and so where the screens serve them (a file under a screen's directory, Static files). ItsMANIFEST.jsonis committed and lists each file's sha256. The rest is build output, which the component's own repository ignores:screen/MyApp/libs/*,!screen/MyApp/libs/MANIFEST.jsonandscreen/MyApp/.libs-*in its.gitignore.projectsare npm projects underbuild/, each with a committedpackage.jsonandpackage-lock.json(exact pins).script, underbuild/, makes the files../moqruns it asnode <script> --build,--verifyor--write(update-jsregenerates the manifest with--write), withJS_CACHE(its temporary trees, undertarget/js/<component>),JS_OUTPUT(the output directory) andJS_PROJECTS(where the locks are, whenupdate-jshands it candidate ones). It imports the framework'sruntime/components/base/webroot/build/js-kit.mjsby relative path:installProjectinstalls a lock with lifecycle scripts disabled,withWorkgives it a temporary tree that is removed afterwards, andfinishchecks every output againstMANIFEST.jsonand publishes the tree in one rename.
The checks are the same as the framework's: a build serves only the reviewed bytes, an embedded production binary refuses a component whose listed files are missing, and the server logs them at startup.
./moq add-js search my-app lodash
./moq add-js versions my-app lodash-es
./moq add-js prepare my-app round lodash-es/round.js 4.18.1 both
./moq add-js apply my-app <review-id>
./moq verify-js my-appPrepare prints JSON with the review token, source diffs, bundled packages and output sizes. It creates the first
declaration, npm project and ignore rules when needed. Apply checks the candidate against the files on disk. A stale
review needs a fresh prepare. Commit the build inputs, manifest and notices. A server-target prepare or update uses
an already built moqui check-js-module to initialize the module on a bounded standalone QuickJS runtime. Set
JS_VALIDATOR to the path of the current binary if it is outside the checkout's target directory.
For the standard builder, omit script, use the project libraries, and declare its entries in libraries:
{ "output": "screen/my-app/libs", "projects": ["libraries"],
"libraries": [{ "id": "round", "entry": "lodash-es/round.js", "targets": ["server", "client"] }] }The server file lives at component://my-app/script/libs/round.js. A client bundle registers its exports in
moqui.libraries["my-app/round"]. Each manifest file records its target and hash. Existing custom builders can import
buildLibraries from the webroot's build/component-libs.mjs and use the returned target-qualified files in their
own build. The managed add operation uses the standard declaration. Run
node --test scripts/test-component-libs.mjs for the standard builder's target, policy, review and recovery fixtures.
- Toolchain. The host is
x86_64-pc-windows-msvc. Visual Studio Build Tools supplies the C compiler (the "Desktop development with C++" workload; aws-lc and QuickJS compile C, and the embedded Postgres binaries load that workload'sVCRUNTIME140.dll), and Git for Windows supplies bash. From PowerShell or cmd,moq.cmdrunsmoq; the binary istarget\release\moqui.exe. moq test. The scratch runtime links its component directories with directory junctions, so the run does not need Developer Mode.- NASM. The first build that needs it downloads NASM 3.02 to
%USERPROFILE%\.moqui\nasm(aws-lc assembles with it). SetMOQUI_NASMto a directory that containsnasm.exe, or tonasm.exeitself, to use that copy instead. Acargo buildthat does not go throughmoqstill needs NASM onPATH. - NASM may no longer be needed (to check on Windows). What needed it was the second copy of aws-lc-sys, the one
mail-auth built with its default features off. AWS-LC is now built once (Native code and C
libraries), and that one aws-lc-sys has the
prebuilt-nasmfeature aws-lc-rs turns on: on Windows x86-64 it links the objects it ships whenevernasmis not onPATH. To check, with no NASM onPATH:cargo clean --release -p aws-lc-sys, thenMOQ_NASM_CHECKED=1 ./moq build(the variable skipsmoq's NASM step). If that builds,scripts/nasm.sh,ensure_nasminmoqand these NASM notes can go. - Debug info. The dev profile keeps debug info unpacked in the object files (Profiles), which is
not a Windows option, and cargo has no per-target profile, so
moqsetsCARGO_PROFILE_DEV_SPLIT_DEBUGINFO=packedon Windows (a PDB beside the binary). A devcargo buildorcargo testthat does not go throughmoqneeds that variable set too.
MR Moqui stays in memory-safe Rust as far as it can. That also keeps the build and the deployment the same on every platform.
- No JIT. The script engine, quickjs-oxide, interprets its bytecode and forbids
unsafein every crate. Generated machine code would make the code generator responsible for the engine's memory safety, and needs executable memory, which iOS refuses and macOS allows only with an entitlement. Heavy work in scripts moves to framework APIs or native services instead (Practices-App-Dev). unsafeonly where nothing else works, such as a foreign-function boundary (the browser build's exports), with the reason beside it.- No C libraries in new dependencies. Choose a pure-Rust crate, or a crate's pure-Rust backend.
cargo tree -e build -i cclists the crates that compile C. The exceptions:
| Library | For | Why |
|---|---|---|
AWS-LC (aws-lc-sys, through aws-lc-rs) |
Crypto: rustls (every TLS connection), SSH (russh), certificates (rcgen), WebRTC (str0m), DNSSEC (hickory), DKIM and ARC (mail-auth), and the framework's own signatures | Vetted constant-time C and assembly, the provider rustls defaults to. It is the one crypto library, built once: deny.toml refuses ring and a second aws-lc-sys, and a dependency that brings either is forked (Forks), pinned or replaced |
jemalloc (tikv-jemallocator) |
The binaries' global allocator, not on MSVC | 5 to 15% off script-heavy rows (Profiling Round 37); the alternatives are C too |
SQLite (rusqlite, bundled) |
The local databases of moqui-client and moqui-browser; not the server | No pure-Rust database matches it yet. Public domain; the browser build compiles it to WebAssembly |
| CEF, GTK 4, the system WebViews | The desktop and mobile app shells (Tauri) | A desktop or mobile UI runs on the platform's |
Programs that run as their own processes are not linked and are outside this list: the embedded Postgres, OpenSearch
and Chromium for PDF (built in only as their archives, Embedded runtime and programs),
and the system ssh for git remotes.
One dependency is pinned by rev to a branch of moqui's fork, as quickjs-oxide is, because it does not keep ring out
through a feature; others are held at moqui's fork by [patch.crates-io], for every crate that depends on them. The
branch is our commits on the release we use; each pr/ branch is one of them on upstream's own branch, for a pull
request. Go back to the crates.io release once upstream publishes the change, as rsipstack did
with 0.8.5.
| Crate | Fork and branch (pr/ branch) |
Change |
|---|---|---|
| mysql 28.0.4 | moqui/rust-mysql-simple moqui/28.0.4-no-webpki (pr/no-webpki-0.22) |
rustls no longer pulls webpki 0.22 (unmaintained, links ring) for two error types: TlsError::InvalidDnsName holds rustls's own error, and the unused TlsError::Pki is gone |
| stun-proto, stun-types 2.0.5 (through turn-server-proto) | moqui/stun-proto main (moqui-nonce-bound), by [patch.crates-io] |
A change to LongTermServerAuth's nonce handling, to be offered upstream. Both crates come from the fork's workspace so the graph has one stun-types |
| yrs 0.28.2 (moqui-collab) | moqui/y-crdt moqui/0.28.2-decode-bounds (pr/any-decode-depth, pr/decode-reserve-bounded), by [patch.crates-io] |
Any::decode reads at most 128 levels of maps and arrays, so a co-editing update nested deeper is refused, not a stack overflow (SEC-TLS-95); a length read from an update or a state vector reserves at most 1024 entries up front (SEC-TLS-117). Both are upstream's issue #675 |
Moving a pin: push the fork's branch first, then change the rev in Cargo.toml and run cargo update -p <crate>.
Cargo takes [patch.crates-io] only from the root manifest of the workspace it builds, so a crate that is a workspace
of its own and builds the framework names the patches again: crates/moqui-desktop/Cargo.toml holds a copy of the
table, and the crate ./moq build generates for add-on component crates (target/moqui-app) copies the root's as it is
written. A patch added, moved or dropped changes the desktop's copy too; crates/moqui-client/tests/app_workspaces.rs
fails until it does (SEC-CLI-126).
A moqui binary is built as one of five packages, plus the browser build. They differ in the Cargo features they turn
on (what the binary can do), the Cargo profile they build with (how it is compiled), and where the binary lands.
./moq build picks one with a flag; every task that runs moqui (run, load, test, save-db, ...) takes the same
flag and uses that binary. moqui version prints a binary's package and features.
| Package | ./moq flag |
Profile | Binary | What it has |
|---|---|---|---|---|
| Lite | --lite |
lite |
target/lite/moqui |
The web server on embedded Postgres, PDF (through Chromium), outbound mail (SMTP), the terminal client (moqui tui) |
| Debug | --debug |
dev |
target/debug/moqui |
Every feature and the dev tools, unoptimized framework code with debug info |
| Maximal | (none) or --release |
release |
target/release/moqui |
Every feature, Postgres embedded, and the dev tools (devtools) |
| Enterprise | --enterprise |
enterprise |
target/enterprise/moqui |
Every feature, with the databases external (Postgres and MySQL drivers, no embedded Postgres) |
| Browser | scripts/wasm-build.sh [--release] |
dev / release |
target/browser/wasm-pkg/<profile> |
The framework on SQLite in a Web Worker; none of the optional features |
On Windows each of those binaries is moqui.exe (target\release\moqui.exe for Maximal).
Plain cargo build -p moqui, cargo test and cargo lint use the Maximal feature set with devtools, so they cover
everything.
Maximal is the default, with the dev tools: development wants git, SSH and the dev-aide, and one default build with
everything is simpler than a smaller one that saves some build time. The dev tools act only on a dev instance
(design-dev-aide 3.3); a deployment that wants none builds Lite or Enterprise.
./moq build --lite -- --features devtools adds them to Lite. (A Dev package, Lite with git, SSH and the dev tools on
a develop profile, was the default before; it is commented out in moq, .cargo/config.toml and the crates'
features, and likely to be removed.)
The framework features are in crates/moqui-core; the host features, and the packages, are in crates/moqui-host;
crates/moqui (and the crate ./moq build generates in target/moqui-app for add-on component crates) forwards the
package features lite, enterprise and maximal, devtools, and inbound-smtp for a lite build that wants
one. The agents are the moqui-llm crate, on moqui-core, which the host's llm feature links; core reaches them
through moqui_core::llm_hooks, so in a binary without them their services report that llm is not built in. The
framework crates above core (Crate-Split: moqui-git, moqui-mail) are linked the
same way by a host feature (git; smtp, with imap turning on the mail crate's own), and core reaches them through
moqui_core::extension; moqui-report, moqui-collab, moqui-tools, moqui-dav and moqui-devkit are five more, linked in
every host build (the host's xlsx turns on the report crate's own, for the xlsx format of a scheduled report, and its
devtools the dev kit's watch, the file watcher), and the browser build links the reports and moqui-dav (the VCard
and ICalendar tools, elFinder) but not co-editing, the Tools app's database services or the dev kit. The entity facade is the moqui-entity crate below core, in every package and in the browser
build, with no features of its own.
| Feature | Crate | What it gates | Lite | Enterprise | Maximal |
|---|---|---|---|---|---|
axum |
host | The HTTP server, its listeners and routes; HTTP/2 by ALPN on the HTTPS listener; the cluster port | yes | yes | yes |
postgres |
host (moqui-drivers) |
The Postgres driver | yes | yes | yes |
embedded-postgres |
host (moqui-drivers) |
The embedded Postgres clusters (entity, search, sim), save-db, load-save, backups, and moqui test when it opens a database (--db fresh, snapshot, or existing). --db none does not need it |
yes | yes | |
mysql |
host (moqui-drivers) |
The MySQL driver | yes | yes | |
pdf |
host | The DevTools client of the external Chromium that prints html-print to PDF |
yes | yes | yes |
ssh |
host | The SFTP client, the built-in SSH server (SFTP, admin shell, git over SSH, and apps with tui), the SSH cluster channel |
yes | yes | |
sso |
host | OIDC and OAuth 2 logins (org.moqui.sso.AuthServices) |
yes | yes | |
print |
host | Network printing over IPP (moqui-cups) |
yes | yes | |
tui |
host | moqui tui, the terminal client of the tui render mode, on Revue (TUI), and with ssh the SSH apps command; in lite too, for a quick terminal loop while developing and testing. Alone (cargo build -p moqui-host --no-default-features --features tui) it is the client of a running server, moqui tui --server <url>, with no database driver or HTTP server in the build |
yes | yes | yes |
test-client |
host | moqui test-client: a component's test/client specs against a running server, over HTTP, raw TCP or TLS, WebSocket and headless Chromium, with a load runner (JS-Test-Client), and moqui test-load, a component's test/load scripts (Load-Runner), and the server side of Tools › Load; the two commands open no database and bind no listener of their own, so any package can test any server. Its --serve starts moqui test --serve, which needs embedded-postgres |
yes | yes | yes |
inbound-smtp |
host | The SMTP listener for hosted and shared mail accounts behind the edge gateway (Mail-Inbound; includes imap); it starts only when smtp-server@listen-port is set |
yes | yes | |
rtc |
host (moqui-rtc) |
Calls: the media socket and its SFU on str0m, and the call signaling on /notws (WebRTC); the media socket starts only when media-server@port is set, and the call services run in every build (without it they refuse with mediaUnavailable). In Debug too |
yes | yes | |
speech-local |
host | Local speech to text for call captions (Whisper on candle, WebRTC): not built yet, so off in every package; with or without it moqui_conf__calls__captions__provider=local answers "not built in". Captions go through the llm feature's transcribe model meanwhile |
|||
sip |
host (moqui-sip; includes rtc) |
Phone calls over SIP trunks: the SIP engine on rsipstack, its trunk registration and the RTP of phone legs, joined to the call media (SIP); it starts only when sip-server@port or sip-server@tls-port is set, and the voice services run in every build (without it get#VoiceCapabilities says not supported). In Debug too |
yes | yes | |
channels |
host (moqui-channels) |
Business messaging channels: the sms chat bridge adapter, SMS and MMS on the Telnyx Messaging API v2 (SMS). The /channels/ webhook and media routes are in every build with axum and answer only when channels@webhooks-enabled is true; without this feature no adapter answers them and an SMS bridge stays not connected. |
yes | yes | |
xmpp |
host (moqui-xmpp; includes axum) |
XMPP for local users: client streams with STARTTLS, direct TLS and WebSocket, SASL2 with SCRAM-SHA-256-PLUS and FAST, rooms as MUC, history, PEP and uploads over Moqui chat (XMPP); it starts only when xmpp-server@domain is set. In Debug too |
yes | yes | |
grpc |
host (includes telemetry, axum) |
gRPC on tonic: the cluster's protocol on the cluster port (cluster-member@protocol, Cluster); the host's gRPC listener: the OTLP/gRPC receiver, opened only when <telemetry><receiver grpc-enabled="true"> is set, and with edge the direct PASS authority (Edge-Node §5.5) |
yes | yes | yes |
edge |
host (includes grpc) |
The edge link (Edge-Node): a local node's dialer when edge/node@url is set, and on an edge node (moqui_conf__instance__node_role=front_edge) the link's hand-off on the HTTPS listener, web access, delegated calls, the queue and replication; the PASS authority over gRPC (direct when moqui_conf__pass_authority__grpc_enabled=true, and on the link) and scripts' ec.service.passAuthority |
yes | yes | |
vault |
host (moqui-vault-server) |
Vaults (Vault-Instances §3): personal and operational vaults, leases, machine access and recovery. The vault crypto (moqui-vault) is in every build, for moqui vault and moqui operator |
yes | yes | yes |
instances |
host (moqui-instance; includes vault) |
Managed instances (Vault-Instances §4): instance kinds, provisioning on Docker and Podman hosts, deploys, rotation and transit by the manager | yes | yes | |
manage |
host (includes grpc, moqui-vault) |
The manager link (Vault-Instances §4.4): a managed instance dials its manager on ALPN moqui-manage/1; with instances, the manager's end on the HTTPS listener |
yes | yes | yes |
devtools |
host, moqui-devkit (watch) |
What only development needs (design-dev-aide 3.3): the framework's file watcher that reloads changed artifacts on a dev instance, and in the binary crates the components/dev crates of runtime/components/dev; in Maximal (the default) and Debug |
yes | ||
smtp |
host (moqui-mail) |
Outbound mail: send#EmailMessage, send#EmailTemplate, password reset and notification mail |
yes | yes | yes |
imap |
host (moqui-mail) |
Inbound mail: poll#EmailServer, the mail client's sync, IDLE, rules and import (includes smtp) |
yes | yes | |
git |
host (moqui-git) |
git:// locations, git drives, org.moqui.git.GitServices, the git server over HTTP and SSH, LFS |
yes | yes | |
image |
core | org.moqui.impl.ImageServices (convert#Image) and elFinder thumbnails |
yes | yes | |
xlsx |
core, moqui-report | The xlsx render mode, org.moqui.resource.SpreadsheetServices and the xlsx format of a scheduled report: calamine reads, and the IronCalc engine (moqui_core::workbook, a pinned git revision) writes and calculates; the host's xlsx also links moqui-calc (CalcGrid, org.moqui.calc.CalcServices) |
yes | yes | |
llm |
host | The agents and the model providers (the moqui-llm crate, org.moqui.agent.AgentAdminServices; LLM-A2A-Assist) |
yes | yes | yes |
http, cluster-tls |
core | Remote REST, http locations, the OpenSearch client; the cluster certificate |
yes | yes | yes |
mail is smtp and imap together. The browser build has none of the core features, and no framework crate.
Four more features are in no package; they are build options of any package (./moq build --embed <level>,
--embed-opensearch, --embed-chromium; Embedded runtime and programs):
| Feature | Crate | What it builds in |
|---|---|---|
embed-production |
host (moqui-embedded/production) |
The whole webroot and every base and add-on component, less tests and plans: the file set of ./moq archive |
embed-all |
host (moqui-embedded/all) |
The production level with tests, plans and the dev and test sets |
embed-opensearch |
host (moqui-embedded/opensearch) |
The OpenSearch archive (Linux), unpacked into install/opensearch/<version> |
embed-chromium |
host (moqui-embedded/chromium) |
The Chromium snapshot archive, unpacked into install/chromium/<revision> |
The definitions still load, so components, screens and service files are the same in every package:
- A service whose Rust implementation belongs to a missing feature fails when called, with
service <name>: <feature> is not built into this hostin the message facade (rust_services::missing_feature). - The host integrations report through the framework's existing messages: SFTP and SSO calls say no client is
installed, network printing says it is not installed, and
moqui_conf__cluster_member__transport=sshcannot start without the SSH server. A cluster peer that advertisesssh://gets an error naming the missing feature. Withoutgrpcthe cluster port speaks only HTTP/1.1, which every member still takes, andmoqui_conf__cluster_member__protocol=grpcfails at startup. - An
xlsxrender fails withxlsx is not built into this host; an elFinder thumbnail is left out; agit://location has no provider, and/git/...is not routed. - gitECA rules are still read and checked; nothing runs them, since there are no git events.
- Without
edge, theorg.moqui.edge.EdgeServicesthat need the link (pairing, clients, hosts, ping) fail withedge link not built into this host(get#LinkStatusanswers statenotBuilt), andec.service.passAuthoritythrowsgRPC not built into this host, so mr-pass takes REST. - Without
embedded-postgres, the transactional datasource'sdatabase-conf-namemust name an externalpostgresormysqldatabase, the sim overlay is not available, andsave-db,load-save, andmoqui test --db fresh(which makes scratch embedded databases) report that this build has no embedded Postgres.moqui test --db nonestill runs specs that setdatabase: false.
A spec file that needs a feature says so, and moqui test reports it as skipped in a binary without it:
spec({
requires: ["git"],
...
})The profiles are in .cargo/config.toml, so the generated target/moqui-app crate builds the same way. Each package
has its own, so the artifacts of one never replace another's and switching packages does not rebuild.
dev(Debug, and everycargo test): the workspace crates at opt-level 0 with debug info, the dependencies at opt-level 3 with line tables only (file and line in a backtrace). The debug info stays in the object files undertarget/debug(split-debuginfo = "unpacked"), where debuggers read it, instead of being copied into each binary: a host test binary was 1.5 GB, 83% of it debug info. Windows has nounpacked: theremoqsetsCARGO_PROFILE_DEV_SPLIT_DEBUGINFO=packed, a PDB beside the binary (Windows).lite(Lite):releasewithincremental = trueand 256 codegen units for the workspace and path crates (Cargo appliesincrementalonly to those), so a rebuild after an edit to the framework is quick; the dependencies keep the release settings and are built once.release(Maximal) andenterprise:panic = "unwind"(services unwind across the service boundary) and one codegen unit for each of the script engine's crates (quickjs-oxide,-core,-regexp), otherwise Cargo's release defaults.
The embedded-postgres feature embeds the theseus Postgres archive (the version .cargo/config.toml forces through
POSTGRESQL_VERSION) and unpacks it once into install/postgres/<version> in the runtime directory (or under
MOQUI_INSTALL), shared by the entity, search and sim clusters. An install an earlier build unpacked in
runtime/db/install is moved there on the first start. crates/moqui-drivers/build.rs stages it from ~/.theseus/postgresql/postgresql-<version>-<target>.tar.gz (%USERPROFILE%\.theseus\postgresql on Windows; the build reads USERPROFILE, not Git Bash's HOME), or
the file MOQUI_PG_ARCHIVE names, and downloads nothing. It refuses an archive that still holds bin/psql or a
readline library (GPL, plans/archive/License-Review.md).
scripts/pg-payload.sh strip downloads the archive when it is missing (checking its sha256) and repacks it without
psql; ./moq build runs it the first time. curl uses https_proxy when it is set, and otherwise git's http.proxy.
A plain cargo build of a package with embedded Postgres asks for it.
scripts/pg-payload.sh check checks an archive, and every one staged under target/, for psql and readline.
Every binary carries part of the runtime (crates/moqui-embedded), which a runtime reads where it has no file of its
own (Built-in runtime files). How much is a build option of any package:
./moq build # framework: framework, tools, a webroot stub, the confs
./moq build --embed production # every component ./moq archive would put in, less tests and plans
./moq build --embed all # with tests, plans and the dev and test sets
./moq build --embed production --embed-opensearch --embed-chromium
./moq archive --binary # the production binary, gzipped, with its checksums- Levels.
crates/moqui-embedded/src/select.rshas what each level takes, and build.rs includes it; its tests check the rules on scratch runtimes. A production build packs the runtime./moquses (MOQUI_EMBED_RUNTIME, set toMOQUI_RUNTIMEorruntime/), so the components inruntime/componentswhen it is built are the ones built in. Neither the binary nor./moq archivetakes the namescrates/moqui-embedded/archive-excludes.txtlists. Each file is deflated on its own; at the production level with mr-mantle, mr-boss and the other add-ons that is about 25 MB of the binary for about 4,500 files. Cargo watches each component's top-level entries, not itstest/or.git, and./moqpasses the list of component directories (MOQUI_EMBED_COMPONENTS), so a new component packs again. The production and all levels pack the whole webroot, so they need the vault's browser module, which is built on demand (Build):./moq buildmakes it before cargo, and a plain cargo build without it fails naming it. - Programs.
--embed-opensearchand--embed-chromiumbuild in the archives./moq opensearch-downloadand./moq chromium-downloadkeep in the embed cache ($XDG_CACHE_HOMEor~/.cache, thenmoqui/embed;%LOCALAPPDATA%\moqui\embedon Windows;MOQUI_EMBED_CACHEmoves it):opensearch-<version>-<target>.tar.gz, checked against the SHA-512 OpenSearch publishes, andchromium-<target>.tar.gz, the snapshot repacked as a gzipped tar with its revision inchromium-<target>.tar.gz.revision. A Chromium snapshot of a revision, and an add-on's version archive (./moq component-get -t releaseorbinary), has its SHA-256 recorded indownloads.sha256beside the embed cache (moqui/downloads.sha256) the first time it is fetched, and a later fetch of the same one must match it or the task stops (SEC-OUT-14); a branch's archive moves, so it is not checked.--cache-onlyfills the cache without touchingruntime/, and./moq buildgets a missing one;MOQUI_OPENSEARCH_ARCHIVEandMOQUI_CHROMIUM_ARCHIVEname others for a plain cargo build. The OpenSearch version is.cargo/config.toml'sMOQUI_OPENSEARCH_VERSION. They are large (OpenSearch 3.4.0 with its JDK about 270 MB, a Linux Chromium about 225 MB), each separate from the other and from the runtime level. OpenSearch is Apache-2.0; Chromium is BSD-3-Clause with the third-party licences of its credits page (chrome://credits), which a distribution of the binary carries as it would the downloaded build. - Why only for delivery. The runtime files are read from the binary in place, sealed in it; the programs are unpacked into the install directory and run as their own processes, so once unpacked they are files on disk like a downloaded install. They save shipping and unpacking an archive beside the binary, nothing more.
- Checksums.
moqui embedded checksumprints the SHA-256 of theruntime,postgres,opensearchandchromiumparts a binary has; each program's equals thesha256sumof the archive file in the cache. A deployment that keeps them (./moq archive --binarywrites them beside the.gz) has the binary check itself at startup (Built-in runtime files).
Run ./moq source-archive [file.tar.gz] in a clean checkout: at a release tag for a release, or at any commit. The
tag, or else the commit, labels the archive in its SOURCE-RELEASE.txt. It includes the framework, each checked-out component
at its recorded revision, all locked npm tarballs and vendored Cargo sources. The Postgres payloads cover Linux and
macOS on arm64 and x86-64, and Windows on x86-64. The archive includes the stripped payloads and checksums.
Install the pinned Rust toolchain with the wasm32-unknown-unknown target, Node 22.13 or later with npm, and the platform build
prerequisites before disconnecting. On Debian the embedded Postgres standby also needs libpq5 for WAL replay.
Unpack the archive and run ./moq build --offline --release in its root.
An ordinary checkout can also use --offline once the package and Postgres caches are populated.
The tag pipeline hands the archive to the trusted linux-offline shell runner via the detached commit’s cache key.
Provision that pool with a rootless Podman or Docker engine, disk for a cold Rust build and regression run, and the
localhost/moqui-build:latest image built with Chromium. The runner can reach its CI server to restore the archive.
scripts/test-source-archive.sh <archive> streams it into a fresh container with --network none and empty caches,
checks the expected revision when MOQUI_CI_COMMIT is set, builds the release and runs ./moq test-framework.
That job has not yet run on a provisioned pool, so an offline build is not yet proven there.
Set MOQUI_BUILD_IMAGE to use another locally installed build image.
./moq archive [file] (with the package flags and --nobuild) zips what one instance needs to run into file
(default mr-moqui-YYYYMMDD.zip; --tgz, or a .tgz or .tar.gz name, writes a gzipped tar), which expands to a
directory of the same name. That directory is a runtime directory with the binary in it:
mr-moqui-20261019/
moqui the package's binary
MoquiConf.xml runtime/conf/MoquiProductionConf.xml, or the --conf file
README.txt how to run it, the package, the commit, and what went in
LICENSE.md
.env, components/, conf/, db/, opensearch/, ...
runtime/ without log/, tmp/, save/ (--with-save adds it), install/, db/install, .git,
component target/
install/ not in the archive: the first start unpacks the embedded Postgres into install/postgres/
The binary takes runtime in the working directory when it has components/base/, else the working directory itself
when it has one, so the unpacked directory runs as cd <dir> && ./moqui; it never looks beside the binary, so one
binary runs several instances (Runtime directory). The binary also
carries the framework and tools components, a webroot stub and the runtime confs (crates/moqui-embedded): it reads
each of those files the runtime does not have from the binary, compares the runtime's copies with them at startup and
logs each difference, and moqui embedded extract writes them out
(Built-in runtime files). With no
MOQUI_CONF, it merges <runtime>/MoquiConf.xml, else <runtime>/conf/MoquiDevConf.xml. --tgz needs GNU or BSD tar.
The embedded database, OpenSearch and Chromium go in when they are in runtime/, so the embedded Postgres must be
stopped; --no-data leaves out the database, OpenSearch data, .env and cert/ for a fresh instance. A binary runs
on the OS and CPU it was built for.
A production archive carries no tests, plans or dev tools by default: it leaves out each component's test/ (the
regression and acceptance suites, agent replays and load scripts), plan/ and plans/, and the test set,
components/test/, unless --with-tests, and the dev set, components/dev/, unless --with-dev. --with-tests is for a staging server that runs
moqui test or client specs against itself; a demo server, whose conf loads the demo component from the dev set, needs
--with-dev. ./moq component-zip leaves out test/ too, unless --with-tests, and the desktop app's runtime keeps
the dev set (the tray's Developer tools) and leaves the tests out.
./moq archive --binary [file] writes the binary alone instead, gzipped (moqui-YYYYMMDD.gz), built with the same
file set in it (--embed production, or --embed all with --with-tests or --with-dev; --embed-opensearch and
--embed-chromium add the programs), and moqui-YYYYMMDD.sha256 beside it, the binary's moqui embedded checksum
and the .gz's own line. It takes the place of the zip for a deployment that unpacks one file (Deploy a single
binary); the database, .env and certificates are the server's own, as with
--no-data.
Measured on Oct 19, 2026, on one 12-thread Linux machine, Rust 1.99: a clean build of each package in its own target
directory, the binary, and two run-time checks. Before the packages there was one feature set, every build carrying
everything, and postgresql_embedded's bundled build script compiled a second HTTP and TLS stack.
| Build | Clean build (wall) | Compile CPU | Crates | Binary | Stripped | .text |
|---|---|---|---|---|---|---|
| Before (release, everything) | 171 s | 1394 s | 623 | 84 MB | 67.5 MB | 38.1 MiB |
Maximal (release) |
151 s | 1091 s | 545 | 82.9 MB | 66.8 MB | 37.7 MiB |
| Enterprise | 141 s | 971 s | 522 | 68.4 MB | 53.1 MB | 36.4 MiB |
Lite (lite, then Default) |
113 s | 1054 s | 397 | 64.6 MB | 53.1 MB | 28.2 MiB |
Lite without tui |
105 s | 901 s | 375 | 58.4 MB | 48.4 MB | 25.2 MiB |
The two Lite rows (Lite was the Default package then) were measured on Oct 20, 2026, on the same machine, at commit 5a18e9c, after the terminal client
joined lite; the other rows are Oct 19's, on the code of that day, and were not measured again. The terminal client
(Revue, crossterm and their dependencies, 22 crates) adds 8 s to a clean build, 153 s of compile CPU, 6.2 MB to the
binary and 3.0 MiB of .text. Lite without it is cargo build --profile lite --no-default-features -F moqui-host/axum,moqui-host/embedded-postgres,moqui-host/pdf,moqui-host/smtp -p moqui, for comparison only; it is not a
package. Without it, Lite still takes 293 s more compile CPU and 21 more crates than Oct 19's row; that came with
the code and dependencies added since, and is not broken down here.
The embedded Postgres archive is 11.9 MB of each binary that has it.
| Build | Rebuild after a one-line edit in moqui-core | Load seed, seed-initial, install (8141 records) |
|---|---|---|
Maximal (release) |
60 s | 8.4 to 10.0 s |
Default (lite, opt-level 3) |
11.3 s (Oct 20, with the terminal client; 11.6 s on Oct 19) | 8.6 s |
| Default at opt-level 2 / 1 | 11.6 s / 10.7 s | 8.3 s / 9.1 s |
Debug (dev) |
8.8 s | 18.1 s |
The Default profile keeps opt-level 3: a lower one saves no rebuild time. Thin LTO on the release profile made the binary larger (84.1 MB, 67.6 MB stripped) for a seed load of 8.0 to 8.3 s, within the noise of a load that waits on the database, so it is off. Stripping symbols saves about 16 MB a binary; it is not done, so a backtrace in a log keeps its function names.
What a clean build still spends: aws-lc-sys (the TLS crypto every package links) is the first link of the longest
chain, then rustls, reqwest and moqui-core itself; postgresql_embedded's build script still compiles reqwest and tokio (without TLS) though it no longer
uses them. cargo build --timings writes the chart to target/cargo-timings/.
Each worktree of this repo has its own target/, so without a shared cache every worktree compiles the same
dependencies (aws-lc-sys, oxc, tokio, ...) again. sccache shares them. It is
opt-in: with MOQ_SCCACHE=1 in the environment (in ~/.bashrc, say), the cargo runs of ./moq (build, desktop,
test-all, and the build before a task that runs moqui) use sccache as the rustc wrapper, so a dependency compiled in
one worktree comes from the cache in the next. Without it, ./moq leaves the wrapper alone, as before. A crate
compiled incrementally (the workspace and path crates in the dev and lite profiles) goes straight to rustc, so
incremental rebuilds after an edit work as before; profiles and CARGO_INCREMENTAL are not changed.
- With
MOQ_SCCACHE=1and no sccache on the PATH, the build goes on without it, and./moqwarns once with how to install it:cargo binstall sccache,cargo install sccache --locked, the distribution package (brew,dnforapt install sccache), or a release binary from github.com/mozilla/sccache. - A wrapper already chosen is kept:
RUSTC_WRAPPERorCARGO_BUILD_RUSTC_WRAPPERset (even to empty, which turns any wrapper off), orrustc-wrapperin a cargo config (~/.cargo/config.tomlor a.cargo/config.tomlat or above the repo). - The cache directory and its size are sccache's own settings, such as
SCCACHE_DIRandSCCACHE_CACHE_SIZE(default 10G);sccache --show-statsshows the hits.
The repo's .cargo/config.toml does not set rustc-wrapper: cargo fails at once when that binary is missing. To use
sccache outside ./moq too, set RUSTC_WRAPPER=sccache in the shell.
./moq desktop runs, and ./moq desktop build bundles, the desktop app in crates/moqui-desktop: a node, or a client of a
remote server, in a Tauri 3 (alpha) window on Chromium (CEF). It is not a workspace member, so the server builds need none of this. What it is and
how it runs are in its README and Mobile-Desktop.
Prerequisites, beyond those of the server build:
- Tauri CLI, the version
./moq desktopchecks for (TAURI_CLI_VERSIONinmoq), from cargo, so no Node:cargo install tauri-cli --version 3.0.0-alpha.6 --locked. - CMake, Ninja and a C++ compiler, which build CEF's C++ wrapper (cef-dll-sys uses the Ninja generator).
- Linux: the GTK 4 development packages and pkg-config (gtk4-sys);
patchelffor the AppImage; andcc, which quick-sharun and./moquse while bundling. - Network on the first build and for each AppImage: the first build downloads the CEF binary distribution, about
1 GB, into the
tauri-cefcache (~/.cache/tauri-cefon Linux,~/Library/Caches/tauri-cefon macOS;CEF_PATHfor another). The AppImage step downloads quick-sharun.sh, sharun and appimagetool each time.
# Ubuntu 26.04
sudo apt install build-essential pkg-config cmake ninja-build libgtk-4-dev patchelf
# macOS (with the Xcode command line tools)
brew install cmake ninja
cargo install tauri-cli --version 3.0.0-alpha.6 --locked
./moq desktop build # target/release/bundle: .deb and .AppImage on Linux, .app and .dmg on macOSA bundle carries the moqui binary for the sidecar node: ./moq desktop build builds the Maximal release binary (the
package the app links), stages it as target/desktop-bin/moqui-<host triple> and passes it as bundle.externalBin,
which puts it beside the app's executable as moqui. A development run uses target/release/moqui or
target/debug/moqui from ./moq build. The bundle's runtime has components/dev (the Dev AIDE and the example), which
load only when the tray's Developer tools makes the node a dev instance. The bundle also carries Chromium's notices, CEF's CREDITS.html from the
tauri-cef cache, as notices/chromium-credits.html (target/desktop-notices). The checks on installed bundles are in
Mobile-Desktop-Exit-Checks.
Signing and updates are on when their variables are set, else the bundles are unsigned with no updater; ./moq help desktop lists them:
- macOS signing:
APPLE_SIGNING_IDENTITY, orAPPLE_CERTIFICATEandAPPLE_CERTIFICATE_PASSWORD(a base64 .p12). The Tauri CLI signs the app, the sidecar and the CEF helpers with the hardened runtime andentitlements.plist. - Notarization:
APPLE_ID,APPLE_PASSWORD(an app-specific password) andAPPLE_TEAM_ID, orAPPLE_API_KEYandAPPLE_API_ISSUER(andAPPLE_API_KEY_PATH)../moqchecks that each set is complete. - Updates:
MOQUI_DESKTOP_UPDATER_PUBKEY(the public key ofcargo tauri signer generate, or its file) andMOQUI_DESKTOP_UPDATER_ENDPOINT(https URLs, separated by spaces) addplugins.updaterandcreateUpdaterArtifactsto the config; both or neither.TAURI_SIGNING_PRIVATE_KEY(the key or its file) andTAURI_SIGNING_PRIVATE_KEY_PASSWORDsign the artifacts.
On Linux, ./moq desktop build builds with cargo tauri build --no-bundle and then runs cargo tauri bundle, with
these workarounds for tauri-bundler 3.0.0-alpha.5 (the Tauri CLI's):
- Its
.deband AppImage steps copy CEF'slibEGL.soandlibGLESv2.so, which the CEF 154 Linux distribution no longer has. The bundle step'sCEF_PATHistarget/desktop-cef, links to the distribution's files with an empty shared library for each one missing. - The quick-sharun.sh it downloads fetches two helper sources (
anylinux.c,gtk-class-fix.c) that Anylinux-AppImages has since removed.ANYLINUX_LIB_SOURCEandGTK_CLASS_FIX_SOURCEpoint to the last commit that has them (ANYLINUX_APPIMAGES_LIBinmoq). STRACE_MODE=0: quick-sharun would otherwise run the app, and so a node and its Postgres, for a few seconds to see what it loads (underxvfb-runwhen installed). ItsDEPLOY_CHROMIUMrules cover those libraries without the run.- The AppImage is made again without
fix-namespaces.hook, from the AppDir the bundler leaves beside it, withquick-sharun.sh --make-appimage. Where AppArmor restricts unprivileged user namespaces (Ubuntu 23.10 and later) the hook offers on every start to add an AppArmor profile through pkexec. That fails on a path with a space, and would not matter anyway: tauri-runtime-cef starts an AppImage with--no-sandboxwheneverkernel.apparmor_restrict_unprivileged_usernsis 1. The.debkeeps Chromium's sandbox through a setuidchrome-sandbox. With updates on, the remade AppImage is signed again (cargo tauri signer sign), since the bundle step's signature is of the image it made.
./moq android builds and runs the Android app in crates/moqui-mobile: the client of a server in a Tauri 3 (alpha)
app on Android's WebView (the wry runtime, not CEF), outside the workspace like the desktop app. What it is, and the
Gradle project it keeps in gen/android, are in its README.
Prerequisites: the Tauri CLI of the desktop app, a JDK 17 or later, the Rust targets, and the Android SDK command-line
tools (no Android Studio), in ~/Android/Sdk or ANDROID_HOME. The image has Play services, for FCM later.
rustup target add x86_64-linux-android aarch64-linux-android
sdkmanager 'platform-tools' 'emulator' 'platforms;android-37.0' 'build-tools;36.0.0' 'ndk;30.0.16248370' \
'system-images;android-36;google_apis_playstore;x86_64'
./moq android emulator # create (once) and start the moqui-36 AVD, on KVM; adb emu kill
./moq android dev # build, install and run on it, or on a phone over adb
./moq android build --target x86_64 --apk # debug APK; --release for a release one; aarch64 for phones
scripts/check-android.sh # clippy for both Android targets: moqui-client, moqui-client-tauri, the app
scripts/android-smoke.sh # when asked, not in test-all: ready line, frame check, relaunch
# For debug sign-in, start this server in a separate terminal.
moqui_conf__webapp_list__webapp__WEBROOT__http_bind=127.0.0.1 \
moqui_conf__webapp_list__webapp__WEBROOT__https_enabled=false ./moq run --http-port 8080
adb reverse tcp:8080 tcp:8080 # app server URL: http://localhost:8080./moq android (but init) first stages the client's shell into target/mobile-shell, the same step and layout as
the desktop bundle's (stage_client_shell), which the app embeds as its Tauri assets. The app's host logic is tested on
the desktop: ./moq test-clients mobile (a placeholder page stands in for an unstaged shell), and the Tauri glue it
shares with the desktop app with ./moq test-clients tauri. How the
app works on Android is Mobile-Client.
scripts/android-env.sh, which ./moq android and scripts/check-android.sh source, finds the SDK, the newest NDK
in it and the JDK (on macOS java_home's, else Android Studio's), and exports ANDROID_HOME, NDK_HOME and
JAVA_HOME for the Tauri CLI and the NDK's compilers for the C in aws-lc and SQLite; the emulator needs only the SDK.
The first Gradle build downloads Gradle and the Android Gradle plugin (and the SDK platform and build tools it compiles
against, compileSdk 37, when they are missing), and the rustls-platform-verifier Maven artifact from GitHub, pinned
to a commit of its archive.
The emulator runs in a hidden window (-qt-hide-window), not -no-window: cargo tauri android dev (cargo-mobile2)
waits for an emulator's boot animation to stop, and -no-window and -no-boot-anim turn it off, so it would wait
forever. With no display (no GUI session on macOS) ./moq android emulator falls back to -no-window, and
./moq android dev refuses such an emulator; build an APK and adb install it instead. Every adb call names the
emulator's serial, so a phone connected too is no trouble.
./moq android build --release makes an AAB and APKs for each target (--target aarch64 for phones, --apk or
--aab for one), minified by R8 (gen/android/app/proguard-rules.pro and wry's rules keep what Rust calls through
JNI). The version name is the crate's version (crates/moqui-mobile/Cargo.toml, passed as the Tauri config's
version) and the version code major·1000000 + minor·1000 + patch, so each release raises the crate's version. As
for the desktop, signing is on when its variables are set, else the build is unsigned, with a warning (an unsigned APK
does not install, and Play takes only a signed AAB):
MOQUI_ANDROID_KEYSTORE: the upload key's keystore (.jksor.p12), an absolute path, kept out of git.MOQUI_ANDROID_KEYSTORE_PASSWORDandMOQUI_ANDROID_KEY_ALIAS;MOQUI_ANDROID_KEY_PASSWORDwhen the key's password is not the store's. Each password can instead be a file's first line (MOQUI_ANDROID_KEYSTORE_PASSWORD_FILE,MOQUI_ANDROID_KEY_PASSWORD_FILE)../moqchecks that the set is complete.
A release build runs Gradle with no daemon (-Dorg.gradle.daemon=false), so no process is left with the passwords
in its environment, and refuses a prerelease version (0.2.0-beta.1), whose version code would be the release's.
keytool -genkeypair -keystore ~/keys/moqui-upload.jks -alias upload -keyalg RSA -keysize 4096 -validity 10000
read -rs -p 'Keystore password: ' MOQUI_ANDROID_KEYSTORE_PASSWORD && export MOQUI_ANDROID_KEYSTORE_PASSWORD
MOQUI_ANDROID_KEYSTORE=~/keys/moqui-upload.jks MOQUI_ANDROID_KEY_ALIAS=upload \
./moq android build --release --target aarch64 --aab
MOQUI_MOBILE_APK=crates/moqui-mobile/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk \
scripts/android-smoke.sh # a release APK for x86_64 on the emulator: R8 kept the JNI classes, the shell loads
# (adb uninstall org.moqui.mobile first if a debug build, signed by another key, is on it)Firebase (native push) is in a build only with gen/android/app/google-services.json (moqui-mobile
README); a release for users wants it.
In the Play Console, once:
- Play App Signing: Google holds the app's signing key; the keystore above is the upload key, which Google can reset if it is lost. Register its certificate when the app is created, and keep the keystore and its passwords out of the repository.
- The target SDK:
targetSdkingen/android/app/build.gradle.kts(37); Play requires a recent one for new apps and updates each August. - Declarations: the full-screen intent (
USE_FULL_SCREEN_INTENT, for an incoming call: a calling app), and the foreground service of typephoneCall(FOREGROUND_SERVICE_PHONE_CALL, an ongoing call the user answered), each with a short video or description of the incoming call. - Privacy policy: docs/Privacy.md, at its GitHub address, which the app's account menu and sign-in open (plans/Security-Review.md SEC-CLI-122).
- Data safety, from the merged manifest's permissions (
app/build/intermediates/merged_manifest/release/, which has the libraries' too): the app keeps on the device, not shared with anyone but the user's own server, chat messages and mail (each account's store, for offline use), contacts' names in them, files attached, and a device key (a credential, sealed by the Android Keystore); it records audio (and video) in calls only, sent to the user's server; photos and videos the user takes or picks to send, and the precise or approximate location of a place the user shares, go to the user's server; the device's name in the user's device list and as a chat encryption device, which room members see, is the phone's model; the phone's contacts are read on the phone to search the dialer and never sent; it shows notifications; with Firebase, the FCM token goes to the user's server and Google; with a UnifiedPush distributor, that app gets an endpoint for each account under a random name; pushes are sealed to the account's keys. The WebView sends no metrics (MetricsOptOut) and keeps Android's Safe Browsing. Data in transit is encrypted (TLS); the user can delete it by signing out on a shared device or removing the account. No backup is made (allowBackupoff). - Remote code: the app shows the user's server's screens in its WebView; whether that is fine under Play's device and network abuse policy is a decision for the release (Mobile-Desktop §9, Android, open).
The ./moq script runs the built binaries in place and replaces the Java Moqui Gradle tasks: run, load, save and reload
of the database, clean, OpenSearch, Chromium for PDF, git across all repositories, and component get, create and zip.
It needs only bash (3.2 or newer), so it works on a fresh checkout on Linux, macOS, or Windows (Git Bash; moq.cmd from PowerShell or cmd). ./moq with no arguments lists
the tasks, and ./moq help <task> describes one. Task names match by partial parts, ignoring case, so ./moq r-p and
./moq runProduction both mean run-production. The moq file holds the task table and finds the repository; the
tasks are in scripts/moq/, one file an area (build.sh, test.sh, components.sh, ...), each with its tasks, their
help and their helpers, and scripts/moq-test.sh tests them all.
./moq build # Maximal with the dev tools, target/release/moqui (--lite, --debug, --enterprise for
# the others), linking any component crates in runtime/components/addon; tasks that
# run moqui build a missing binary themselves
./moq run # target/release/moqui with runtime/conf/MoquiDevConf.xml; --lite uses target/lite/moqui
./moq run -p 8081 -D moqui_conf__entity_facade__datasource__TRANSACTIONAL__database_conf_name=postgres
./moq run lint --screens # moqui's own commands, with the same conf
./moq load # all data types; ./moq load seed seed-initial install
./moq test mr-mantle # run a component's JavaScript specs; extra args go to moqui test (--spec, --db snapshot)
./moq test-client framework # a component's test/client specs against the running server (docs/dev/JS-Test-Client.md)
./moq test-load mr-marble --script OrderToCash # a load script against the running server (docs/tools/Load-Runner.md)
./moq test-apps # the application tests: the specs of runtime/components/addon, no cargo
./moq test-framework # the framework tests: cargo, moq, the specs of components/base and components/dev
./moq test-all # the whole regression suite: test-framework, then test-apps
./moq accept mr-boss # a component's acceptance suite (test/acceptance/), only when asked
./moq accept-all # every acceptance test, with the Rust opt-in and ignored tests
sudo scripts/call-network.sh # calls on shaped networks (tc netem in namespaces; root): docs/interfaces/WebRTC.md
./moq save-db before-upgrade # and later: ./moq reload-save before-upgrade
./moq archive # mr-moqui-YYYYMMDD.zip (or --tgz): runtime/ without logs, with the binary in it
./moq git-status # or any git command in every repo: ./moq git pull
./moq completion --install # tab completion for bash or zsh
./moq claude-code # an agent harness's setup: AGENTS.md and .agents/skills where it looks (./moq help
# lists the setups: claude-code, claude-desktop)The everyday tasks with their Gradle counterparts, and the runtime, conf and deployment detail, are in Run-Deploy.
What to run depends on what changed. The checks of a commit are the regression suite's and the lints, the same as CI's
check pipeline (ci.xml: cargo lint, cargo lint-min, scripts/check-packages.sh and ./moq test-framework on
every push and merge request), so a commit that passes them here passes there. Acceptance and load tests are not part of
a commit; they are a release's (The two suites).
Look at what changed in every repository the work touched (mr-moqui and each component repository under
runtime/components/<set>/: ./moq git-status), and run each row that applies. A change of several kinds runs each of
its rows; a check named twice runs once.
| What changed | Run |
|---|---|
Rust in a workspace crate (crates/*, a component's src/) |
cargo lint (clippy on the workspace, warnings denied); cargo lint-min (the host and every crate it links built with no default features, so feature-gated code and its off stubs are checked); cargo test -p <crate> for each crate touched while working; then ./moq test-framework |
Feature-gated code (#[cfg(feature = ...)]), a crate's [features] or dependencies, Cargo.toml or Cargo.lock |
also scripts/check-packages.sh (clippy on each package's feature set); for the repository's Cargo.lock, ./moq update-app-locks, which brings its versions into the mobile app's and the Tauri glue's committed locks (crates/moqui-client/tests/app_workspaces.rs fails until they match), and for a dependency of the apps ./moq deny-apps (their advisories, by cargo deny) |
A crate outside the workspace (moqui-desktop, moqui-mobile, moqui-client-tauri) or the Android targets |
./moq test-clients (or its crate alone, ./moq test-clients desktop; it writes target/moqui-app for the desktop), which also runs moqui-client's tests and the clients' security proofs; scripts/check-android.sh for the Android targets |
Something a golden or generated file holds: a host member (moqui-host.d.ts), a proto, the bundled screens, a typegen fixture |
the file rewritten by its variable and its diff read: UPDATE_GOLDEN=1 cargo test -p moqui-devkit --lib typegen, MOQUI_REGENERATE_PROTO=1 cargo test -p moqui-host --lib the_checked_in_code_is_what_the_proto_generates, UPDATE_GOLDEN=1 cargo test -p moqui-core --lib bundled_screens_are_precompiled |
The framework's components (runtime/components/base, runtime/components/dev), the conf (MoquiDefaultConf.xml, the XSDs, runtime/conf/**), moq or scripts/ |
./moq test-framework (its cargo run holds the conf tests: every runtime conf parsed, merged and checked against the XSD) |
An application (runtime/components/addon/*, runtime/components/test) |
./moq test-apps; for a changed screen moqui lint --screens with a report file (./moq run lint --screens <file>), its idiom count not grown |
| An acceptance test you added or changed | that test (./moq accept <component> --spec Name), then its component's acceptance suite |
Docs only (docs/, plans/, READMEs) |
no build or test; the relative links still resolve |
While working, run less: the specs of what you touch (./moq test <component> --spec ...) and cargo test -p <crate>
for the crate you are in. The rows above are for the commit. Not part of a commit, unless the user asks: ./moq test-all (a release's, or CI's on main), ./moq accept-all, cargo test-slow, an acceptance suite you did not
change, and load tests.
Format only the files you changed (rustfmt --edition 2021 --config-path rustfmt.toml <file>; JavaScript and XML with
the repository's Prettier config), then read git diff -U0 for hunks that are not yours. Never cargo fmt a whole
crate: the tree is not rustfmt-clean, and the change gets lost among unrelated rewraps.
- A failing test binary stops
cargo test, and thecargo test --workspacestep of./moq test-frameworkwith it, so the crates after it did not run.cargo test --workspace --no-fail-fastruns them all and lists every failure. - Tests that fail only under load. The edge, XMPP and call tests bind ports and wait on timers; in a full parallel
run one can time out or meet a port another took. Run it alone (
cargo test -p moqui-host --test it -- <module>::<name>), twice. One that passes alone is flaky under load: say so in the report and go on. One that fails alone is a regression. could not create shared memory segment: No space left on devicefrom embedded Postgres, on macOS. It is not disk space: macOS allows 32 SysV shared memory segments (sysctl kern.sysv.shmmni), and each Postgres takes one 56-byte segment. A Postgres killed while starting (an interrupted run) leaves its segment behind for good. The suite tasks (test-framework,test-apps,test-all,accept,accept-all) free this user's 56-byte segments that nothing has attached and whose creating process is gone. For a plaincargo test,ipcs -m -alists them andipcrm -m <id>frees one.- A spec that fails only in a full
moqui testrun, never alone: the components' specs share one database, and an earlier spec left rows behind. Take the order from the full run's log, check that the whole prefix fails (./moq test --nobuild --db snapshot --spec "<prefix>,<Target>"), then bisect it. Fix it in the spec that left the rows (itscleanupSpec), or narrow the failing spec's checks to its own data. --nobuildruns the binary already built. After a Rust change a spec run with--nobuildtests the old code: a new Rust service shows asno service named .... Build first (./moq build, or leave out--nobuild).- A component repository behind mr-moqui fails many tests at once with a missing service or screen after a
framework rename. Pull the component repositories with mr-moqui (
./moq git pull, orgit pull --ff-onlyin each underruntime/components/<set>/).
On a clean tree, every repository at the release's commits (./moq git-status; ./moq component-get for the
components addons.xml names), in this order:
- The lints of the whole tree:
cargo lint,cargo lint-min,scripts/check-packages.sh. - The whole regression suite:
./moq test-all(./moq test-framework, then./moq test-apps). - Every acceptance test:
./moq accept-all --junit <dir>, the component suites and the Rust ignored and opt-in tests (gate3,gate3_browser,client_browser,tui_screens,cargo test-slow's modules). A test that fails on two runs in a row is fixed or deleted before the release. - The client apps that ship with it: the desktop and mobile tests and
scripts/check-android.sh(their READMEs), and the soak tests their plans name for a release. - Optionally, load: the load scripts of the components that have them (
./moq test-load <component> --script <Name>) against a release build with production-like data (Load-Runner), compared with the last release's results. - The release build and archive, as CI's
releasepipeline makes them:./moq build --release,./moq archive, andmoqui embedded checksumfor the parts built in (Run-Deploy). - For an upgrade, the target runtime's conf: boot it once (a conf with a retired
default-propertyor a${}in an attribute refuses to start, naming each), and check its names withmoqui conf env(Run-Deploy, Settings and the environment).
cargo test # the whole workspace, every feature
cargo lint # clippy on the workspace, warnings denied
cargo lint-min # clippy on the host with no features
scripts/check-packages.sh # clippy on each package's feature set
# The Gate 3 tests, left out of the default run (embedded Postgres per test, Chromium: ./moq chromium-download, or
# screen-facade/pdf@chromium-path, or an installed Chromium or Chrome): acceptance tests of the framework, run by ./moq accept-all
cargo test -p moqui-host --test gate3scripts/check-packages.sh runs Clippy with warnings denied on each feature set a build uses: the workspace
(Maximal with the dev tools, as cargo lint), the Lite, Maximal (with and without the dev tools) and Enterprise packages, the host with no features
(cargo lint-min) and with only the terminal client, and the framework with none (what the browser links). Then it
runs the scripted TUI screens, which cargo test leaves out. A gate that only one package sees still has to compile
there.
./moq test-framework runs the framework's suites in turn and lists which passed: cargo test,
scripts/moq-test.sh (the tests of ./moq), moqui test for the components of runtime/components/base and
runtime/components/dev, the demo component's specs (it is off by default, so the suite turns it on), the offline client
specs of webroot and dev-aide, and the served client specs of those components. ./moq test-apps runs moqui test and
moqui test-client --serve over the components of runtime/components/addon only, with no cargo build or test; it builds the
binary only when it is missing. ./moq test-all is both in turn. ./moq help <task> lists each one's suites.
The engine is moqui/quickjs-oxide, pinned by rev in Cargo.toml.
- Building against a local checkout: pass a patch on the command line, so that no committed file names a path:
cargo --config 'patch."https://github.com/moqui/quickjs-oxide".quickjs-oxide.path="../quickjs-oxide"' .... - Moving the pin: the fork is pushed first. Then the
revchanges andcargo update -p quickjs-oxideruns. - Its speed tests are
crates/moqui-host/tests/js_speed.rsand the other*_speed.rstests (plans/Profiling2.md §2). - The fork's own tooling: its benchmark tools, Sweep results and round records are in
moqui/quickjs-oxide-bench, checked out as
../quickjs-oxide-bench. Measurement output goes there (itsrounds/andwork/), not undertarget/, whichcargo cleanremoves.
| Regression suite | Acceptance suite | |
|---|---|---|
| Purpose | Catch a regression while developing: does what I changed break a rule? | Validate the system: complete scenarios, access and isolation walks, one screen sweep per app and mode, browser walks, load and media |
| When | While working (the specs of what you touch) and before every commit | On a schedule, before a release, and when asked |
| Where | test/**/*.spec.js, test/client/**/*.spec.js (outside test/acceptance), and the security proofs, test/proofs/**/*.spec.js |
test/acceptance/**/*.spec.js, test/acceptance/client/**/*.spec.js |
| Command | moqui test, moqui test-client, moqui test-client --proofs, ./moq test-apps, ./moq test-framework, ./moq test-all |
./moq accept [component...] (moqui test --acceptance, moqui test-client --acceptance), ./moq accept-all |
| Failure | Blocks the commit | Reported; a test that fails on two runs in a row is fixed or deleted |
A spec is in one suite or the other by the directory it is in. Everything that is a test sits under a component's
test/: the regression specs at its top and the special subdirectories client (client specs), proofs (the
security proofs, below), acceptance (the acceptance suite, with its own client), agent (agent replays) and load
(load scripts). An acceptance run of a component
that still has a top-level acceptance/, the suite's old place, is refused with the command that moves it (moqui test --acceptance, moqui test-client --acceptance, ./moq accept); a regression run warns. No option of the regression commands pulls in an
acceptance test. A regression test checks one rule or a fixed bug: a service's result and refusals, a posting, a state
change, the one render of a screen with logic of its own, one golden-path walk per app. An acceptance test checks a
scenario or the system: a plan's "usable when" walk (server side or in a browser), an access or isolation walk over
every route and group, a sweep of every screen of an app in a mode, a browser walk of a flow, a load or media test.
Acceptance tests can be deleted freely, since nothing depends on them.
- Discovery.
moqui testandmoqui test-clientnever readtest/acceptance/. With--acceptancethey run only the acceptance specs (test/acceptance/*.spec.jsandtest/acceptance/client/*.spec.js, withtest/acceptance/suite.jsandtest/acceptance/client/suite.jsgiving the order and the server).--specanddependsOnresolve across both trees, so an acceptance spec can depend on a regression fixture. A spec's name is unique across both trees of a component. - Security proofs.
test/proofs/holds client specs filed by OWASP ASVS requirement, each feature's name starting with its id (v5.0.0-6.2.6: ...): a public library that a builder or a certifier can run against their own deployment (security proofs). They are regression tests under the same 15-second rule, run by./moq test-frameworkand./moq test-apps(moqui test-client --serve --proofs) and alone withmoqui test-client <component> --proofs, which writes the results by requirement (proofs.json,proofs.md). A proof is filed only for an industry-standard requirement; a test of one internal bug stays intest/client/. - Fixtures. Acceptance fixtures live under
test/acceptance/, never among the regression specs. Helper libraries a spec loads bycomponent://<component>/test/...stay intest/, for both suites. - Rust. Rust has no such directory: its acceptance tests are
#[ignore = "..."](cargo test-slow, which runs those of the host modules its alias in.cargo/config.tomlnames:tools_screens,gate2,tool_components,qvt_report,notws,git_storage,factory_restartandauthz_revocation; a new module of them is added there and here; and moqui-core's sweep of screen generation on both script engines) or opt-in[[test]]s (gate3,gate3_browser,client_browser,tui_screens)../moq accept-allruns them, and no regression command does. - Who runs it.
./moq accept-allon a schedule (nightly, or weekly while it is long) and before a release, with--junitfor a dated summary. An agent runs an acceptance test only when the user asks, or when it adds or changes one (then that test, and its component's acceptance suite), never because code it uses changed (AGENTS.md). - In CI. A server that hosts the repository runs the suites as pipelines (Pipelines):
the
ci.xmlat this repository's root runs the lints and./moq test-frameworkon every push and merge request,./moq test-allon main, and./moq accept-all --junitnightly, in themoqui-buildimage; a component's own repository needs no file and gets./moq test <component> --junitas its built-in pipeline. The same rules hold there: budgets are not raised, and acceptance is never part of a push's checks. The engine's own opt-in test, one container on a real Docker or Podman socket, iscargo test -p moqui-git --test ci_dockerwithMOQUI_CI_DOCKER_SOCKETset; the container driver's for containers that stay (a secret file put in, read back and removed with its container) iscargo test -p moqui-lib --features docker --test docker_real, with the same variable.
Each component declares its regression budget, in seconds of feature time (the serial sum, so parallel workers do not
hide growth), in test/budget, beside the specs it limits:
server = 195
client = 30
server limits moqui test, client moqui test-client, and proofs, when a component has the line,
moqui test-client --proofs. A run warns when a component's feature time goes over its
budget, and fails over 1.5 times it, or when one spec takes over 15 seconds. The margin keeps a slower machine from
failing a run; the warning keeps the growth visible. A new app adds its own budget. A budget is raised only with the
user's agreement, like any other performance regression; cut duplicates or move scenarios to acceptance instead.
These rules are the regression suite's. A sweep has one place, test/acceptance/, and one per app per mode.
- No regression test walks every screen of an app or of all apps, or every screen in every render mode. These have been
deleted before and keep coming back; do not add one. Rendering as such is the framework's (its goldens and
moqui lint --screens). - Across the regression suite a screen is rendered at most once in each render mode, and that one render carries every check of the screen (its content, its access, a value that must not show).
- A screen is rendered in more than one mode only where its modes differ: a screen with its own qvt or tui template
(
.qvue,.tui.json, or arender-modesection). Say in the check which template it covers. What made this rule was a screenshot matrix of every Products page at three widths in both themes: 535 cases and 9 minutes for checks that did not depend on the width or the theme. No spec takes screenshots for review; check at a width or in a theme only what changes there.
moqui test runs the JavaScript spec files in a component's test/ directory. They run in the same script engine as
the component's services, on a database loaded with every data type, with Spock's conveniences: spec and feature
setup and cleanup, ordered features with shared state, given/when/then/expect blocks whose conditions fail with
the values of their parts, where tables, a suite order, data checks, pinned sequence ids, a pinned clock, screen and
REST renders, and features that run on several threads. This section is how to run them, their files and order; the
API a spec is written with is in JS-Testkit.
The specs of runtime/components/addon/mr-mantle/test are the largest set, ported from the Java mantle-usl's Spock specs; its
README.md maps Groovy to spec files line by line. The design record is plans/archive/TestHarness.md.
Tests from outside the server, over HTTP, WebSocket and headless Chromium, with a load runner, are the specs of a
component's test/client/, which moqui test-client runs against a running server:
JS-Test-Client; the security proofs are client specs too, in test/proofs/
(security proofs). Each client spec's sessions reach a test server from an address of their own
in 127.0.0.0/8, so a limit keyed by the requester counts per spec (--serve). Load scripts are a component's test/load/*.load.js, which moqui test-load and Tools › Load run: JS-Test-Load for writing one,
Load-Runner for running it and reading its result.
./moq test mr-mantle # the Maximal binary and the dev conf
moqui test mr-mantle # every spec, fresh database
moqui test mr-mantle --db snapshot # load once, restore the saved dump on later runs
moqui test mr-mantle --spec OrderToCashBasicFlow # one spec and the specs its dependsOn names, run first
moqui test mr-mantle --spec OrderToCashBasicFlow --feature "ship Sales Order"
moqui test mr-mantle --junit build/test-results # JUnit XML for CI
moqui test mr-mantle --coverage # the services no spec called, per service file
moqui test mr-mantle --keep --log-level info # keep the scratch runtime, more on the consoleWith no component, every component that has test/*.spec.js runs, in load order, each component's specs in its
suite.js order and then by name; a spec whose dependsOn names a spec later in that order (in its own component or
another) waits for it, with the specs after it in its suite.js chain, and the rest keep their places. A dependsOn
cycle fails the run before any spec runs. So a spec's name need not sort after its fixture's: name the fixture in
dependsOn. moqui test-client orders its specs the same way, its components after their component.xml
depends-on (JS-Test-Client). A run with no --spec leaves out each fixture spec that a served client suite of its component names in server.specs (test/client/suite.js,
test/acceptance/client/suite.js), unless a spec that runs depends on it: moqui test-client --serve runs it on its
server, so a plain run would make the same data twice. ./moq test --debug uses the debug
binary.
| Option | |
|---|---|
--spec Name[,Name] |
The specs to run, by file name without .spec.js (component/Name for one component's, where two have a spec of the name), with the specs their dependsOn names, each run before the spec that names it. With components named, a name is a spec of those components; a dependsOn name the spec's own component lacks is found in the other components of the pool, and its component joins the run (moqui test mr-boss --spec X brings the mr-pass specs X depends on) |
--feature text |
Only the features whose names contain the text |
--workers N |
Run the specs in N child processes, each on its own copy of the --db snapshot database, which the run makes once first. A component's suite.js chain and what a spec's dependsOn names stay in one worker; every other spec may run in any worker, on a database without the other specs' writes, so a spec that reads another spec's data names it in dependsOn. The summary, JUnit files and feature times are of the whole run; each worker's results and log are under runtime/tmp/test-workers-<pid>, kept when the run does not pass (or with --keep) and removed when it does. Not with --serve |
--acceptance |
The acceptance specs (test/acceptance/) in place of the regression specs; --spec and dependsOn resolve across both (The two suites) |
--db fresh |
The default: load every data type into a scratch runtime, removed at the end unless --keep. Needs embedded-postgres |
--db snapshot |
As fresh, but save the load under runtime/save and restore it while the components the run loads (which the conf and the instance purpose decide: a dev component loads only on a dev instance), their entity and data files and the crate version are unchanged. On a dev instance the snapshot also holds the artifact index (the Dev AIDE's), built after the data, so a spec's server reads only the files changed since rather than every component's. When a run ends it removes the other snapshots no run has used for an hour (superseded by another day or changed files); the one it used stays for the next run. A relink keeps the snapshots; after a change to how the binary loads data, remove runtime/save/test-* |
--db existing |
The runtime's embedded database as it is. The specs change its data |
--db none |
Boot the factory and skip Postgres, so ec.resource works and the entity facade stays unset. A build without embedded-postgres can run this. Every selected spec must set database: false; one that does not is named and the run stops before boot. When every selected spec sets it, and the run is not --serve, --agents, --skills, or --coverage, this is the default |
--junit dir |
TEST-<component>.<Spec>.xml per spec |
--serve [address] |
When the specs pass, serve the scratch database on the address (127.0.0.1:0, a free port, by default; or a port alone) until Ctrl-C, SIGTERM, or the end of standard input when it is a pipe; then remove the scratch runtime unless --keep. With --db existing it serves the runtime's own database, for a runtime whose cluster was put in place beforehand (a copy of a loaded, stopped cluster in db/embedded starts in a fraction of a second, where a load or --db snapshot restore takes seconds to minutes); with no specs to run (each component named has none) the server starts at once, with no test factory booted before it. Not with --db none. For client specs (JS-Test-Client) or a person |
--ready-file path |
With --serve: write the server's URL here once it listens |
--coverage, --coverage-report file |
The services of the components' service/*.xml that no spec called, with the total; the report adds call counts |
--log-level level |
Console level, warn by default. Everything goes to runtime/log/moqui.log, whose path the run prints |
The console has a line per feature, and the failures in full at the end. Any failed feature exits 1.
A regression spec is <component>/test/<Name>.spec.js, and an acceptance spec <component>/test/acceptance/<Name>.spec.js, or in a subdirectory of test/ to group a busy component's specs (mr-mantle
by service directory, test/order/OrderToCashBasicFlow.spec.js; mr-boss by screen directory). Its name is the file
name, wherever it is, so it must be unique in the component. test/suite.js, suite(["SpecA", "SpecB"]), gives the
order; the other spec files run after it, by name. Each spec runs in its own execution context, on the one
database of the run, so a spec sees what the specs before it wrote.
A component's test/MoquiConf.xml merges after its MoquiConf.xml in moqui test runs only, for a test-only setting
or mount, or test services: a service-file there under test/service/ is found by its name as one under service/
is (basic-comms' test/screen/TextNamesApp.xml and its provider). test/client/ holds client specs and test/agent/ agent tasks, which moqui test does not read as specs.
The API a spec is written with is in JS-Testkit:
spec({...})andfeature(name, {...})with their fields, the blocks andctx,whererows, and what is skipped or ignored;- conditions: every expression statement of
thenandexpectis one, compared as Groovy does, andassertfor the places the rewrite does not reach; - the helpers:
call,checkData,login,screenTest,parallel,uploadedFile,setProperty,withProperty,log,skip,dec,sum,runInContext, and the context stack; - specs with
database: false; - the capture tools: mail, HTTP fixtures and notifications;
- agent specs, porting a Spock spec and pitfalls.
Client specs are in JS-Test-Client and load scripts in JS-Test-Load.
--agents runs a component's agent tasks instead of its specs: the files test/agent/*.agent.js, each a set of tasks
for one agent, run as real runs of the agent on the test database, with the agent engine started and the screen
sessions installed as a server has them (plans/LLM-A2A-Assist.md, section 9). The model is a live one or a recording:
moqui test tools --agents --llm-profile local-qwen --runs 3 --seed 7 # a model of the llm-facade conf
moqui test tools --agents --replay runtime/components/base/tools/test/agent/replay # no model
moqui test tools --agents --replay runtime/components/base/tools/test/agent/replay-small # a small model in JSON tool mode
moqui test tools --agents --llm-profile local-qwen --feature "approval" --db snapshot| Option | |
|---|---|
--llm-profile model |
The model the agent runs on: a model id of the llm-facade conf or an LlmModel row. The agent's feature (assist) is bound to it for the run and put back after. When the model's endpoint does not take a connection the run is skipped, not failed. An unknown id is an error |
--replay dir |
No model: the model replies recorded in <dir>/<spec>/<task>-<n>.jsonl (else <task>-1.jsonl) are played by the scripted fake provider, with the recorded model's settings, and the tools run live. The replay model makes no side call (sideCalls N: no intent hint, the deterministic compaction summary, no schema repair call), since a recording holds only the steps' replies. The directory is a profile's set: replay/ is the profile replay, another replay-<name>/ (or <name>/) the profile replay-<name>, with its own baseline; a task the set has no recording of is skipped |
--runs N |
Runs of each task, for pass@1 and pass^N. 1 by default |
--seed S |
Run n sends seed S + n - 1 to a Chat Completions model (in the model row's apiConfigJson; other protocols take none) |
--min-pass F |
The pass@1 a live run needs, 0.75 by default (6 of 8). A replay needs every task to pass |
--write-baseline |
Write test/agent/baseline-<profile>.json (baseline-replay.json, baseline-replay-small.json for the replay sets) from this run |
--spec picks agent spec files by name (without .agent.js), --feature tasks by name, and --db works as for the
specs. A live profile is a model of the conf, such as the commented local-qwen example of MoquiDefaultConf.xml (Qwen
in LM Studio at http://127.0.0.1:1234): copy it into the runtime's conf, or set the default endpoint's
llm-facade/endpoint[default]@url and llm-facade/model[default]@name and use --llm-profile default. The dev conf has claude-haiku (Claude Haiku
5.5 on the Claude API), live once llm-facade/endpoint[anthropic]@api-key is set in runtime/.env: --llm-profile claude-haiku. The
tests boot on a scratch runtime with no .env; a live run takes the llm_* entries of the real one (an endpoint's key)
and nothing else of it.
A task file calls agentSpec({...}) with its agent, surface, user and tasks; each task has what the user says, the
scripted approvals and answers, and its checks. The fields and the checks are in
JS-Testkit, Agent specs.
Each task run writes runtime/log/agent-eval/<run>/<spec>/<task>-<n>.jsonl: a header with the model's settings, then
the user's messages, each model reply (text, tool calls, usage) with its calls and their full results, the held writes,
the questions, the answer and the screen, and the result with its measures. The console has a line per task run, and a
summary per component, also written as summary-<component>.json: pass@1, pass^k, model and tool calls, wrong calls,
argument repairs, invented references, held writes against the expectation, the wrong calls' share of the tool calls, prompt, completion and cached tokens, the
cache-hit ratio, the prompt prefix size, compactions and wall time.
A transcript is also a recording: --replay takes its model lines (a line's raw, the text a model wrote in JSON tool
mode or a call it wrote as text, is played as that text) and compares its tool lines with what the tools
answer now, dates, clock times and long ids left out. A change shows as a replay drift note, so a change of a tool's
output is seen without a model; the checks decide whether it fails. To record a live run, copy its transcripts into
the replay directory.
A committed test/agent/baseline-<profile>.json holds each task's pass@1 and tokens a run, and the suite's wrong-call
share, invented references and cache-hit ratio. A run with lower success, or more than 20% more tokens, than the baseline
prints a REGRESSION line and fails; so does a task of the baseline that did not run, unless --feature or --spec
picked some. The tools component has baseline-replay.json (24 tasks) and baseline-replay-small.json (9, JSON tool
mode); the baselines of a live model (baseline-local-qwen.json, an 8B model's in JSON mode) are written by a live run
with --write-baseline.
The tools component's suite (test/agent/): assist.agent.js (21 tasks in the drawer) and headless.agent.js (3 on
the a2a surface, run through the run engine; the spec lets the assist agent serve that surface while it runs). The
surface of a spec is drawer, chat, tui, job, a2a or mcp; a headless one sends only the time in the tail.
The dev agent's tasks are in runtime/components/dev/dev-aide/test/agent/dev.agent.js (plans/design-dev-aide.md P4): a
field added to an upstream entity and shown on its form from the site component, a list column, where a service is used,
and a spec written from a Try in the sim. A dev component's agents run on a dev instance; the example component stands in
for the site component for the run, and the files a task writes are put back after it. With the hand-authored replies:
moqui test dev-aide --agents --replay runtime/components/dev/dev-aide/test/agent/replay. With a model (a key from the
environment, nightly and before a phase closes; the design's --live is --llm-profile):
moqui test dev-aide --agents --llm-profile <profile> --runs 3 --min-pass 0.8, a pass being the checks of the task: the
files proposed and written are the expected ones and check clean. Copy a passing run's transcript into the replay set to
keep it.