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 soft deletion, versioning, bulk operations, and restore behavior. 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 29-resource-features.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.
29.1 Scope and feature vocabulary
A resource’s features mapping selects additional generated behavior. Enabling
one feature does not imply that every write path participates in it. This
chapter follows the inherited resource-features chapter (v0.3.1, retired),
with the signed A3 changes and
Draft 05 §18 item 31.
Observed implementation behavior is checked at 31e59154.
The edition’s feature vocabulary and native defaults are:
| Key | Default | Purpose |
|---|---|---|
softDelete | false | Tombstones and restore operation |
audit | false | Field-change audit records and audit reads |
versioning | false | Copy-before-update snapshots, versions/revert operations |
search | false | Search declaration; current query behavior described below |
export | false | Resource data-export action |
dataImport | false | Resource data-import action |
caching | false | In-process read cache |
transactions | true | One transaction for the CRUD write phase; explicit false preserves operation-specific scopes (§29.7, #1373) |
validationMode | strict | Resource validation mode |
cacheTtlSeconds | 300 | Cache lifetime when caching is enabled |
These are the feature model
and parser defaults.
Use actual YAML booleans for switches. Unknown feature keys are outside the
vocabulary, although the current strict parser merely warns and admits the
checked unknown-key example. A misspelled validation mode falls back to strict
without a warning; a negative cache TTL is admitted. Supplying a string for
softDelete raises the caught native JSON type exception in the evidence,
rather than a structured parser rejection.
The retired key features.import is rejected with a KEY_RENAMED message even
when its value is false. The correct spelling is dataImport. Package reuse
under import belongs to ADL 8;
it is unrelated to importing resource rows.
29.2 Enabling features and discovering operations
A resource may declare:
features:
softDelete: true
audit: true
versioning: true
export: true
dataImport: true
caching: false
transactions: true
validationMode: strict
The features fixture provides a complete domain and enables caching as well, specifically to test interactions. The transfer fixture isolates import/export from those interactions.
When disabled, the checked restore, versions, export, and import actions are
absent and direct calls return 404 ACTION_NOT_FOUND. Enabling the relevant
switch registers the action and its route; ADL 26
gives the route table. This differs from api.disable, which suppresses CRUD
routes while leaving their actions registered.
Ordinary count, distinct, and bulk operations do not require a feature switch. Feature flags also do not grant permissions. The action-specific gates below still apply.
29.3 Soft delete and audit
29.3.1 Tombstones and restoration
With softDelete, ordinary delete marks deletedAt and returns 204 while
retaining the row. The checked ordinary list and get then hide it. Generated
active, deleted, and all scopes provide list visibility choices unless
authored scopes already occupy those names; ADL 16 owns their
selection rules.
Restore clears the tombstone and returns a response containing restored: true
and a record. In the observed response, that record uses stored string values,
so it is not identical to a normally typed get result. Restoring does not create
an audit entry in the checked lifecycle sequence.
Restore requires the resource’s delete permission, including the owner
check when delete lists owner: whoever may delete a record may restore it.
A tokenless request is refused with 401 AUTH_REQUIRED (#1397).
Restore publishes adl.<domain>.<Resource>.restored, with the same payload
shape as .deleted (resource, id, data), and invalidates the resource’s
read cache (#1490). Before that, a list cached after deletion stayed empty
after restore even though the stored row was active again. A parent’s stored
aggregate over the resource also kept the value the soft delete left it;
ADL 19 §19.4.2 describes the recount.
29.3.2 Audit declarations and actual capture
The audit feature writes field-change records separately from the authored
history events in ADL 24. The checked sequence creates
one create, one update, and one soft_delete audit entry with the actor ID.
The rejected stale-version update adds none. Versions, revert, and restore do
not add audit entries in that sequence.
Additional resource-level audit configuration is separate from features:
audit:
track: [title, priority]
exclude: [priority]
strategy: table
retention:
days: 90
This is a configuration fragment, not one of the timed execution fixtures.
Source inspection of the lifecycle audit helper shows that track selects
fields and exclude wins over inclusion. The parser also reads tableName,
strategy, and retention.days; the normal strategy is table. There is no
executed evidence here for alternative strategies or custom-table retention.
The runtime selects a custom audit table name for its writer when supplied.
However, the inspected retention scheduler constructs the conventional
{resourceTable}_audit name. Do not infer that its scheduled purge follows a
custom tableName. The worker starts its first pass after an hour and applies
positive day limits; this chapter does not wait for that worker or claim timed
retention verification. The default zero-day setting represents no configured
retention limit.
29.4 Version history and optimistic checks
The versioning handler
adds versions and revert actions. The ordinary PATCH path copies the existing
record into {table}_versions before updating it. The checked create starts
with no version snapshots; its first PATCH stores version 1 containing the
previous title.
A versions request supplies id and returns items and count. Values in the
checked snapshot response are stored strings. A revert request supplies id
and a string version, for example:
{"id":"e1","version":"1"}
Revert reads that snapshot, saves the current state as another version, and
applies the earlier field values. Missing snapshots return VERSION_NOT_FOUND.
This is a separate direct-update path, not a call to ordinary PATCH; its cache
and audit differences must be considered separately.
The PATCH handler
accepts If-Match/if-match or expectedVersion when versioning is enabled.
It strips surrounding header quotes and compares the requested value with the
current maximum stored version number, initially zero. The checked first update
with If-Match: "0" succeeds; another request expecting zero returns 409
VERSION_CONFLICT and reports currentVersion: "1" without changing the row.
PATCH and named transitions repeat this check inside the write transaction,
immediately before saving the version snapshot and changing the record (#1483).
SQLite serializes the writers; PostgreSQL locks the target row before reading
the version. Concurrent requests carrying the same expected version have one
successful writer; the others return 409 VERSION_CONFLICT with the new
currentVersion. A PostgreSQL row-lock wait that expires returns 409 LOCK_TIMEOUT
with Retry-After, as described by the transaction lock contract.
The snapshot and record mutation commit together. A failed mutation or snapshot
does not consume a version. An empty PATCH, or a PATCH with
X-Kalos-Dry-Run: true, does not create a snapshot. Revert uses the same write
lock and snapshot transaction.
The new transaction covers the storage phase, not the entire request’s hooks: before-update hooks can run before a concurrent version conflict is discovered, and after-update hooks run after this transaction commits. An existing outer transaction retains its own lifetime; the storage phase uses a savepoint.
Omitting the expected version leaves the conflict check inactive, although
version snapshots still serialize. This guarantee does not extend the version
check to PUT, custom operations or import paths that do not call PATCH or a
named transition. Regression coverage is in test_adl_transition_versioning,
test_adl_version_locking, and tools/repro/adl/43_expected_version_not_atomic.py
(SQLite and PostgreSQL).
29.5 Data import and export
29.5.1 Import grammar, validation, and upsert
Enable dataImport to expose the action whose suffix remains .import and the
route POST /import. The operation accepts a raw JSON array or a wrapper:
{"records":[{"id":"e1","title":"Alpha","priority":1}]}
It uses the resource’s create permission. The checked viewer receives 403;
an invalid body receives 400 INVALID_BODY. Required-field and native field
validation run before insertion. The invalid negative priority returns 422
IMPORT_VALIDATION_ERROR, with its row index and field details. CSV parsing
helpers exist, but this generated handler does not accept an arbitrary CSV body.
The import handler
and SQL helper perform
primary-key upserts. Two input records with the same primary key can therefore
report imported: 2 while leaving one stored row containing the later values.
This is a count of successful statements, not newly created distinct records.
On conflict, declared non-key columns are replaced from the input/default
bindings; an omitted value is not necessarily preserved as it would be in PATCH.
Upsert is authorized by create permission on this path; it does not acquire the separate update-permission check used by bulk-create’s optional upsert mode. This difference matters when create and update permissions differ.
The per-row statements are not wrapped in one transaction by this handler.
The unique-title control inserts e1, fails a later e2 with 409, and retains
e1. Validation of the whole payload before insertion does not prevent partial
success when the store rejects a later statement.
Import does not dispatch ordinary create. It directly calls field validation, then SQL. Rules, hooks, computed-field pipelines, state-machine transitions, history events, ordinary audit/version capture, and read-cache invalidation are not established by that path. ADL 25 independently checks the hook omission. Use import with awareness of these explicit runtime boundaries.
29.5.2 Export scope and representation
Export uses the resource’s list permission. Its current handler returns CSV
content in a response data object with format, rows, and csv, and sets CSV
content headers. The kernel adapter records this response; it does not verify
how a network transport renders or downloads it.
The handler applies the resource’s default scope and a soft-delete condition.
It does not use the list handler’s full request-query pipeline. The checked
request supplies a filter selecting e1, an unknown named scope, and
format: json; the result is still CSV containing both rows. These request
parameters are ignored on this operation.
Source inspection also shows that export reads stored rows and sends them to the CSV helper without ordinary response-field permission/security filtering. List permission alone therefore must not be read as a guarantee that export matches a caller’s projected list response. Owner-only list fallbacks and parameterized default scopes require their own handler evidence; this chapter does not claim they are equivalent to the list path.
29.6 Caching and invalidation
caching: true creates an in-process TTL cache for the generated resource
context. The configured default TTL is 300 seconds. This is not an HTTP cache,
a distributed cache, or a durability mechanism.
The checked ordinary create/PATCH invalidation works: a cached get continues
to return Alpha after a direct SQL change, then returns Generated after a
normal generated PATCH. Other write paths differ:
| Checked sequence | Cached result versus storage |
|---|---|
| Empty list, import, same list | List remains empty; imported row exists |
| Delete, list, restore, same list | Restored row appears with default transactions (#1373) |
| PATCH, get, revert, same get | Get returns the reverted title (#1483) |
Import still lacks invalidation. The request transaction invalidates its resource cache after success or rollback; explicit-false restore retains the older behavior. TTL expiry is source-inspected; it is not timed in the chapter checks.
The cache also retains processed response fields. List filtering removes unreadable fields in the current role-field control. Get includes a caller scope when record-less permission is only tentative, and includes the special scope selector, but definitive public/role access can share a key. It does not key every field-permission or projection context.
In the role-field control, admin first caches a list and get containing
secret: admin-only. A viewer with the same public read permission no longer receives that field
from list, but still receives it from the cached get, despite its admin-only
read rule.
This is a reproduced confidentiality defect. Applications relying on caller-
specific field visibility cannot assume that the current shared cache reapplies
those rules. The evidence uses disposable example data only.
29.7 Transactions, validation, and search interactions
Since ADL 0.102.91 (#1373), features.transactions controls the generated
CRUD write phase and defaults to true. Create, PATCH, PUT, named transitions,
delete, restore and revert open a transaction before their first write. Their
record mutation and applicable version snapshot, media references, audit,
history and derived writes share that scope. A required auxiliary write failure
fails the request and rolls back those writes. Transactional PUT also performs
the audit, version snapshot and stored-computed work its older path skipped.
An existing caller transaction is joined with a savepoint; releasing it does
not commit the caller’s transaction.
Explicit features.transactions: false preserves the earlier operation-specific
behavior. Bulk create, media-reference writes and versioned PATCH/transition/
revert retain their dedicated scopes. Optimistic version checks remain atomic
(#1483). Audit and history errors can still be tolerated in this mode; false is
not a command to disable every transaction.
Ordinary bus subscribers—including workflows—receive transactional write events only after the outer commit. Rollback discards them. Delivery runs synchronously on the writing thread, after the database connection/lock is released and before the response returns. Rules and the already-constructed response must not depend on writes made by those later workflows. Internal aggregate/reactive subscribers run inside the transaction so their required database writes can roll back with the triggering record.
Before-hooks, validation and rule evaluation run before the new write lock.
Explicit nested calls from those hooks remain separate requests; preflight rule
logs and rejection history retain their diagnostic contract. Named
afterCreate/afterUpdate/afterDelete handlers run after the request write scope
succeeds and are skipped when it rolls back. Their bus announcements still reach
internal derived writers inside the transaction. This preserves the Lua VM/DB
lock order; it does not make arbitrary external side effects transactional.
The two-store failure-injection reproduction is
tools/repro/adl/49_request_atomicity.py (--sqlite or --postgres). Native
test_transaction_atomicity coverage additionally checks workflow commit
visibility, rollback of subscriber-generated aggregates, and after-hook timing.
The older shared-connection chapter examples alone do not prove those pooled
store guarantees. See ADL 37 for workflow timing and
ADL 25 for direct hook calls.
validationMode: loose is broader in this implementation than “ignore unknown
payload fields.” The checked unknown typo field is dropped, but an input
priority: -1 also succeeds despite min: 0. The create handler gates its
built-in field-validation pass on this mode. Custom validators and other
operation-specific checks have their own paths; loose mode must not be described
as turning off all possible checks. Import still invokes its field validator
directly. ADL 20 owns detailed validation semantics.
search does not gate the current list-family LIKE fallback. ADL 27 executes
the same no-match search with the feature true and false. Enabling search is
not evidence of full-text-index creation or accelerated search.
29.8 Exported models, restoration, and verification
The model exporter
currently writes enabled data import using the retired import key. A model
with dataImport: true therefore exports successfully but its exported document
fails native reparsing with KEY_RENAMED.
Registry restoration using retained source succeeds in the checked cases. Forcing the registry to restore from its serialized model without source fails with the same renamed-key error. Preserve the authored document; an export success flag alone is insufficient evidence of a usable round trip.
The evidence record separates successful feature execution from these defects and from source-only retention, utility, and concurrency observations. It records the exact inputs, generated actions, response bodies, stored rows, source hashes, and independent modeller checks. It does not repair the runtime or turn a passing assertion of a defect into a conformance claim.