ADL 0.6.0 reference · Review draft 1 · November 14, 2026.
Contents · Source map · Evidence
The 0.6 edition note
This chapter retains the detailed language contract and its source-specific observations. Its chapter number and numbered sections remain stable. The 0.6 additions do not by themselves change this subject’s defaults or supply fresh execution evidence for it.
Reverification should cover stored versus query-time computation and dependency propagation. Use the original examples and evidence links below to recover the earlier test context. The new edition’s source map records this chapter as inherited detail; the current draft does not claim those historical tests were rerun.
Retained reference detail
The numbered sections below are carried from 19-computed-fields.md. Their original baseline and evidence remain attached to the source. Statements about “current” or “checked” behavior in this retained text refer to those original observations unless the edition note explicitly updates them. This is a consolidated draft, not a claim of complete re-verification.
19.1 Scope of this chapter
A computed field derives an output from a formula. It belongs in a resource’s
computed mapping, separate from the client-writable object fields.
This chapter owns the declaration, inferred kind, evaluation schedule,
dependency ordering, storage, and observable computed result.
ADL 18 owns AEL syntax and functions. ADL 20 owns validation; ADL 23 owns rule-maintained values; ADL 40 owns Sheet Mode’s separate recalculation and override mechanisms. Ordinary computed fields do not inherit Sheet Mode guarantees. ADL 17 owns migration and version admission.
The converted body (v0.5.0, retired)
and legacy declaration tables (v0.3.1, retired)
are the inherited sources. Their reconciliation history (v0.3.1, retired)
already corrects the former claim that computed formulas cannot use AEL.
Further corrections are necessary: dependency ordering is now implemented,
an empty updateOn recalculates on every write, and value-array aggregates
work in virtual formulas.
Source review uses 56060102. The checked Linux Release artifacts come from
../kalos-clone-a and use compatible archived c8cd9d7c headers; only the
documentation adapter was compiled. Evidence
separates those artifact identities from source review. Observed behavior
and implementation limits below do not silently amend governing rules.
19.2 The three kinds
The author supplies stored and a formula; the implementation infers the
kind. There is no supported kind selector.
| Declaration | Intended kind | Work performed |
|---|---|---|
stored omitted or false | Virtual | Evaluate against the response record; no computed column |
stored: true with an ordinary formula | Materialized | Evaluate on a create/update path and persist selected results |
stored: true with a relationship aggregation form | Aggregation | Maintain a column using related-record SQL and event subscriptions |
A minimal fragment for ordinary calculations is:
computed:
storedTotal:
type: decimal
formula: round(quantity * unitPrice, 2)
stored: true
updateOn:
- quantity
- unitPrice
19.2.1 Declaration vocabulary
| Key | Value | Default or requirement |
|---|---|---|
type | ADL field-type name | Required by the inherited declaration tables; describes the intended output |
formula | Expression string | Required by the inherited declaration tables |
stored | Boolean | False |
updateOn | Array of strings | Empty; materialized fields recalculate on every write; aggregation fields synthesize create/delete triggers |
reactive | Boolean | False |
recomputeOn | Array of Resource.event strings | Empty; no reactive subscription |
Use types from ADL 10. A computed declaration is not a
general object-field declaration: additional keys such as kind, default,
required, or description are not retained by the checked computed parser.
A type declaration does not currently enforce the runtime result’s type.
Admission limits: missing or unknown computed types become string;
a missing formula is retained as an empty formula; a nonmapping computed
block or scalar entry is silently skipped. A string-valued updateOn is
ignored, becoming an empty list and therefore changing materialized scheduling.
The linter reports EMPTY_FORMULA and warns INVALID_TRIGGER for unknown
undotted triggers, but those checks do not make document admission fail.
A nonboolean stored produces a native JSON type exception captured by the
adapter; this evidence does not establish a stable request error envelope.
Keep the required keys and value shapes even where the parser is permissive.
Do not reuse an ordinary field’s name for a computed field. The checked
virtual collision replaces that field in responses while its stored input
remains unchanged; a stored collision reaches DDL and fails with
MIGRATION_ERROR.
19.2.2 Kind detection is currently sensitive to spelling
The implementation tests the literal formula string. For aggregation it
requires one of count(, sum(, avg(, min(, or max( at the beginning,
a final closing parenthesis, and a nonempty argument. It does not trim the
string despite the local variable’s name. The argument is split at its first
dot into relationship and field.
| Stored formula | Observed classification |
|---|---|
sum(lines.amount) | Aggregation, relationship lines and field amount |
sum(lines.amount), sum(lines.amount) , sum (lines.amount) | Materialized |
sum( lines.amount ) | Aggregation with the spaces retained in target/field names |
sum([1,2,3]) | Aggregation with nonexistent relationship [1,2,3] |
(sum([1,2,3])) | Materialized; evaluates the array sum |
sum('adl.sales.sales.Line.quantity') | Aggregation with target 'adl; not AEL address resolution |
Adding stored: true can therefore change the evaluator as well as storage.
The checked virtual sum([1,2,3]) returns 6. Its stored spelling is
misclassified and remains at the column default 0; parenthesizing the
formula takes the materialized path and stores 6. This is an implementation
distinction, not a recommended way to encode intent through whitespace.
The inherited blanket requirement that every aggregation function must use
stored: true is too broad for AEL value-array functions. Relationship
aggregations in §19.4.2 need storage; an in-record array calculation can be
virtual. ADL 18 §18.7
separates value arrays, resource targets, and their overloads.
19.3 Evaluating a formula
An ordinary virtual or materialized formula first runs through AEL in
Computed scope. The host binds $this and record to the record, with
bare identifiers falling back to $this. It supplies no request identity
and no domain/query handler. AEL auth/state functions are disallowed.
If AEL successfully returns a value, including null, that value is final.
If AEL returns an error, the whole formula is retried by the lightweight
computed evaluator. The author cannot select the evaluator. AEL comparisons,
logical operators, ternaries, ??, clock functions, and value-array functions
can work without any fallback.
The following are expression fragments:
round(quantity * unitPrice, 2)
quantity > 1 ? 'many' : 'one'
sum([1, 2, 3])
record.quantity * 2
Missing input names can produce a successful null without reaching fallback. A formula unsupported by both paths usually returns null; that is not the only failure outcome, and storage adds another conversion step (§19.6).
19.3.1 The lightweight fallback changes semantics
The fallback retains these function names from
plugins/adl/src/runtime/computed_engine.cpp:
| Family | Names | Relevant distinction |
|---|---|---|
| Text | concat, upper, lower, trim | Legacy conversions may accept values rejected by AEL |
| Padding | padStart, padEnd | Numeric input can be converted to text |
| Conditional/defaulting | if, coalesce | Computed-only functions; not global AEL functions |
| Rounding | ceil, floor, round | Lightweight round returns an integer and ignores a second precision argument |
| Text counting | wordCount | Counts whitespace-separated words; also reads string content values from block arrays |
It also has numeric + - * / arithmetic, with division by zero returning
0. This does not grant it AEL’s grammar for nested arguments.
| Formula and inputs | Observed computed value | Why it matters |
|---|---|---|
coalesce(null, 7) | 7 | AEL’s unknown-function error is replaced by a value |
padStart(quantity, 3, '0') with quantity 2 | '002' | AEL type error falls back to numeric-to-text padding |
coalesce(round(unitPrice, 2), 0) with price 12.5 | 13 | The entire formula falls back; nested round is the lightweight integer operation |
if(quantity > 1, 'yes', 'no') with quantity 2 | 'no' | The fallback cannot evaluate that comparison as an AEL condition |
1 / 0 | 0 | AEL runtime failure becomes a plausible numeric result |
notAFunction() or quantity + | null | No computed error response |
firstName ' ' lastName | null | The inherited space-concatenation example is not supported by the checked tokenizer |
Use the AEL ternary for an AEL condition. Do not assume a formula with
computed-only if or coalesce evaluates its arguments through AEL first.
The independent modeller returns 12.5 and 'yes' for the nested-round and
true-comparison examples, so its formula evaluator is not a substitute for
checking the consuming host.
AEL limits also do not bound both stages together. The checked 4,097-byte
quoted string fails AEL’s length check but succeeds through fallback; forty
nested upper calls exceed AEL evaluation depth but return 'X' through
fallback. These are observed consumer limits, not amendments to ADL 18’s
engine limits.
19.3.2 Query availability is a host property
AEL’s target intrinsics are scope-permitted in Computed, but ordinary computed
fields have no query handler. A quoted findOne('adl.sales.sales.Line')
formula is admitted and returns null. Making a formula reactive does not add
a handler.
A stored formula beginning with sum( can instead enter the legacy
relationship detector before AEL is invoked. A full quoted AEL address and
the old three-argument form sum(Line, 'quantity', true) are both admitted
as unusable relationship targets and remain at their stored defaults in the
checked examples. This is not successful support for those AEL forms.
Draft 05 §14’s folded target grammar and the Phase-15
Refactor-ComputedHandler debt are documented in ADL 18.
The old reactive three-argument example is historical; do not present it as
a current accepted target formula. The relationship SQL mechanism below is
a separate implementation, not a way to obtain AEL cross-domain query support.
19.4 Triggers
19.4.1 Materialized fields and updateOn
On an ordinary create/update path, and on a named transition (#1105), the
runtime persists writable inputs, builds a calculation record, evaluates
materialized fields, writes selected computed columns, and refetches the row
for the response. A transition’s changed-field list is the state field, the
body fields, its sets fields, and updatedAt, so a formula over the state
field follows the transition.
An empty or omitted updateOn means recalculate on every create/update
path. The conversion’s “once on create and never again” statement is
incorrect; the earlier full declaration table already described every-write
behavior.
A nonempty list selects persistence when at least one listed name occurs in the write’s changed-field list. This is based on submitted/defaulted field presence, not a comparison of old and new values. Repeating the same quantity can trigger recalculation. Conversely, a create whose inputs never intersect the listed triggers can leave the computed column at its default.
The checked storedTotal names quantity and unitPrice; alwaysTotal
has no list. After controlled SQL changes quantity to 5 and both stored totals
to 999, a note-only update recalculates alwaysTotal to 62.5 while leaving
storedTotal at 999. Submitting quantity 5 again then repairs storedTotal.
Dependency ordering does not turn a computed result into another submitted
trigger. A downstream updateOn: [upstream] does not automatically persist
when an input to upstream changes; §19.5 distinguishes calculation order
from persistence selection.
19.4.2 Relationship aggregation events
Use a declared relationship name and, except for count, its numeric field.
These are fragments from the checked aggregation domain:
lineCount:
type: integer
formula: count(lines)
stored: true
amountTotal:
type: decimal
formula: sum(lines.amount)
stored: true
updateOn:
- lines.create
- lines.update
- lines.delete
| Formula form | Operation on the related table |
|---|---|
count(relationship) | COUNT(*) |
sum(relationship.field) | Sum, coalesced to zero |
avg(relationship.field) | Average, coalesced to zero |
min(relationship.field) | Minimum |
max(relationship.field) | Maximum |
The implementation selects related rows using the foreign key equal to the parent ID, then updates the parent’s computed column. This path performs SQL aggregation; it is not the AEL handler that fetches up to 1,000 rows.
With no explicit updateOn, the parser synthesizes
relationship.create and relationship.delete. Include relationship.update
when edits to child values must refresh the result. The event suffix is taken
from the trigger; the actual resource comes from the relationship. Use
create, update, and delete, not the already-past-tense event names.
The checked Order has two lines with amounts 4 and 6. All five aggregate
operations update on child creation. Changing 4 to 10 refreshes the explicitly
subscribed amountTotal to 16; defaultSum remains 10 because its default
subscriptions omit update.
Reparenting limit: moving the 10-unit line to a different Order refreshes only the new parent from the event’s current foreign key. The original Order’s explicit total remains 16 until another event causes its recalculation. A current-parent-only update does not preserve both parents’ invariants.
Hard deletion refreshes the remaining parent. In the soft-delete variant,
the SQL excludes children whose deletedAt is non-null: deleting one of two
lines leaves the row stored but reduces the count to one and the sum to six.
Restoring that line recounts too, back to two and ten (#1490). Every aggregate
that recounts on its children’s delete also listens for their .restored
event.
An empty related set produces zero for count/sum/average and SQL null for
minimum/maximum in the executed sequence.
Concurrent child writes (#1481). Each recount is a single statement,
UPDATE parent SET total = (SELECT COUNT(*) … WHERE fk = ?) WHERE id = ?. The
aggregate is therefore read under that UPDATE’s own write lock. The recount
used to SELECT and then UPDATE with the bound result. When writes ran
concurrently, a recount holding an older total could write last: 100
concurrent child creates left a stored count of 44 on SQLite. With the single
statement, each autocommitted child write’s recount sees every child
committed before it, so the last recount stores the full total on SQLite and
PostgreSQL. One case is not established: a child write inside a longer
PostgreSQL transaction, where READ COMMITTED evaluates the subquery against
the statement’s snapshot.
These checks use local hasMany/belongsTo pairs.
ADL 12 owns relationship
keys and authority. No cross-domain, joined-mapping or custom-parent-key
aggregate guarantee is established here.
19.4.3 Reactive events recalculate the owning resource
Reactive settings add resource-event subscriptions. A matching event loads every row of the resource owning the formula, evaluates the formula against each row, and writes changed results. The changed event record is not bound as the formula’s current row. This is a full O(N) scan per event, with no predicate-based row selection in this mechanism.
The following fragment accompanies the complete
reactive.yaml:
amount:
type: decimal
formula: hours * rate
stored: true
updateOn:
- hours
- rate
reactive: true
recomputeOn:
- Signal.create
- Signal.update
- Signal.delete
A Signal.create, Signal.update, or Signal.delete event makes each Summary
recompute its own hours * rate. The executed two-row sequence changes inputs
with controlled SQL between events, then confirms both records refresh on
create, the first refreshes on update, and the second refreshes on delete.
The current in-process bus delivers these callbacks synchronously; this is
not a remote-bus durability or concurrent-observer guarantee.
Use stored: true for a reactive result that must be persisted.
The parser does not enforce that combination: a reactive virtual formula is
admitted, and its event attempts an UPDATE against a nonexistent column while
the triggering Signal create still succeeds.
A reactive query formula still lacks a query handler. The checked failing
findOne replaces a prior stored value of 999 with SQL NULL through
null conversion. Reactive scheduling does not make an unsupported formula
correct. Consider views and reporting
when a full scan on every event is unsuitable.
19.5 Dependency order and limits
The inherited §19.5 heading, “Dependency order is not implemented,” is now obsolete. The current implementation shares dependency-graph utilities with the parser and orders virtual and materialized calculations before evaluating their dependents.
For virtual fields, each result is attached to the working response object before the next formula. For materialized fields, each result is placed in a working copy of the calculation record, even if that field’s persistence trigger did not fire. A dependent formula can therefore read a fresh in-memory value while storage retains an older upstream value.
The following fragment deliberately lists the final result before its
prerequisites. It is taken from chain.yaml.
aTotal:
type: decimal
formula: zSubtotal + mTax
stored: true
updateOn:
- quantity
- unitPrice
mTax:
type: decimal
formula: zSubtotal * 0.1
stored: true
updateOn:
- quantity
- unitPrice
zSubtotal:
type: decimal
formula: quantity * unitPrice
stored: true
updateOn:
- quantity
- unitPrice
At quantity 2 and price 12.5, one create stores subtotal 25, tax 2.5, and total 27.5. A partial update to quantity 3 stores total 41.25 in the same request. The virtual chain in the complete file also sees its freshly calculated prerequisite.
Two boundaries remain:
- Triggers are independent of the graph. A downstream field triggered
only by
upstreamremains at zero when quantity/price are submitted. Name the base write triggers needed for persistence, or use an empty list. - Virtual and materialized calculations are separate phases. A stored formula that reads a virtual field is evaluated before that virtual result is attached. The checked stored value becomes zero while the later virtual output is 25. A combined declaration graph does not imply a single evaluator across kinds.
19.5.1 Cycle detection is real but heuristic
For resources with more than one computed field, the parser rejects a cycle and rejects dependency chains longer than 32 fields. A field with no computed prerequisite has depth one; the checked 32-field chain is admitted, and the 33-field chain is rejected.
This is not the original proposed ten-level limit. The current errors use
native InvalidArgument code 3 with a cycle/depth message, not the proposed
CIRCULAR_DEPENDENCY envelope. The checked invalid-cycle file fails both CLI
and modeller validation.
Dependency discovery scans identifier-shaped tokens. It is not an AEL syntax
walk and does not distinguish quoted strings, object keys, or lambda-bound
names. Two formulas returning the literal strings 'right' and 'left'
are falsely rejected as a cycle when their field names are left/right.
Equivalent object-key and lambda examples also fail.
A single computed field referencing itself bypasses the parser’s
size() > 1 check and is admitted. Adding another unrelated computed field
causes that same self-reference to reject. The modeller also misses the
single-field self-reference but avoids the quoted-string false cycle.
These are explicit limits of current dependency validation. Do not rely on self-reference, quote-induced dependencies, or independent-node iteration order. No fixed evaluation order is promised between fields with no graph edge.
19.6 Values, storage, and the generated interface
19.6.1 Physical columns and result conversion
Virtual fields have no DDL column. Materialized and relationship aggregation fields have runtime-managed columns; they are not database generated-column expressions. Writes performed outside the relevant ADL paths do not by themselves recalculate them.
Initial DDL supplies zero for integer/float/decimal/money computed columns and empty text for the other computed types. That default is not evidence that a formula ran. Missing formulas are skipped and can leave it unchanged.
The materialized and reactive writers convert values to SQL parameters. Whole numbers are emitted without a decimal fraction; other numbers use two decimal places. Null is stored as SQL NULL (#1105), so a stored field reads back null where its virtual twin does; booleans and structured values use JSON text. The declared computed type is not used to validate this value before persistence.
| Declared result and formula | Checked stored/read result |
|---|---|
Decimal, unitPrice / 3 at 12.5 | '4.17' |
| Integer, the same formula | SQLite stores real 4.17 and the read returns '4.17' |
Boolean, quantity > 1 | 'true' text |
Integer, 'oops' | 'oops' text |
Decimal, null | Empty text, not SQL null |
These are observed conversion and SQLite-affinity limits. ADL 10 owns exact-value types; this chapter does not turn a decimal or money declaration into a precision guarantee for formulas. PostgreSQL DDL is recorded, but no PostgreSQL server executes these examples.
In the normal response mapper, stored computed columns are not members of the
ordinary field-type list and remained strings in the historical baseline. A
virtual numeric total was a JSON number, while the stored total was '25.0'.
Current row_to_json responses use the declared type for both materialized
fields and stored relationship aggregates (#1634): integer count and sum
values are JSON integers in create, get, list and update responses. Decimal and
float aggregates use JSON numbers; money retains its decimal-string contract.
SQL NULL remains JSON null. These wire conversions do not change how the
aggregate is calculated or stored.
A virtual field declared integer can also return 'not a number' without
a type error.
19.6.2 Input visibility and response timing affect formulas
Computed names are excluded from ordinary writable inputs. In the checked
strict mode, supplying total on create or storedTotal on update produces
422 UNKNOWN_FIELDS. The original statement that all such inputs are
silently ignored is not accurate for this mode.
Virtual fields are attached after permission/field-security filtering and
list projection, and before relationship includes are loaded. Consequently,
the formula’s record may not contain every stored input. A hidden unitPrice
makes the virtual total return zero while the stored total remains 25.
A list with fields: id returns only the ID plus newly attached virtual
outputs, whose absent inputs again produce zero. The checked get path’s
fields argument does not narrow ordinary columns in the same way.
There is also a response-path conversion difference. An update that performs
materialization refetches base columns as strings. A virtual addition
quantity + unitPrice then returns '312.5' after updating quantity to 3,
while the following get returns numeric 15.5. The same virtual addition
without any materialized fields stays numeric on that update. Multiplication
in the baseline avoids this particular concatenation outcome; it does not
resolve the conversion defect.
Bulk create dispatches through ordinary per-record create and computes the checked totals. Other bulk/import/custom paths need their own evidence; this result does not cover every write mechanism.
19.6.3 Columns, queryability, and schema output are separate
Virtual fields cannot be backed by a normal database index. The checked
virtual-index declaration passes parsing but fails activation with
MIGRATION_ERROR because the column does not exist.
A stored computed field can have an index: the byTotal control creates a
real index on storedTotal. Nevertheless, the current generated query
whitelist contains ordinary fields and keys, not computed fields. Filtering
or sorting by either total or storedTotal returns 400 INVALID_QUERY.
The inherited claim that storage alone makes a computed field filterable and
sortable is not supported at this API boundary.
The checked generated resource input schema omits computed names, as expected,
but the read schema omits them too, despite runtime responses containing
them. Resource metadata in the reviewed action generator lists name, type,
kind, formula, and updateOn under dependencies; that last member describes
triggers, not the dependency graph. This metadata description is source
inspection, separate from the executed schema and request checks.
ADL 15, ADL 27, and ADL 32 retain index, query, and OpenAPI ownership.
19.6.4 Cached results need separate freshness treatment
A cached read can return previously attached virtual values without evaluating the formula again. In the controlled cache case, direct SQL changes quantity but the next get retains total 25; an ordinary ADL update invalidates that resource’s cache and the next get returns 100.
The aggregate cache control uses actual ADL child creation: the parent’s stored count becomes one, but its already-cached get still returns zero. The aggregate event path does not invalidate the parent’s read cache. “Virtual is always current” and “aggregate event completed” are therefore insufficient freshness claims. Cache configuration belongs to ADL 29.
19.7 Failure and operation consequences
The current system has several failure boundaries, not a universal “bad formula becomes null” rule.
| Boundary | Checked result |
|---|---|
| Two-field dependency cycle or chain beyond 32 | Parser refusal; invalid-cycle CLI exits nonzero |
| Missing formula | Parser admits; linter reports EMPTY_FORMULA; stored default can remain |
| Ordinary syntax/unknown function | Parser admits; virtual result becomes null |
| AEL error handled by fallback | May become zero, text, another value, or null |
| Wrong virtual result type | Returned as-is |
| Stored null result | Persisted as SQL NULL; reads back null (#1105) |
| Duplicate stored name or index on virtual field | Activation fails with 500 MIGRATION_ERROR |
| Computed name in strict input | 422 UNKNOWN_FIELDS |
| Computed filter/sort name | 400 INVALID_QUERY |
| Follow-up computed UPDATE failure | Original create can still return 201 with an unrecalculated column |
| Failed aggregate recount | Logged as a warning naming the resource, field and parent id (#1481); the write still succeeds |
The last case is executed with a disposable SQLite trigger that rejects only
the storedTotal UPDATE. The original row and another computed value remain
stored, storedTotal stays zero, and create returns success. The callback’s
failure is not propagated as a calculation error.
The direct materialized engine also writes WHERE id = ?. Ordinary wrappers
rewrite that predicate for a declared composite primary key, which works in
the checked two-key create/update. A single custom key named code is not
rewritten: its create succeeds while stored totals stay zero and the store
reports no such column: id. Reactive recalculation separately locates the
declared primary key and successfully repairs the custom-key row.
These findings limit atomicity and successful-calculation claims. They do not change ADL 31’s error contract or prescribe a new exception envelope. Review the returned value and persisted result at the affected operation, rather than treating a successful write as proof every formula ran.
19.8 Formula evolution and restoration
Changing a formula is a definition change governed by domain version rules
and ADL 17.
The checked formula-change.yaml advances version 1.0.0 to 1.0.1 and doubles
the calculation without changing the physical fields. Activation reports
zero DDL statements.
The next read immediately returns virtual total 50, but both existing stored totals remain 25. A note-only update refreshes the always-calculated field to 50; the explicitly triggered field stays 25 until quantity or price is submitted. Formula activation is not a stored-data backfill.
Adding/removing computed columns, changing stored/type settings, or renaming computed fields requires a migration review. The reviewed schema differ includes stored computed fields as pseudo-fields, but this chapter’s execution does not establish those migration transitions. It verifies formula replacement and subsequent trigger behavior only.
Registry restoration has two distinct evidence paths. Reopening the registry
with its faithful resolved raw_source restores reactive flags and event
patterns. The typed export omits reactive and recomputeOn. When the
disposable test clears stored source text to force the legacy JSON-snapshot
fallback, those settings disappear from the reloaded model.
Normal source-backed restoration therefore works in this model comparison; export/snapshot fallback is lossy. This is not a full host-restart test, nor proof that every subscription is re-established after an operational recovery.
19.9 Complete example and verification
The complete checked line.yaml is:
adl: "0.5.0"
domain:
name: sales
version: "1.0.0"
resources:
Line:
object:
id:
type: integer
primaryKey: true
quantity:
type: integer
unitPrice:
type: decimal
note:
type: string
computed:
total:
type: decimal
formula: round(quantity * unitPrice, 2)
storedTotal:
type: decimal
formula: round(quantity * unitPrice, 2)
stored: true
updateOn:
- quantity
- unitPrice
alwaysTotal:
type: decimal
formula: quantity * unitPrice
stored: true
receipt:
type: string
formula: concat('Total ', total)
permissions:
create:
- '*'
read:
- '*'
update:
- '*'
delete:
- '*'
At quantity 2 and unit price 12.5, create and get return virtual total 25
and stored totals '25.0'. A partial update to quantity 3 returns 37.5 and
stored totals '37.5'. The response also includes the dependent receipt.
The store contains only ordinary fields and the two stored totals.
The example directory also contains
the dependency chain, relationship aggregation domain, reactive domain,
formula-change version, admitted query-target limitation, and deliberate
cycle rejection. Each standalone document uses the inherited grammar with
adl: "0.5.0"; domain versions are separate strings. Fixture permissions
isolate calculation behavior and are not an authorization template.
From the clone-b repository root, reproduce the documented existing artifact pairing with the compiler dependencies, Python/PyYAML, and modeller environment:
python3 docs/adl-v0.5.1-vol-1-adl/examples/19-computed/verify.py --build-root ../kalos-clone-a/build
The runner checks the ADL test-library hash, compiles only its documentation adapter with compatible archived headers, and creates disposable SQLite stores. It writes a new temporary report and does not rebuild production libraries or rewrite the committed records.
The verification record contains 113 native cases and 360 assertions: 42 document cases, 28 formula cases, and 43 independent store sequences. It includes two registry restoration comparisons, 70 independent modeller projections, fourteen CLI/modeller commands, and 79 passing focused tests. One malformed nonboolean input has an intentionally captured native type exception.
Five complete examples pass both command-line tools; the deliberate cycle fails both; the quoted target formula is admitted natively and rejected by the modeller. The modeller’s static formula checker also rejects some working AEL expressions and treats aggregate whitespace differently. Its formula evaluator and declaration checker are distinct evidence, recorded separately.
The chapter does not claim HTTP transport, external authentication, PostgreSQL execution, full host restart, or concurrent consistency. Source/runtime discrepancies remain visible in the evidence record.
End of Chapter 19.