ADL 40 · Part V — Execution, presentation, and integration

0.5.1 baseline + 0.6 edition note

Sheet mode

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 sheet editing, validation, concurrency, and persistence. 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 40-sheet-mode.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.

40.1 Scope and edition boundary

Sheet mode adds per-record formula overrides and dynamic-column operations to a resource. It does not replace the ordinary resource, permission, validation, computed-field, and history contracts. ADL 18 owns expression syntax; ADL 19 owns computed definitions; ADL 17 owns declared schema evolution; and ADL 24 owns history declarations.

The inherited sheet chapter (v0.5.0, retired) describes an intended spreadsheet experience more broadly than the checked runtime delivers. In particular, dynamic-column creation, writing those columns through ordinary resource endpoints, formula evaluation, and history capture must be verified independently. The examples exercise actual registered actions and inspect their SQLite rows, responses, and history.

40.2 Declaration and defaults

Place mode, dynamicFields, and computedFields on the resource. Put the formulas themselves in the ordinary computed mapping. This fragment comes from the complete sheet.yaml:

# Resource fragment; qty and rate are ordinary integer fields.
mode: sheet
dynamicFields:
  enabled: true
  maxColumns: 2
  allowTypes: [string, integer]
  permissions:
    addColumn: [editor]
    renameColumn: [editor]
    deleteColumn: [editor]
computedFields:
  overridable: true
  reactive: true
  crossRecord: false
computed:
  total:
    type: integer
    stored: true
    formula: qty * rate
    updateOn: [qty, rate]
KeyType and native default
modeString; only exact sheet enables this engine
dynamicFields.enabledBoolean, false
dynamicFields.maxColumnsInteger, 50; counts active dynamic metadata rows
dynamicFields.allowTypesString array, empty; no dynamic type is allowed until listed
dynamicFields.permissions.addColumnRole array; empty requires an administrator
.renameColumn, .deleteColumnIndependent role arrays with the same empty-list behavior
computedFields.overridableBoolean, false; enables PATCH extraction of formula keys
computedFields.reactiveBoolean, false; enables the sheet recalculation path after PATCH
computedFields.crossRecordBoolean, false; retained configuration, not evidence of cross-record scheduling

When mode is absent, the sheet-specific blocks do not enable the engine. ordinary-resource.yaml demonstrates accepted ordinary computed fields but no column actions. An unrecognized mode string is not reliably rejected as a spelling error. Likewise, parser admission does not establish that every permitted dynamic type has a complete runtime interface. The empty allowTypes fixture is admitted natively but rejects column additions; the modeller reports SHEET_NO_DYNAMIC_TYPES.

Use the declared value types. The deliberately invalid invalid-column-limit.yaml supplies a string where an integer is required. At this revision both native parsing and the independent modeller raise conversion exceptions instead of their usual structured diagnostics. This is an explicitly recorded diagnostic defect, not an accepted alternative representation.

40.3 Rows and formulas

The checked row starts with qty: 2, rate: 3, and stored total: 6. PATCH with qty: 4 returns and stores total: 12. Its configured updated history entry captures the resulting quantity and total. This is evidence for that formula and operation, not for arbitrary spreadsheet formula syntax.

With overridable: true, PATCH recognizes string keys named <field>_formula. It validates each supplied string, stores accepted overrides in the row’s _formula_overrides JSON column, and strips those request keys before ordinary field validation. A JSON null requests removal of that override. The checked null-clear case resumes the declared formula and returns 15 after setting quantity to five.

Unknown identifiers and self-reference are rejected with 422 INVALID_FORMULA. The current checker performs a lexical scan as well as a trial AEL evaluation; it is not the full ADL 18 name resolver. Its small identifier whitelist can reject otherwise meaningful function names or tokens inside quoted text. Do not infer an override’s acceptance from the same expression’s success in a different AEL host.

The source also contains an unsafe dependency-graph construction in SheetEngine::validate_formula: it constructs a vector using iterators from two separate temporary sets. This path needs correction before valid row formula overrides can be treated as reliable. The isolated valid-override probe failed to return within five seconds and was terminated. This bounded failure observation is separate from the earlier, working rejection checks.

Override persistence happens before some subsequent resource validation and write steps. Therefore a failed PATCH need not imply that every earlier sheet side effect was rolled back. Treat override changes and the ordinary row update as a combined operation that requires operation-specific verification.

40.4 Dynamic column operations

A sheet with dynamic fields enabled registers the following resource-relative operations. The example’s base is /api/v1/worksheet/rows:

HTTP route suffixOperationSuccessful response
GET /columnsList fixed, dynamic, and computed columns200 with three arrays
POST /columnsAdd a dynamic column200 with column metadata
PATCH /columns/:nameRename a dynamic column200, old/new names and physical result
DELETE /columns/:nameMark a dynamic column deleted200

The native route inventory in the evidence is authoritative for exact method and path spelling. Actions can also be invoked through the bus naming contract owned by ADL 3; the probes use legacy aliases enabled for this revision.

Add takes name and type, with optional default, description, and actor metadata. An existing declared or computed field causes 409 COLUMN_CONFLICT; a disallowed type causes 422 TYPE_NOT_ALLOWED; reaching the active-column limit causes 422 MAX_COLUMNS. Missing required request values cause 400 MALFORMED_REQUEST. The successful response’s addedBy comes from request _actor at this revision, not automatically from authenticated identity.

Column mutation permissions are independent. When a nonempty role array is present, the caller must hold a listed role; an administrator label does not automatically bypass it. The checked reader is refused and editor succeeds. Column listing has no equivalent permission check in the engine; the native anonymous listing probe succeeds. Deployment-level transport authentication is a separate boundary, not established by that kernel result.

Adding a column alters the physical table and inserts dynamic metadata. Its default is recorded as metadata; the checked existing row remains SQL null, rather than receiving that default. Adding a name that already exists physically can update metadata without changing that physical column’s type. These actions do not supply the ordinary ADL migration plan or versioned model change.

Once added, an active dynamic column (deleted = 0 in the dynamic-column metadata table) is writable through ordinary create and PATCH endpoints: those handlers merge active dynamic columns into the resource’s effective field set, validate values against the column’s declared ADL type (returning 422 VALIDATION_ERROR on a type mismatch), and coerce the stored value to its JSON type on read. Once a dynamic column is deleted (deleted = 1), create and PATCH reject it again as 422 UNKNOWN_FIELDS.

40.5 Rename, deletion, and history

Rename requires an active dynamic-column metadata row. The native SQLite fixture renames note to memo physically and reports physical: true. The engine can still update metadata when a physical rename fails; inspect the reported flag and physical schema before treating the rename as applied. Unknown columns return 404 NOT_FOUND.

Delete marks the metadata row deleted = 1; it does not drop the physical column. The example’s memo column remains in the resource table while it vanishes from the dynamic-column list. A source comment mentions later cleanup, but this chapter does not promise a cleanup worker or a deletion schedule. Physical erasure is not established by metadata deletion.

The column operations in this fixture write no additional resource-history entries. The one existing updated entry came from the earlier row PATCH. Do not describe add, rename, or delete as history-producing changes unless a separate verified mechanism records them. Direct schema/metadata actions also need their own recovery and audit plan if used by an application.

40.6 Lookup functions and recalculation boundaries

The delta §14.5 identified findOne, findMany, lookup, and networkdays as implementation work. ADL 18 records the current function surface. An old statement that those names are simply absent is no longer an adequate availability description.

Function existence and host capability are separate. lookup.yaml uses lookup("adl.worksheet.worksheet.Price.id", code, "amount") * qty against a stored price of seven. The checked sheet row returns and stores zero, including its history capture, instead of fourteen or twenty-one. The modeller separately reports FORMULA_UNKNOWN_FUNCTION in its formula-engine check. This fixture is an intended lookup example with an explicit implementation gap, not a successful cross-record lookup demonstration.

The sheet cascade builds row context but installs no cross-resource query service. It can write an error sentinel for failed evaluation; subsequent ordinary computed processing and numeric conversion can change the final value. That is why the evidence inspects final storage, response, and history rather than asserting a particular intermediate sentinel. Setting crossRecord: true does not repair this host boundary or arrange invalidation when another row changes.

40.7 Export, restoration, and verification limits

The checked source-backed registry reload retains the sheet configuration. Source-free model reconstruction loses the mode and dynamic/formula flags. A physical dynamic column also does not become a declared ADL field merely because it exists in the database. Keep those model, metadata, and physical schema states distinct when reviewing restart or migration behavior.

The examples record parser/model/export results, registered routes, real SQLite writes, bus events, and history. They do not establish PostgreSQL rename parity, concurrent column changes, browser spreadsheet behavior, reliable valid formula overrides, or arbitrary AEL host support. Those limits remain visible alongside the verified ordinary row calculation and column-operation results.