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 activation, migration planning, renames, data preservation, and destructive changes. 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 17-schema-evolution.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.
17.1 Scope of this chapter
Schema evolution changes an active domain’s definition while accounting for its
existing rows, clients, and dependencies. Declare a field rename with
renamedFrom when the new field continues the old field’s stored values.
Review additions, removals, constraints, references, and storage changes against
the whole affected site before activation.
This chapter owns author declarations and change classification. The platform’s KD 16 migration chapter (v0.5.0, retired) owns executor transactions, migration records, and operational recovery. The outcomes below qualify what an author can infer from a declaration or response; they do not replace that operational chapter.
The converted ADL 17 (v0.5.0, retired) supplies the inherited rename and classification material. Draft 05 §§11–12 add the site migration boundary and physical naming provisions. The signed R0-b ruling qualifies physical naming for existing domains. Sections 17.1–17.3 retain the inherited subjects; later sections absorb the edition changes and evidence.
Version admission precedes migration. The inherited assertion that a changed
schema migrates at the same domain version is obsolete. Follow
ADL 6:
use a higher domain version for a changed definition. The governing digest
rules and the implementation’s narrower structural admission check are distinct.
Here, identical resubmission succeeds with zero DDL; a rename at the same
version and a lower-version submission both return 422 DOMAIN_VERSION_NOT_MONOTONIC. Preview still produces the same-version rename
plan, so preview success does not establish admission.
This draft distinguishes language requirements, inherited descriptions,
implementation observations, and author guidance. Source review is pinned to
288ab2eb. Execution uses separately identified existing Release artifacts,
with compatible dcb5fa10 headers for a documentation adapter. It is not a
fresh production build of that source revision. The evidence record
contains 94 cases, 283 assertions, one native registry reload, and 41 passing
focused tests; assertions marked as gaps reproduce defects.
17.2 renamedFrom
Placement and matching
Put renamedFrom on the new field, with the old field’s name as a string.
Keep the old field out of the new resource object.
# Field fragment inside domain.resources.Book.object.
pageCount:
type: integer
renamedFrom: pages
This fragment continues an earlier pages: {type: integer} field. It does
not declare both fields, create an API alias, or rename a resource.
| Aspect | Authoring rule or observed matching behavior |
|---|---|
| Placement | Field definition in a resource’s object |
| Value | Old field name as a string; use its exact spelling |
| Matching scope | Removed fields of the same resource |
| Successful match | One Modified field change with old and new names |
| Generated operation | Rename the existing physical column |
| Source still declared | No removed source to match; the new field is an addition |
| Source absent, misspelled, or case changed | No match; addition and removal remain separate changes |
| Two new fields name the same source | Only one can consume the removed field; do not rely on declaration order to resolve this ambiguity |
| Resource-level hint | No resource-rename contract; the checked parser warns about an unknown key and still models a new resource |
The schema differ matches a newly added field’s nonempty hint against the removed-field map and consumes that entry once. It does not infer a rename from matching types, similar names, or field order. A numeric hint is silently ignored by the checked native parser; the independent modeller retains the number. Neither result makes a non-string hint a valid rename declaration.
For the complete before/after pair in §17.9, SQLite emits:
ALTER TABLE library_books RENAME COLUMN pages TO pageCount
The existing 12 and NULL values remain attached to the renamed column;
pages disappears. With no hint, the default submission refuses the destructive
add/drop plan. Allowing that plan creates empty pageCount values and drops
pages, losing the original values.
One transition, retained metadata
The hint describes the transition from an old definition. Once pageCount
exists, matching by that current name prevents the same rename from repeating.
It is reasonable to remove the hint in a later version after the transition.
The inherited claim that snapshots strip the hint is incorrect for the checked
implementation. The serialized model, native registry reload, and active schema
all retain renamedFrom: pages. Reapplying the post-rename definition emits no
DDL. The companion 1.0.2 definition removes the hint, also emits no DDL, and
preserves rows. Describe this as a one-transition instruction whose metadata
can persist, rather than promising automatic removal.
Rename separately from other field changes
Keep the field’s type and constraints unchanged during the rename, then review
a separate version for further changes. This advice follows a concrete generator
gap: its rename branch emits RENAME COLUMN and stops processing that field.
In the checked combined changes:
pages: integerbecomespageCount: booleanwith a hint. Submission succeeds, but the physical column remainsINTEGERand retains12andNULL.- The new name also declares
required: true, default: 7. Submission succeeds, but the physical column remains nullable and the existingNULLremains.
The active model contains the new type or requirement despite the incomplete physical migration. A successful rename response therefore does not validate additional changes written in the same field definition. Separating changes makes them reviewable; it does not eliminate the constraint migration limits in §17.3.
A field rename also changes the client’s field vocabulary. Update queries, validation expressions, scopes, hooks, and other authored uses deliberately; the hint does not specify a general rewrite of those strings. Referenced database constraints have the additional site requirement in §17.5.
17.3 What constitutes a breaking change
Evaluate both stored-data compatibility and client compatibility. Preserving a column’s values does not preserve its API name. A new restriction can invalidate stored rows or formerly valid writes without dropping a column.
The inherited destructive categories remain useful: resource removal, field removal, narrowing a type, and adding a required field without a usable default. They are not a complete compatibility analysis. The implementation’s destructive flag is a planning classification, not a proof that every other change is safe.
| Change | Author review | Checked behavior and limit |
|---|---|---|
| Add a resource | New storage, routes, permissions, and dependent references | Resource-add plan; resource-level rename hint still means add/drop |
| Add an optional field | Existing rows have no value; clients must tolerate it | Adds the column; existing rows receive NULL |
| Add a required field with a nonempty default | Choose a value valid for all existing rows | Integer default 1 fills existing rows and installs NOT NULL |
| Add a required field without a usable default | Existing rows need a defined backfill | Default submission refuses; opt-in can publish the model without adding the column |
| Rename a field with a matched hint | Preserve stored values and revise clients | One physical rename; combined type/constraint changes are omitted |
| Drop a field or resource | Values or whole rows will be lost | Default submission refuses; explicit opt-in executes the drop in these SQLite fixtures |
| Change a type | Check actual values and resulting constraints | Rank-based widening/narrowing classification is weaker than semantic compatibility |
| Make an existing field required | Account for every existing NULL | Explicit default fills nulls; without one, the checked integer migration invents 0 |
Change nullable, a default, or validation bounds | Distinguish runtime rules, DB constraints, and existing data | Checked changes activate with no DDL and retain existing values |
| Add uniqueness | Inspect existing duplicates as well as future writes | Duplicate rows can make execution fail even when preview has no errors |
| Remove uniqueness | Confirm the physical constraint is removed | Removing field unique leaves SQLite’s generated table autoindex enforcing uniqueness |
| Change indexes or relationship rules | Inspect both the proposed plan and actual activation | Differ/admission coverage varies; see ADL 15 and ADL 12 |
Add a belongsTo to an existing resource | Existing rows must name parents that exist, or be null | The FK column is added once, typed by its declared field. PostgreSQL then adds the constraint, and rows naming a missing parent roll the migration back with 409 MIGRATION_DATA_CONFLICT. SQLite constrains a column added in the same change; on a column that already exists it cannot, and the plan warns that the column is unconstrained (#1409) |
The inherited blanket description of widening, uniqueness, and cascade changes
as safe without opt-in is too broad. In this evidence, string → uuid is
ranked as widening because the types have equal rank. Values such as Repeat
survive unchanged; no UUID validation occurs on those stored values.
Allowing string → integer casts both Repeat values to 0. Integer-to-string
preserves the checked values, but this observation establishes no general
lossless conversion rule.
Requiredness also has two different paths. A new required field with no nonempty default produces a plan error and no column statement. An existing optional integer changed to required with no declared default gets a generated zero backfill. An explicit empty-string default is treated like an absent default for the new required string example. These are implementation limits, not interchangeable ways to satisfy an author’s data requirements.
The operational allow_destructive flag belongs to the submission request,
not the ADL domain or field grammar. It authorizes classified destructive work;
it does not supply a backfill or repair an incomplete plan. In the required-field
case, opt-in bypasses the plan error, stores the newer model with ddl_count: 0,
and leaves the column absent. A subsequent create returns 500 DB_ERROR.
For the default refusals tested here, the whole submission stops before DDL: rows, columns, version, and migration history remain unchanged. A preview warning saying a drop is “deferred” describes the generator’s omitted statement; it does not promise that the non-destructive portion will be installed.
ADL 10 owns field types, ADL 11 owns enum validity, ADL 15 owns index declarations, and ADL 16 owns scope changes. A definition-only change still needs a compatible runtime and client transition.
17.4 Review a preview against the intended transition
Preview exposes proposed up and down statements, errors, warnings,
is_destructive, changes, and mapping-change information. Compare that output
with the old and proposed definitions and with representative stored values.
For the checked rename, preview reports one change, one rename statement, no
errors, and is_destructive: false. Its down entry is only a comment stating
that the rename cannot be reversed. That is already insufficient evidence of
rollback support.
The current route registration maps the default
POST /api/v1/domains/{name}/preview path to
kalos.domain.migrate.preview. The adapter executes its legacy alias
adl.domain.migrate.preview through AppContext. HTTP transport itself was not
tested. The separate adl.domain.migration.preview handler in source should
not be confused with the route’s handler.
Preview has three important limits:
- It can propose SQL for a same-version changed definition that submission later rejects.
- It does not establish that existing rows satisfy a new constraint. The duplicate-title uniqueness example previews successfully and fails during execution.
- With
allow_destructive: true, its displayed errors and destructive flag can be cleared even when the raw plan contains an error or a destructive operation. The required-field preview then shows zero changes and no errors.
There are also two comparison paths. Submission’s lightweight diff_models
check and migration planning’s SchemaDiffer do not cover identical properties.
The index-only control produces a migration statement while the lightweight
check reports no structural change. See ADL 6 and ADL 15 for the resulting
admission and activation gaps. A changed source digest, a nonempty schema
diff, and actual DDL execution are separate observations.
A useful review checks the new version, exact rename match, every intended field change, affected constraints and dependents, and the resulting physical schema and values. Treat a successful response as one observation in that review, particularly for the known incomplete transitions above.
17.5 Dependencies and the site migration boundary
Draft 05 §11 changes the boundary from a domain’s private migration to the site’s dependency closure:
- Submission remains per-domain. Activation revalidates the dependency closure within the site and commits in one transaction.
- The site plan follows a topological order of domain dependencies; differences are still computed per domain within that order.
- A migration may fail because of another domain’s data. The failure is reported against the submitted domain and names the referencing domain.
- A referenced-column
renamedFromMUST propagate into referencing domains’ constraints within the same transaction. No domain observes another midway through migration.
Authors therefore need the domains that reference the changed resource, the actual physical bindings, and the applicable derivation dependencies when reviewing a change. Merely ordering the YAML files is not the site contract.
The complete suite fixture lists loans before catalog. Bootstrap activates
catalog first, then loans. A later two-member update adds a catalog column
and attempts uniqueness over duplicate loan notes. It fails on the second
member; in the shared SQLite store used here, both domains keep their original
versions and active statuses, the catalog column is rolled back, and the
original rows remain. This is positive evidence for that suite transaction,
not verification of every dependency closure or pooled-store configuration.
Two target-key rename controls show why physical and runtime evidence both
matter. The canonical reference targets adl.bookshop.catalog.Product;
the legacy relationship targets catalog.Product.
| Control | Physical result | Runtime result |
|---|---|---|
Canonical type: reference | Checked storage is text with no actual FK; exported target key changes from id to productKey | Canonical reference string remains readable |
Legacy belongsTo relationship | A real FK initially targets id; SQLite rewrites it to productKey on target rename | The included target is present before activation and becomes null afterward, while the target row remains |
The relationship control uses the inherited dotted target spelling only to exercise an existing real FK. It is not a replacement grammar for the canonical reference declaration. In that control the referencing domain remains at its old version, and the include loader no longer finds the renamed target key. Physical FK propagation alone therefore does not demonstrate complete runtime dependency refresh. The no-FK reference control cannot verify §11.3 constraint propagation at all.
ADL 12 owns reference binding, cascade/write authority, and cross-site limits. Cross-site references have no shared database transaction or SQL join. ADL 14 owns linked-domain propagation and mapping-specific transitions, including its recorded gaps. This chapter does not infer recursive closure correctness from the two-member suite result.
17.6 Physical names and storage transitions
Logical addresses and actual physical names have different purposes. Draft 05 §12 proposes the following physical layout:
| Store | Site storage | Domain/resource placement |
|---|---|---|
| PostgreSQL | One database per site | Schema {domain}_v{major}; table {resource} |
| SQLite | One file per site | Table {domain}_v{major}_{resource} |
Signed R0-b applies this rule to domains first activated under 0.5.1. Existing tables are grandfathered, with their actual physical names recorded in the exports fact table. It orders no physical rename migration in cut -a. Consumers resolve the recorded physical facts rather than deriving old table names from the new formula.
The dated 0.5.1 program home
records the storage-name switch as outstanding. The checked new suite still
creates catalog_products and loans_loans, and exports those actual names.
The standalone library uses library_books. This confirms a difference from
the new-activation naming requirement; it does not expand grandfathering to
excuse every new legacy-named activation.
Increasing the library’s domain version from 1.0.0 to 2.0.0 without other
changes keeps library_books and emits no DDL in the checked implementation.
A major version declaration therefore does not itself perform a physical
rename, copy rows, or establish simultaneous runtime versions. Draft 05 §12’s
remaining coexistence rationale must be read with the retirement of runtime
coexistence and the version qualifications in ADL 6.
A reference binding change and a resource mapping change can move storage
responsibility or change how references are represented. Draft 05 §§9–10
treat these as site data migrations. The logical reference value must survive;
the migration needs the corresponding translation and integrity checks.
A field rename hint alone cannot request a database move, a foreign-table
takeover, or a single/joined conversion. Follow ADL 12 and ADL 14 for those
declarations and implementation limits.
17.7 Activation, failure, and rollback evidence
Separate admission refusal, execution failure, and later rollback when reading a result.
| Checked event | Response | Persisted/physical outcome |
|---|---|---|
| Matched rename | 201 | New version, renamed column, original values |
| Identical resubmission | 201, zero DDL | Model unchanged; a zero-step history entry can still be added |
| Same-version rename or lower version | 422 DOMAIN_VERSION_NOT_MONOTONIC | Old version and schema retained |
| Default destructive refusal | 422 DESTRUCTIVE_MIGRATION | No partial DDL, no new migration row, old definition retained |
| Duplicate-data failure during standalone migration | 500 MIGRATION_ERROR | Prior SQL in the migration rolls back; old rows/version retained; domain status becomes failed |
| Failure during the checked suite update | 500 MIGRATION_ERROR with failing member | Both original domain versions/statuses and suite version retained |
| Rollback of the checked rename | 200 with zero inverse statements | Old model restored, physical column still renamed; old-field create fails |
The legacy reconciliation (v0.3.1, retired)
already recorded the rename rollback mismatch. This chapter reproduces it:
migration history says reversible: true because a previous model snapshot
exists. The recorded inverse is a comment, rollback skips it, and the restored
model expects pages while storage still contains pageCount. Creating a
record through the old field then fails with 500 DB_ERROR.
Consequently, neither a prior snapshot, a reversible flag, nor a successful rollback response proves that data and metadata have been restored together. Operational recovery requires an executable, checked inverse or another verified recovery procedure under KD 16. This chapter provides no automatic rename-rollback procedure.
The successful forward-failure rollback observations use one shared SQLite connection for registry and application data. They do not establish isolation under concurrent observers, correct pooled connection affinity, independent registry/application stores, restart recovery, or PostgreSQL execution.
17.8 Domain removal is a separate site operation
Draft 05 §11.4
requires that a domain MUST NOT be removed while another domain in the same
site holds a foreign key into it. An attempted removal reports
DOMAIN_REMOVAL_BLOCKED and names the referencing domains. After those
references are removed, removal is itself a site migration with the activation
transaction semantics.
The recorded implementation does not provide a general domain-removal operation
that fulfills this workflow. The action calls adl.domain.remove and
kalos.domain.remove both return 404 ACTION_NOT_FOUND in the adapter.
Removing catalog from a resubmitted suite’s member list leaves its domain,
rows, table, and exports present and active.
Do not confuse these other operations with domain removal:
- Dropping the last resource can leave an active domain with zero resources after explicit destructive opt-in. It removes table data, not the domain registration or its site membership.
- Deactivation preserves domain data. The inspected deactivation handler does
use
DOMAIN_REMOVAL_BLOCKEDfor a base domain with derived dependents. That is a derivation-specific guard, not evidence of the general inbound-FK removal check. - Omitting a suite member is not a removal request in the checked suite path.
The empty-resource refusal control uses the operational allow_empty option
to reach the destructive guard. Without such allowance, empty-domain admission
can fail earlier. Neither allow_empty nor allow_destructive is an ADL
domain-removal declaration.
17.9 Complete example and verification
This complete before definition uses the lowest grammar version needed,
adl: "0.5.0", accepted by the 0.5.1 server:
adl: "0.5.0"
domain:
name: library
version: "1.0.0"
resources:
Book:
object:
id:
type: integer
primaryKey: true
title:
type: string
pages:
type: integer
notes:
type: string
permissions:
create:
- '*'
read:
- '*'
update:
- '*'
delete:
- '*'
The complete next version renames only pages:
adl: "0.5.0"
domain:
name: library
version: "1.0.1"
resources:
Book:
object:
id:
type: integer
primaryKey: true
title:
type: string
notes:
type: string
pageCount:
type: integer
renamedFrom: pages
permissions:
create:
- '*'
read:
- '*'
update:
- '*'
delete:
- '*'
after-hint-removed.yaml
then advances to 1.0.2 and removes only the hint.
after-drop.yaml and
after-required.yaml are deliberate
migration-risk controls from the original 1.0.0 baseline, not the next steps
in the rename sequence.
The suite root declares
adl: "0.5.1" and references complete
catalog and
loans member bodies. Members omit
adl and receive suite context. The standalone CLI’s single-document validate
path cannot load this suite; the member-provider bootstrap in the adapter
does. The modeller warns about unknown suite/root keys and does not expand
the member set. A zero exit status there is not suite conformance evidence.
From the repository root, the documented existing-build check is:
python3 docs/adl-v0.5.1-vol-1-adl/examples/17-evolution/verify.py
The example README explains dependencies, artifact pinning, case generation, and disposable stores. The evidence record and verification JSON preserve source identities, exact statements, responses, stored rows, CLI/modeller results, and limits. The broad example permissions make migration effects observable; choose application permissions separately.