A guide for agents and people building business applications on MR Moqui: the IronStone BOSS apps (Projects, Products and those that follow) over Mantle, and apps like them. It covers how the artifacts are organized and the practices that keep an app's code and screens good. The reference guides for each tool (entities, services, screens, forms, the facades) are separate; they are being ported from the Moqui Java documentation and extended.
Most of these practices come from reviews of the Products app (runtime/components/addon/mr-boss/plan/impl-products.md,
section "R — Review" and findings F43–F46), of Accounting P0–P3 (impl-accounting.md "R — Review", F61 on) and of
Accounting P4–P5 (impl-accounting.md "R2 — Review"),
measured against the Projects app, which is the reference implementation of the screen archetypes. They cover code
quality, organization and UI quality, not individual bugs.
Contents: 1 tools and artifacts · 2 references · 3 where logic goes · 4 services and scripts · 5 screens · 6 vue single-file screens · 7 tests · 8 formatting and mechanical changes · 9 checklist
| Layer | Repository and directory | What belongs there |
|---|---|---|
| Framework | mr-moqui: crates/*, runtime/components/base/{framework,webroot,tools}, runtime/components/dev/{example,dev-aide,template} |
The facades, the screen renderers (framework/template/screen/Screen*.js), the browser client (webroot/screen/webroot/js/WebrootVue.qvt*.js), the XSDs (framework/xsd). No business data model. |
| Mantle | mr-mantle: runtime/components/addon/mr-mantle |
The business data model (entities, seed data) and the business services. It stands alone: no Mantle service, script, data file or spec names a BOSS group, service, screen or setting. It checks Moqui permissions itself (for example PRODUCT_CATALOG_EDIT, PRICE_VIEW). |
| Apps | mr-boss: runtime/components/addon/mr-boss |
The apps: screens, the app's access check, screen context (options, names, capabilities), settings forms, app-specific services. |
Each component is its own git repository. Commit in each repository that a change touches, with its own message.
| Path | Contents |
|---|---|
component.xml, MoquiConf.xml |
The component and its conf: screen mounts (screen-facade), tool factories, its own settings element (Conf settings). |
entity/*.xml, entity/<domain>/*.xml |
Entity definitions, view entities and extensions (extend-entity). Mantle groups these by domain, with separate *Entities.xml, *Views.xml and *Extensions.xml files. |
data/ |
XML data files, in name order in each directory, followed by its subdirectories in name order, depth first. Seed, initial settings, install and demo data (type="seed", "seed-initial", "install", "demo"): enumerations, status flows, security (ArtifactGroup, ArtifactAuthz, UserGroupPermission), demo records the walks use. |
service/<package path>/*.xml |
Service definitions: verb and noun, parameters, <description>, and the implementation, inline XML Actions in <actions> (§4). SECAs in *.secas.xml, EECAs in entity/*.eecas.xml. |
service/<package path>/*.js |
Script modules for logic too involved for XML Actions: one module per area (Prices.js, Methods.js), plus a shared library (ProductsLib.js). |
screen/<App>.xml, screen/<App>/**/*.xml |
XML Screens: the app root, its sections and subscreens. screen/Shared/*.xml holds screens mounted in several apps. |
screen/**/*.qvue |
Vue single-file screens and widgets for the browser (§6), each beside an XML screen. |
screen-extend/ |
Extensions of another component's screens. |
template/*.xml |
Shared screen parts: transition-include files (CatalogChoiceTransitions.xml, FilePickerTransitions.xml), section includes; *.fancy text templates. |
build/js-build.json, build/<project>/ |
Browser libraries from npm: the locked projects and the build script that ./moq build-js runs. Its output is under screen/, ignored by git apart from its MANIFEST.json (Build-Test, Browser libraries of a component). |
test/*.spec.js |
Server specs, run by moqui test inside the server's script engine. |
test/client/*.spec.js, test/client/suite.js |
Client specs (HTTP, WebSocket, headless Chromium), run by moqui test-client; suite.js orders them and names the server specs that load their fixtures. |
plan/, docs/ |
In mr-boss: research, design and implementation plans per app, the style guide; reference notes for built apps. |
- Services are XML Actions first. A service's implementation is inline XML Actions in its definition; JavaScript is for logic XML Actions do not express well (§4).
- Scripts are JavaScript (quickjs-oxide, a QuickJS-compatible engine), not Groovy. XML action expressions,
<script>bodies, conditions,${}template text and service scripts are all JavaScript. Groovy's?:and?.habits do not all carry over: use||or??.moqui lint --groovy <dir>reports Groovy left in a component;moqui lint --screensreports idioms and hazards in screen expressions. - A service script module is a file whose last expression is its value, by convention
;({execute: run}). A service calls it withec.resource.script(location).execute(op, context). A module whose top level only declares (functions, constants of literals or tables of them, other modules byec.resource.script("...")) gives the same value for the rest of the outermost script run (the request, job or call on the thread), made once; any other top level (alet, a loop, a call, a change to a table) is evaluated afresh in its own scope on each load. So module-level state lasts at most the run, never into the next request; a cache kept in a module constant lasts the whole run, and a per-call cache belongs in the call (§4). - Screens render in
qvt(the browser: Vue 3 and Quasar),tui(the terminal, as a JSON node document; see TUI "For screen authors"),htmlandhtml-print(print and PDF). Every screen must work inqvtandtui. Arender-modetext for one mode needs its twin for the other. - Decimals are not JavaScript numbers. A
BigDecimalfrom an entity or service supportsadd,subtract,multiply,divide,compare,eq,isZeroandtoNumber;toDecimal(x)makes one. String concatenation callsvalueOfand throws: writeString(quantity).
| Command | Use |
|---|---|
./moq run |
Start the server on the dev conf. |
./moq test <component> [--spec S] [--feature F] |
Server specs on a fresh database (Testing). |
./moq test-client <component> --serve -- --spec S |
Client specs against a started server (JS-Test-Client). |
./moq test-apps |
The regression suite of every app component, before a commit (The two suites). |
./moq accept <component> [--spec S] |
The acceptance suite (test/acceptance/), only when asked or when you add or change an acceptance test. |
target/release/moqui lint --screens [report-file] |
Screen expression lint. The argument is the report's output file, not a screen to check: passing a screen path overwrites that screen. |
moqui lint [service-file], moqui lint --groovy <dir> |
Service expression lint; leftover Groovy. |
moqui tui, moqui tui --server |
The terminal UI, to see a screen's tui rendering. |
- Style guide:
runtime/components/addon/mr-boss/plan/style-guide.md. The shell (§2), the screen archetypes (§3: landing, list, detail, 360, task, board, wizard, report, settings and more), the widget guide (§4), color and status display (§5), states and feedback (§6), devices and breakpoints (§7), and the checklist for a new XML element (§8.1). - Archetype gallery:
runtime/components/dev/example/screen/Gallery*.xmland its.qvuefiles, at/qapps/galleryonce signed in on a dev instance. One screen per archetype; its README lists them. - Reference implementation: the Projects app,
runtime/components/addon/mr-boss/screen/Projects/. For record headers and actions seeProjects/Projects/ProjectDetail.xml(them-record-headerblock); for a landing seeProjects/Home.xml. - Design documents:
plan/design-doc-guide.md(what a design contains),plan/design-crosscut.md(shared screens, cross-app contracts, posting rules), and the per-appdesign-*.md,impl-*.mdandresearch-*.md.plan/initial-design.mdholds the decided app set. - Products notes:
runtime/components/addon/mr-boss/docs/ProductsSharedScreens.md(shared mounts and the shared context) andProductsImplementation.md. - Framework guides in
docs/: Services (errors, transactions, probe calls), Testing, JS-Test-Client, TUI, Moqui-Java-Migration (with the deliberate differences listed in Parity-Diffs), Native-Components, Web-Scripts. - Schemas:
runtime/components/base/framework/xsd/mr-xml-screen.xsd,mr-xml-form.xsd,mr-service-definition.xsd,mr-entity-definition.xsd. Their documentation elements describe MR Moqui's behavior where it differs. - Building: .agents/skills/building/SKILL.md, and the rules in AGENTS.md (failure tolerance, no Node dependency).
- Use Mantle before adding to it. Mantle was ported from Moqui Java's mantle-usl, much of it used in production
for years (
/moqui/runtime/components/addon/mantle-uslin a Java checkout is the original). Before writing a service, find the one that already does it and use it, or extend it with a parameter: payments are created, changed and posted throughcreate#/update#Paymentandpost#Payment(so their SECAs run), applied through theapply#*services, refunded throughcreate#RefundPayment; gateway operations go through the*#SinglePaymentservices and their gateway interfaces; invoices print overget#InvoicePrintInfoand send through anEmailTemplate. Accounting P4–P5 first rebuilt each of these beside Mantle, with its own entities and guards, and the review removed the copies. - Business rules lean to Mantle. A rule about the records (validation, effective dating, rounding, policy, totals)
is a Mantle service in the package of the records it changes, with its own rule test in Mantle, passing under
./moq test mr-mantlealone; an app's specs do not test it again. The app keeps its access check, its screen context and its settings forms. Products' review moved catalog settings writers, bulk price changes, stock totals and cost subtotals from BOSS scripts into Mantle (CatalogSettings.js,PriceChanges.js,get#ProductStockTotals). - No pass-throughs. A BOSS service that only renames a Mantle service adds nothing. A screen calls the Mantle
service after the app's access check (for example in
always-actionsafterget#SharedContext). - Check access in services, from permissions. The check runs where the data is read or written, so it holds for
imports, exports, search, shared mounts and direct requests. Derive capabilities from Moqui permissions
(
ec.user.hasPermission,UserGroupPermissionrows in setup data), not from a map of BOSS group names, and not fromec.user.isInGroupin a service, the palette or a record link. Grant permissions to groups in data. - Reads come from view permissions. Do not make an app's read capability "holds any of its permissions": another
app's group is given an edit permission for its own work (Projects' managers hold
RECEIVABLE_EDITto bill), and it then opens this app's lists, search and links. Give each kind of record a view permission (RECEIVABLE_VIEW,PAYABLE_VIEW), let an edit permission alone open nothing, and spec what a neighboring app's group can reach. - Restricted values stay on the server. A service leaves out of its answer what the user may not read (costs, supplier prices, margins); nothing is fetched and then hidden by the screen. Declare a service's out-parameters: an XML-action or script service returns only the declared ones, read by name (JS-Service-Scripts).
- Compare reason codes, not message text. A policy that refuses returns a code (
denied(reason, message)inmantle/product/PricePolicy.js), and callers test the code. Matching on an error's wording breaks when the wording changes. A new policy module starts with codes, as Accounting'sAccountingPolicy.jsdoes throughmantle/ledger/EntityLib.js(denied,reasonCode). - Shared screens (
screen/Shared/*.xml) takeappRootand compute capabilities on the server through the app's shared-context service; the mounting app's context adds tabs and filters, never authority (design-crosscut §1.1).sharedLinksgives the paths to other shared screens under the current app. - One route per screen. Do not keep hidden alias routes for an old path. When a screen moves, change the links and specs.
References: JS-Service-Scripts (what a service body sees and returns),
JS-XML-Actions (actions and expressions as JavaScript), JS-Core-API (ec.*),
JS-Globals (decimals, dates, the helper objects) and
JS-Framework-Services (the services the framework ships).
- Give each service a
<description>: what it does and what it refuses. - Share parameter lists through an interface: a
type="interface"service (define#MethodParameters) and<implements service="..."/>in each service that uses it. Products had service files of thousands of lines of copied parameter unions before this. An interface holds the in-parameters its services share; each service declares its own out-parameters. An interface that lists every service's outputs is the copied union again, and copying the interface into a second file to reuse it is a copy too: implement the first. - Undeclared in-parameters are dropped before the service runs. A screen that passes
contextpasses only what the service declares.
- Inline XML Actions in the service definition:
entity-find,entity-find-one,entity-find-count,entity-make-value,entity-create/update/delete,service-call,set,if,iterate,return,message. A Mantle service that checks its own permission and organization scope reads and writes withdisable-authz="true"on these actions (and onservice-call), as its script would with.disableAuthz(). A short JavaScript expression in aset fromor a condition is fine. - A script module only for logic that XML Actions do not express well: paging over several kinds of record,
allocation planning, a posting preview, hashing, CSV, date arithmetic. Accounting P4–P5 first had nearly every
service as a one-line
<script>into a module of 1,000 to 1,600 lines, most of it entity and service calls. - No authorization by caller. A service does not read
ec.artifactExecution.getStackNameString()to decide whether its caller may write; it checks permissions. Status rules areStatusFlowTransitiondata thatupdate#checks. - A change reason is the audit row's. Pass
<field>_changeReasonwith an entity-autocreate#,update#orstore#(implicit or declared) and the audit row of that field (enable-audit-log) records it; nochangeReasonfield of the app's own. A message staged until someone commits it isSmsgStaged(the framework's, with Consuming and Cancelled), so no consume job takes it. - Writing as the system. A service that has checked its caller and must write what the caller may not (a page
space with
restrictUpdate) usesec.artifactExecution.runAsSystem(() => ...): no user, authorization off, the same transaction. Only a service's own code may call it (The system scope); never grant the user a row for the write. Records written inside have no user, so pass the acting user where the write takes one (update#WikiPagehistoryUserId). - No EECA guarding an entity that only its own module writes, and no EECA or SECA on a hot path (every
PaymentorAcctgTranswrite, a framework entity,service=".*") without a narrow<condition>. - Nothing for tests in production files. Test entities, services, SECAs and scripts under
test/are not loaded byentity/orservice/files; a spec makes its own data and faults. - Sequenced ids (
entity-sequenced-id-primary, thecreate#services), notec.user.randomString; status and kind fields areStatusItemorEnumerationids with relationships, not free text.
The script engine interprets its bytecode, with no JIT, by design (Build-Test). A typical service or screen spends its time in entity finds, service calls, the conversions between script and framework values, and rendering, not in its own loops, so XML Actions and scripts stay the default. Heavy work goes to Rust:
| Work | Where |
|---|---|
| Finds, service calls, conditions; screen and template logic; per-request work over tens to hundreds of records | XML Actions, or a script module where they do not express it well |
| Work many apps repeat: serializing, sorting, filtering, grouping and totaling lists, escaping, formatting, parsing | The framework's helpers: JSON.stringify and JSON.parse, orderMapList, filterMapList, CollectionUtilities, StringUtilities. A missing one is a framework API to add, not a loop in each app |
| Loops over thousands of rows or more; numeric work (MRP, costing, scheduling, allocation); reading or writing formats such as EDI, CSV or binary files; work that runs hot across many requests | A native service in Rust (Native-Components) |
- Keep the loop on one side. Every call between a script and the framework converts its values. A helper that takes the whole list and loops in Rust is fast; one called once per element can be slower than plain JavaScript.
- A timing decides. A script is a file the server loads; a Rust service is compiled into the binary, so it needs
./moq build, a new binary for the set of components, and a license and advisory check of any crates it adds. Move the part a timing shows is hot, not a whole service by default.
-
One module per area, with named functions and an explicit table of operations. An unknown operation throws:
const operations = {context, stock, projection, policy, storeFacility, storeTracking} if (!operations[op]) throw new Error("Unknown stock operation " + op) return operations[op](parameters)
-
Put shared helpers in one library module (
ProductsLib.js:find/one/rows/rowsIn,ms,dateText,blankToNull,enumOptions,page), not a copy in each file. Copies drift: Products had three versions of the empty-value check and two date conversions with different results. -
Per-call state (the app route, cached access, record reads) lives in an object made for the call (
lib.forCall(appRoot)), not in module variables. -
Write code people read: real names for variables and functions, short lines. Products' first scripts averaged 150–300 characters a line with one-letter names; the review rewrote them as named functions and ran Prettier (§8).
-
Separate authorizing a write from building a screen's context. A write that builds the whole screen context to check access does every read twice.
- Put conditions, ordering,
limit/offsetandcount()in the entity find. Do not list a whole table and filter it in JavaScript. - Read names and related rows for a list in one
inquery (rowsIn), not oneone()per row. Check the visibility of many records in one call, not one call per row. - Use
.selectField(...)and.distinct(true)when only a few values are needed. - Cap lists that could grow without bound (a dropdown of every product capped at 200 is not a dropdown; use a server-search choice, §5) and paginate long lists.
- Search ignoring case, in the query, before the limit:
makeCondition(field, "like", "%" + term + "%").ignoreCase()on the record's names as well as its id. Filtering in JavaScript afterlimitfinds nothing past the first page, and a plainlikemisses "Cash" for "cash". makeConditiontakes three arguments for a value:(field, "equals", value). With two, the second is read as the operator. Andnot-equals "Y"leaves out rows where the field is null; add anis-nullalternative when null means "not Y".- Files through
ec.resource, never their storage entities.DbResource*,ContentBlob*,GitObject,GitRefandGitLfsObjectare thecontentgroup, in a database of its own (Run-Deploy): no view-entity, relationship with a foreign key, or find may join them to an application's entities. Keep a file's location on the row (contentLocation) and read and write the file withec.resource.getLocationReference(location). A test fails when a service, screen or script names them.
- As AGENTS.md says: when one independent item fails (a row, a facility, a record of a list), log an
error naming it and go on with the rest. Wrap each item in
try/catch. - A call whose failure the caller expects and gets past runs as a probe, in its own transaction, with
ec.message.pushErrors()/popErrors()around it (Services "A probe call"). Clearing the errors does not clear the transaction's rollback mark. - Check concurrency: pass
lastUpdatedStampor the service'sexpectedRevisionback on update so a stale write is refused.
A setting an operator sets per deployment is an attribute of a conf element, with its default written literally there;
there is no default-property and no ${name} in a conf attribute (the boot refuses both). Its name everywhere else is
its selector, chat@view-once-days or chat/stickers@max-bytes, and the environment sets it by the name built from the
same path, moqui_conf__chat__view_once_days (Run-Deploy).
- A component's setting goes on the component's own top-level element in its
MoquiConf.xml, named for the component and holding every setting of it, with the defaults and a comment saying what each does: mr-pass'spass, mr-mantle'smantle, basic-comms'comms. Another component that reads it gets null when that one is absent. Group a set of related settings as a child element (chat/stickers), not as prefixes on one element's attributes. - A framework setting goes on the framework element it belongs to in
MoquiDefaultConf.xml(a new element when no existing one fits), with its attribute inmr-moqui-conf.xsdand its element in the conf schema (crates/moqui-core/src/context/conf_schema.rs: its reload class, its key when it repeats, a secret's mark), and a merge rule inconf.rsfor a new top-level element or a new child. - Reading it: a script reads
ec.factory.getConfValue('chat@view-once-days')(null for a secret; a secret is named to a host function such asRestClient.addPropertyHeader); Rust readsconf_env::setting("...")or the factory'sconf_setting. A spec sets one withsetConforwithConf, neversetProperty.System.getPropertyis for process properties that are not configuration: a test run's switch, the state the server sets as it runs.
A component shows in System › Operations › Health, the System home's attention list, the support summary and the
settings index (and in an app that shows those screens, such as IronStone Admin) by seed rows of three framework
entities, read by org.moqui.admin.ReadinessServices
(JS-Framework-Services; the rules a hand-made request meets
are in Attack-Surface). The fields are described in
runtime/components/base/framework/entity/ServerEntities.xml; the framework's own rows are in
framework/data/AdminConfigurationData.xml.
- A readiness provider (
moqui.server.ReadinessProvider): a key, an owner, a title, a group, the permission a reader needs and a service. The service takesproviderKeyand the scope parameters the row names (scopeParameters, such asorganizationPartyId), changes nothing, and returnschecks: each{checkKey, title, state (ready, warning, failed or unavailable), reasonCode, message}and, where it applies,subject(whom or what it is for, in words),scope(the scope parameters that narrow a request to it),watermarkandcoverage(a data source's freshness, with the row'sexpectedFrequencyMinutesandmaxLagMinutes). It checks the caller's permission and scope itself and refuses with a reason code (PERMISSION_DENIED,RECORD_UNAVAILABLE), which leaves the provider out for that caller; any other failure shows it as not checked. A row whose registration names a scope is an organization's or a store's check: Health shows it, the System home does not. - A place is a key, never a path. A row's
fixRouteandfixId, a check's ownfixRoute,fixIdandfixParameters, and a settings entry'sdestinationRoutename a route the application showing them resolves (Mounting the administration screens): the framework's keys are intools/template/AdminMount.js, an app's own are in its mount (mr-bossAdmin.jsmountRoutes). A key with no route where it is shown is no link. - A refresh operation (
moqui.server.RefreshOperation): a key, the permission that runs it, the provider whose source it refreshes and a service, called withrefreshKey,operationKey,reasonand the scope parameters the row names. - A settings entry (
moqui.server.SettingsEntry): a key, a title, a group,destinationRouteandscreenLocation, the screen whose authorization decides who is shown the entry (the caller's own grants, counted down the component's screen directory), with an optionalviewPermissionand theproviderKeyof what it configures. An app that shows a framework settings screen under its own root seeds the entry again, under the same key, with its ownscreenLocation. - The registration adds no right. A registered service is called as the user, and the registry's own grant is not inheritable: outside an app's screens a caller needs a grant of the service itself, which the component's setup data gives to the groups that should read it.
- No hard-coded defaults for currency (
'USD'), units ('OTH_ea'), languages ('es') or purposes. Take them from the organization's settings, then the user's preferences, else leave the choice empty for the user. - Dates in the user's zone:
ec.l10n.format(date, pattern), nottoISOString()and aUTClabel. This holds in specs too: a day computed withtoISOString().slice(0, 10)is tomorrow's from evening on in the Americas, and a spec that locks "yesterday" that way fails every evening. - Display values come from the service. A row for a screen carries its display text: dates as text in the user's
zone (Accounting's
AccountingPolicy.displayadds a<field>Textfor each date and stamp), names for ids, status names. JSON drops date types, and a screen that loads a script module to format dates evaluates the whole module on every render. - Amounts round to their currency (
ec.l10n.roundCurrency), not a fixedsetScale(6). - Changes by effective date: a policy, price or setting change starts a dated row and ends the one in effect; history stays readable.
References: JS-Screen-Scripts (actions, transitions and widget expressions) and
JS-Templates-Macros (render modes and sri).
- Element order follows the XSD:
parameter,always-actions,transition/transition-include,subscreens,pre-actions,condition,actions,widgets,fail-widgets. In a form-list: the fields, thencolumns(includingcolumns type="mobile"), thenview-board. always-actionsstay small: the shared-context check and what every subscreen needs. A subscreen rendered on its own (a standalone tab render, a TUI tab) runs its parents'always-actionsbut not theiractions, so data a tab needs from its parent goes inalways-actions; everything else goes in the tab's ownactions. A screen path rendered with a trailing/renders the default subscreen's widgets, not the parent's.- A detail screen reads its record in
actions, notalways-actions.always-actionsalso run for each request to a transition, so a read there runs on every drop-down keystroke of the screen'schoices. Read it withtransaction="force-new" ignore-error="true", setrecordFound, and show a "Not available" state that links back to the list (ProjectDetail), instead of failing the page. - Do not repeat the access check in every transition and section. Check once in
always-actionsand readsharedMountContext.capabilitieswhere a widget depends on a capability. - A server-static screen sends only what its template reads. Its
GET {screen}/actionsholds the context names the compiled template reads, and a form-list's rows its fields and what the template reads; a name kept is sent whole, so keep a value the browser must not see out of a map the template reads. A name the template reads by a computed name, or a client component reads by itself, goes in the actions element'sclient-context(JS-Screen-Scripts). - Shared transitions go in a
transition-includefile (template/CatalogChoiceTransitions.xml), not copied into each screen. Atransition-includecopies one transition by its name: a template with several needs one include per transition, and a form whosetransitionis not on its own screen posts to nothing. Shared widgets go in asection-includeof the same file (template/AccountingParts.xml: the organization picker, a list's find form, report options). - Screens that differ only by record kind share one template. Accounting's invoice and bill screens were 5-line
diffs of each other; now each route screen sets the kind in its actions and includes
template/AccountingDocuments.xml's sections. Look for such pairs in the diff before calling a phase done. - Declare only the parameters a screen reads. A transition's response adds every declared parameter of its target
that is in the context, so a copied block of parameters carries stale values to other screens (Accounting's
delete of a draft went back to a list filtered by the deleted id). A response then needs no
parameterlist beyond what the target lacks. - A form's
mapfalls back to the context. A field missing or empty in the map takes the context's value, so an empty map does not keep a form blank, and an Edit form thatextendsan Add form in a list row reads the row's values. Do not keep a page variable named like a field of a form on the page unless the form should show it. - The screen context holds data, not functions. A
setof an arrow function fails when the context is converted; compute the values instead. - A transition with no actions is a link. The form that targets it renders as a GET link form (
m-form-link), which does not post a row-selection's checked rows. A row-selection action that opens another screen with the selection needs at least one action in its transition (Products'bulkPricenormalizes the id list). - Open a dialog after a reload with the
_openDialog=<dialog id>parameter, for "edit this row" links that reload the page with the row selected. - Links:
target-window="_blank", nottarget. Other screens of the app throughsharedLinks, not literal paths.
An app shows a framework screen (System's administration screens, the Dashboards screens) under its own root instead of copying it, as IronStone Admin and Insights do. The two contracts are Mounting the administration screens and Mounting the report screens; the record of the two moves, with the findings behind these rules, is plans/archive/Admin-Screens-Down.md.
- Three ways, chosen by what the app's authorization rows name, what the framework screen has and what the app
adds:
- By location: a
subscreens-itemof the app's area names the framework file, and the app has no file. Only when no grant of the app names the screen or a transition of it, the screen has no transition that is the instance administrator's alone, and the app adds nothing. - A thin wrapper at the app's own location:
include-screen share-scope="true"and onetransition-includefor each transition the app offers. A transition that is not taken in does not exist on the app's route. This is the way when a grant of the app names the screen or its transitions, and when the framework screen has transitions the app must not offer. - A screen of the app's own, with its own
actionsand transitions, around the framework screen's named sections and forms (section-include,form extends). This is the way when the app adds something inside the screen: an organization as a filter or a scope, a column, a box, a check before an action.
- By location: a
- A grant names the app's own screen, never a framework location. A grant on a framework location opens it under the framework's own app too, past that app's check. An app's inheritable always-allow on its area skips every check below it (transition, service, entity), so a transition the app must not offer is kept off its route, not refused on it.
- Mount context is data, never authority. The app's root sets the map (
adminMount;reportLinksandreportPolicy) in itsalways-actions, so that transitions read it too, and the framework's own roots set it to null, so a request parameter never supplies one. It says where links go and which values of the app's policy apply. What a value allows is enforced by the transition, which reads the map and never a parameter, or by the service it calls; a list of what is offered gives no right. A service's context is its own: a module function an app calls from a service sees no mount, so the service passes it what it needs (a range, fixed variables). - What the engine does that an author of such a screen meets:
- A form nested in a field of an extended form is the other screen's and is not found: override that field with a
form of the app's own. A field of an extended form-list is replaced whole by a field of the same name, and
section-includereaches a section nested in another. - Two paginated lists on one page share
pageIndex. Show the second in place of the first, by a parameter, not beside it. - A link carries every parameter its target declares that is in the linking screen's context (a page index, a range
of dates, a find value), and a screen mounted by location declares all of its parameters on the app's route. An
empty value in the link's own parameters leaves one out: a list that links another screen's record sends its own
find values empty, as a link that leaves a mode does. A menu entry or tab carries them too, but one for a screen
other than the one shown leaves out the list's page, page size and sort (
pageIndex,pageSize,pageNoLimit,orderByField). - A screen path that names the app's root (
//Admin/...) does not resolve where a spec renders with the app's root file as the root. A mount's routes are relative to a screen of an area, which holds under any root.
- A form nested in a field of an extended form is the other screen's and is not found: override that field with a
form of the app's own. A field of an extended form-list is replaced whole by a field of the same name, and
Follow the style guide's archetype for each screen, as the Projects app does. In particular:
- Record header on detail and 360 screens (style-guide §3.3, §3.4), as in
Projects/Projects/ProjectDetail.xml:m-record-headerholdingm-record-title(a key chip, an h5 name and a caption of facts),m-record-status(astatus-baror a state chip),m-record-foot(tags, links) andm-record-actions. Readers see the same header with fewer actions, not a separate label stack. - One primary action, chosen by status (Approve, Publish, Activate; New when there is no record yet):
btn-type="primary"on a link,type="primary"on acontainer-dialog. The other actions go in abutton-menu"More" withicon="more_horiz". - An action the user lacks the authority for is shown disabled, not hidden (
disable-conditionwith adisable-messagein the user's words, on alinkor acontainer-dialog), so they see it exists and can ask for it: "Exchange rates are maintained by a finance administrator of every organization" on Currencies' Add exchange rate. A screen's actions read the authority from the service (amay*or capability flag), never decide it, and the service still refuses. Keep hidden (condition) what makes no sense in the record's state, row actions and More-menu items that would crowd every row or the menu, phone and terminal-only compact screens, and links into an app the user does not have. - Ends and deletes use
btn-type="danger"and aconfirmationthat names the record. Activate, publish and generate confirm too. - Landing screens use
number-cards in adashboard, each linking to a filtered list, shortcut buttons with one primary, and an empty state that offers the first steps (Create, Import). The screens an app home features arenav-cards in adashboard: an icon, a title, one line of text and up to three childlinks. - Tabs use
subscreens-panel type="tab"(orsubscreens-menu type="tab"withsubscreens-activeinside a tab) with an explicitmenu-indexon each item, in the design's order. - Do not wrap one button in a box. A box whose body is a single dialog button belongs in the header's actions or
in the
box-toolbarof the box it acts on (Add component on the Draft changes box). - Hide empty boxes with a section condition, and show an empty state where the user needs to know why there is nothing ("This product has no manufacturing method yet. Start one with New method.").
- "Not available" states link back to the list.
- Phone columns on every list a phone sees:
columns type="mobile"with two columns. The first holds the record link and its name; the second the amount or state and the row actions. Products' first pass gave many lists only an ID and a state, so phone users could not see a product's name or a price's amount. - The first column is the record link.
- Names, not IDs:
display-entity(mantle.party.PartyDetailwithtext="PartyNameTemplate",moqui.basic.Enumeration,moqui.basic.Uom,moqui.basic.StatusItem), or a*Name/*Textthe service returns. - Amounts with
currency-unit-fieldandalign="right"; quantities withdisplay format="#,##0.###"andalign="right". - States as chips: a
render-modewith aqvttext<q-chip dense square class="q-ma-none m-tonal text-${color}">and atuitext built withJSON.stringify. Atuitext must be JSON produced byJSON.stringify({t: "text", text: ...}), never JSON with${}pasted into it. - Row actions in the row (style-guide §4.4): inline
container-dialogs for the common actions (Schedule, Correct, End), and a "More" menu for the rest; not a box of per-row forms below the list. - Bulk actions are
row-selectionactions on the list, not a separate screen where the user types IDs. paginatelong lists;select-columnson main lists.- Pagination comes from the service. A list a service pages returns its
<list>PageIndex,PageSize,PageMaxIndex,PageRangeLowandPageRangeHigh(ProductsLib.page, Accounting'sfind#Records). A short, bounded list (a preview's findings, an audit trail, a document's lines) ispaginate="false". Never set the page fields by hand to fake one page: Accounting P2 had sixty such lines. - A row action's dialog id carries the row's key (
EditLine_${acctgTransEntrySeqId}); a fixed id repeats on every row.
- Choose records with server-search drop-downs:
drop-downwithdynamic-options transition="choices" server-search="true" min-length="0", through the shared choices transition, which also returns the label of the selected value. No text inputs for IDs, and no drop-downs that load every record. The choices service is a table of named sources, like an operations table: each finds its authorized rows, searches its fields in the query (§4), and reads a selected value outside the page on its own; an unknown choice throws. A spec calls every choice once with a selected value that is not in the page. - Closed lists (languages, currencies, units, types) are drop-downs from the server's options.
- Wording: dialog titles and buttons in the user's words, saying what they do ("Edit category membership",
"Review price changes"), not form names. Hints go in
tooltip, not in the field title ("Through", not "Through (exclusive)"). Option labels are words, not code tokens (financialType). Titles in sentence case. - No implementation words in the UI: "phase", "later", "scheduled", "placeholder". An area that is not built is left out of the menu, and its page says what it is not yet, in the user's terms.
- Group related fields with
field-layout,field-rowandfield-row-big; a wide dialog uses two columns.
- The XML declaration, the component's full license header (copy it from a neighboring file; a one-line "See
LICENSE.md" is not it) and a final newline in every file; one element per line; 4-space indentation. A rewrite of a
placeholder keeps its header and its section's
menu-image. - Lint every changed screen (
moqui lint --screenswith a report file) and keep its idiom count from growing.
- Use one only when the XML widgets cannot express the screen (the variant builder's matrix, a board or calendar
beyond
view-board/view-calendar). Prefer extending a widget (style-guide §8.1) when several screens need it. - A
.qvuesits beside an XML screen that declaresrender-modesandserver-static, and keeps its transitions, parameters and authorization in that XML. It has atuitwin: a<Name>.tui.jsonbeside it (usually onecomponentnode registered by name, as the gallery'sBoard.tui.json), or a separate XML screen (VariantBuilderTui.xml). - Use the
m-*inputs and the shell's feedback (moqui.notifyMessages, a$q.dialogconfirm) so it looks and behaves like the XML screens: one primary button at a time, a count in the confirmation of a bulk action, result boxes only when there are results. - The gallery's
Board.qvue,Calendar.qvueandQuickTask.qvue(runtime/components/dev/example/screen/Gallery/) are the patterns.
There are two suites (The two suites, the
testing skill): the regression suite (test/), small rule tests run while
working and before every commit, and the acceptance suite (test/acceptance/), complete scenarios run on a schedule,
before a release or when asked. Say which suite a new test goes in, and why. Regression tests check rules, not pages:
write one for a business rule you add or change (its result and its refusals) and for a bug you fix. What to run before
a commit, by what changed, is the pre-commit skill: ./moq test-apps for
application work, and the Rust checks as well when the change reaches a crate.
- Each expression statement directly in
thenorexpectis a condition. A comparison inside anif, a loop or a helper function is not checked. Products' first shots specs had their page checks inifblocks, and those checks never ran (F46). Useassert(condition, message)for a nested check, or compute a problem string and compare it at the top level. - No full walks. No regression spec walks every screen of an app or of all apps, or renders every screen in every mode; these
have been deleted before and keep coming back. Rendering as such is the framework's (its goldens and
moqui lint --screens); a sweep is an acceptance test, one per app per mode. A screen is rendered at most once in each mode across the regression suite, and that one render carries all of its checks (content, access, a value that must not show). Render a screen in a second mode only where the modes differ, that is, where it has its own qvt or tui template (.qvue,.tui.json, arender-modesection); say which template the check covers. A screen whose content depends on data needs a check text present whatever the data. - A widget that fails renders its error into the output, not into
errorMessages: a check of status 200 and no error messages passes a broken page. Check the output forError renderingandException in render, and check a text the page shows. List rows are in the html render; a qvt render needswithStaticData()and the app root withlastStandalone: "-2", and a chip that has only qvt and tui texts is in neither html nor print. - Access is checked per rule, not per service or route. An access rule gets one holder and one non-holder on one
verb of the rule, and another organization's record refused, in the app's one access spec (about seven features,
with authorization on; no
where:doubling of authorization on and off). An access or isolation walk over every route and group is an acceptance test. The negative case must fail for the permission: use the same parameters as a positive case that succeeds, or compare a reason code. A helper that counts any error as a refusal passes on a validation error (Accounting'sstore#DraftEntrywithout its fields was "refused" for everyone). - A spec of a control's absence also checks its presence for a user who has it: Accounting checked that readers do not see "New batch", a button that was named "New journal batch".
- Spec helpers an app's specs share (sign in as a user, the demo record ids) go in one place, not a copy in each spec; four copies of Accounting's demo ids disagreed about an account.
- A spec line that begins with
(or[continues the line before it (no semicolons): compute the value inwhenand compare it inthen. - A Mantle spec creates its own data and does not depend on BOSS.
- Run the specs of the screens and services you touched while working (
./moq test <component> --spec ...), and./moq test-appsbefore a commit. Run an acceptance test only when the user asks, or when you add or change one. - Keep a spec fast. A regression spec runs in well under a second as a rule; one over 15 seconds fails the run,
and a component over 1.5 times its budget (
test/budget) fails it too (The regression budget). Cut duplicates or move the scenario to acceptance rather than raise the budget, which needs the user's agreement. - A test earns its place by the regression it catches. Do not add a feature that repeats another with a different
user, mode or flag (
where: bothdoubling, every role of a group) unless that difference is the rule under test.
- No screenshot specs. A spec asserts what a page shows; it does not save images that no one compares or looks at.
To look at a screen, take a screenshot while working (the browser tools, or
page.screenshotin a spec run by hand) and do not keep it in the suite. A failed browser feature still writes its ownfailed-*.pngfor debugging. A phone-width (390 px) check is an acceptance test; a theme is checked only where a feature depends on it. - Open the browser pages in
setupSpec, one per user and width. Module variables are not shared between cases. - Walks. The regression suite has one golden-path client walk per app (
test/client/), kept current. Every other walk is an acceptance test (test/acceptance/client/): a plan's "usable when" scenario, server side through the screens' transitions or in a browser, a phone-width check, an access or isolation walk. A walk has a user with only the needed grants, every click a user makes, and an assertion of the result. - Click what the user clicks. A menu item that holds a dialog or link is a
q-itemaround a button: click the button (.q-menu button, .q-menu a), not theq-item, which does nothing (F43 was this test mistake). Scope a header menu to its own actions container: a 360 screen has more than one "More". - Find rows by the record they show (a link with the record's id), not by position.
- Do not run client specs while editing the screens they cover: the run loads the spec files at its start and the screens as they change.
- A client failure that also fails at the commit before your change (for example a PDF without Chromium) is recorded as such, not "fixed" by changing the test.
- JavaScript (service scripts and specs) is formatted with Prettier, used as a one-off tool, not a dependency, with
the repository's
.prettierrc.json:{"semi": false, "tabWidth": 4, "printWidth": 130, "bracketSpacing": false, "trailingComma": "none", "arrowParens": "avoid", "singleQuote": false}with--parser babel. Prettier finds the file from the formatted file's directory; Prettier run with its defaults (width 80,{ a }, trailing commas) is the wrong style, as Accounting P1–P3's scripts and specs were. Spec conditions are found by syntax, so formatting a spec is safe. After formatting a service script, check that its module value is still the last expression. - XML: only
XMLLINT_INDENT=" " xmllint --format, then confirm with a canonical comparison (xmllint --c14nof both versions with blank text removed) that only whitespace changed before replacing the file. Another formatter writes" />and reorders attributes. - Scripted edits assert that each old text is present exactly once before replacing it; a replacement that matched nothing looks like a passing change. Re-indent a moved block to its new depth.
- Commit per phase and per repository, with the tests run named in the record (
plan/impl-<app>.md).
- Business rules in Mantle with Mantle specs; the app keeps access, context and settings; no pass-throughs.
- Access checked in services from permissions; restricted values left out of answers; out-parameters declared.
- Scripts: one module per area, named functions, the shared library, bounded queries, failure tolerance per item.
- No hard-coded currency, unit or language; dates in the user's zone; amounts rounded to their currency.
- Screens follow their archetype: record header, one primary, More menu, danger and confirmation on ends.
- Every list has phone columns with name and amount or state, names not IDs, amounts with currency, states as chips.
- Records chosen with server-search drop-downs; no typed IDs.
- Empty boxes hidden, empty states explained, user wording in titles and buttons.
tuitexts built withJSON.stringify.- Every detail screen has the record header and a not-available state; every ending, bulk or irreversible action confirms, naming the record or the count.
- Screens that differ by record kind share a template; each screen declares only the parameters it reads.
- Mantle's services used or extended, not rebuilt beside them; service implementations in inline XML Actions, script modules only for complex logic; no caller-name guards, no self-guarding EECAs, nothing for tests in production files.
- The phase's regression tests for the rules it added pass,
./moq test-appspasses within budget, andmoqui lint --screenshas no new idiom sites. The plan's "usable when" scenarios are acceptance tests to write, named in the plan; running them is not part of done. - A mechanical pass over the changed files:
isInGroup(in a service or script;PageRangeHighset in a screen;toISOStringin a script or spec;getStackNameString,ec.user.randomStringfor an id,ec.context.putAll(ec.resource.script(, and acomponent://.../test/location in aservice/orentity/file;likewithoutignoreCase, and alimitbefore a JavaScript filter;- a form whose
transitionis not on its screen; - more than one
type="primary"/btn-type="primary"on a screen at a time; " />and the one-line license header in XML, and a longparameter-mapor expression that could be named once inactions(report options, a record's link parameters);- Prettier with the repository's config shows no change.
- The design and implementation records updated: what was built, the commits, the findings, and what is left for later.
- What the phase made reachable is recorded in the attack surface map, in the application's file:
Attack-Surface-Apps-BOSS for mr-boss and the Mantle services staff reach,
Attack-Surface-Apps-PASS and its two companion files (Commerce, and
Forum and Smithy) for mr-pass and the Mantle services its operations reach. A framework hook the phase added goes in that area's framework file
(index), never in the index.
Commands in a record name no machine's paths (
/Applications/...,/tmp/...): point to Build-Test for the Chromium setting, and to a report file of the reader's choosing.