Repository documentation
Dynamic app descriptor
The validated discovery and execution contract for arbitrary installed Nextcloud applications.
On this page
DynamicAppDescriptor is the machine-readable boundary between API discovery,
native presentation, and HTTP execution. It lets the app present an installed
Nextcloud app without a hand-written adapter, while never inventing an
endpoint or a write. Read this before changing contract acquisition, the
descriptor compiler, or how dynamic apps read and present data.
Last reviewed: 2026-10-02. Discovery limits may have changed. The Kotlin compiler and its runtime validation tests define application behavior. The Rust validator and fixtures are reference-contract evidence, not proof of runtime parity. See schema ownership before exchanging models.
Where the code lives
| Concern | Location |
|---|---|
| Descriptor model | DynamicAppDescriptor.kt |
| Descriptor compiler | DynamicAppDescriptorCompiler.kt in the same package |
| Mapping to the native schema | DynamicDescriptorMapper.kt (toNativeAppSchema()) |
| Signed App Store acquisition | SignedAppStoreContractAcquirer.kt in the contractAcquisition module |
| Runtime orchestration | DynamicNativeRuntime.kt in ui/src/commonMain/.../app |
| Rust reference model and compiler | src/dynamic.rs and src/dynamic_compiler.rs |
Both the Kotlin and Rust models serialize camel-case JSON with
descriptorVersion: "1.0".
Contract
A descriptor contains:
- the exact app identity and an endpoint policy with the server origin and the approved API path prefixes;
- capability facts and permission requirements, each with provenance and confidence;
- typed resources and fields;
- explicit list, detail, or grid layouts;
- field links, where inferred URLs default to
allowExternal: false; - forms bound to explicit mutating actions;
- actions with method, path, path and query parameters, body media type and schema, authentication requirements, and OCS envelope metadata;
- warnings describing omitted or degraded behavior.
A descriptor is validated after compilation and again after deserialization.
Kotlin consumers call requireValid(); Rust consumers call
DynamicAppDescriptor::validate(). Validation rejects:
- unsupported versions;
- duplicate or dangling references;
- path-parameter mismatches;
- absolute or cross-origin paths, and paths outside the approved app prefixes;
- writes without advertised OpenAPI or verified-adapter provenance.
Discovery inputs
The runtime DynamicAppDescriptorCompiler and the Rust reference
DynamicDescriptorCompiler accept normalized facts in DynamicDiscoveryInput.
The sources, from strongest to weakest:
- Advertised OpenAPI. An OpenAPI 3.x document that the connected app advertised. The fetching layer supplies the document and its advertised same-origin URL; the compiler never searches arbitrary URLs.
- Signed App Store package. An OpenAPI 3.x document extracted from a
release package in the official Nextcloud App Store. It is accepted only
after local certificate-chain, signed-CRL, app-ID, version, and
archive-signature verification. Provenance is
verifiedAppPackage. - App Store-linked source tag. If a verified package contains no OpenAPI
file, an OpenAPI 3.x document from the GitHub release tag linked by that App
Store entry. Repository and tag come only from official catalog metadata,
and the tag's
appinfo/info.xmlmust reproduce the selected app ID and version. This source is unsigned and lower trust; provenance isappStoreLinkedSourceTag. Every operation must still stay inside the connected server's approved same-origin app prefixes. - Observed reads. Successful 2xx JSON GET responses from an already approved endpoint. Response-shape inference creates read-only fields, a read action, and a list or detail layout. It never creates a form or a write.
OpenAPI is authoritative for explicit writes. An unnamed OpenAPI write is omitted, every declared mutation requires confirmation, and deletes are marked destructive.
Package selection and verified read routes
Acquisition first tries the release that exactly matches the installed version. If that release has no usable contract, it tries other non-prerelease releases with the same major and minor version from the server-compatible catalog, preferring the nearest earlier patch. A contract from such a release is labeled patch-compatible in the user-visible diagnostics; it still passes the same signature, app identity, and version checks.
A verified package without OpenAPI can still yield verified read routes.
StaticRouteContract.kt
parses appinfo/routes.php with a bounded literal-array parser and never runs
PHP. It keeps a route only when its controller statically extends a supported
Nextcloud controller, declares the referenced method, and either uses an API
base or declares a JSON-serializable response type. Read the source comment for
the narrow write shapes it can retain.
Acquisition may keep verified read routes while checking compatible releases for a richer contract. If an optional later package returns HTTP 404 or 410, an already verified route contract stays usable. This never bypasses certificate, signature, app identity, or version checks, and never turns unverified routes into a fallback. Without a verified route contract, a missing package is an acquisition failure.
Rust fixtures in tests/fixtures/ cover an advertised OCS/OpenAPI app and an
unknown app learned from a successful JSON list response.
Structured row details and form eligibility
A row detail reuses explicit composite table relationships and verified column reads.
NativeTableRecordScopeselects one table or view scope from the returned parent foreign key, instead of rejecting every schema with several composites.- Sparse response schemas may leave that key in bounded display data. Using it
to read related columns never makes it mutation authority. A column route's
generic
idbinds the parent only through its verified parent link. NativeTableRecordDetailrenders declared column labels and complete observed cells in a local display copy. Conflicting identities, ambiguous scopes, duplicate columns, and truncated values keep the existing fallback.
Descriptor navigation withholds a form when a required body field has no native
input. For example, a required string-or-object data union must not become a
form containing only an optional view selector. Action execution keeps its own
body completeness checks.
Authenticated application reads
JvmAuthenticatedAppReadSession.kt
prepares an account session before dynamic GET requests under the account's
/apps/ or /index.php/apps/ prefix. Some apps need this because they resolve
their user while the filesystem app boots:
Nextcloud 34.0.3 loads filesystem apps before Basic login,
and Music 3.2.1 resolves its user in application boot.
Session and cookie bounds
- Concurrent reads share one authenticated OCS profile GET per account and credential generation.
- Cookies stay in process memory and expire within 15 minutes. At most 16 cookies and 8 KiB are kept per account, for at most eight accounts.
- A repeated cookie name with the same domain and path uses the final response value, including deletion, so session rotation cannot resend an old session ID.
- The adapter checks the exact origin and account path, rejects cross-account redirects, and sends cookies only with application reads. Mutations and public contract downloads keep their existing authentication.
- Credential replacement, account retirement, and unauthorized responses invalidate the session, and stale work cannot restore it.
- No cookies or profile bodies reach support diagnostics or persistent storage. Bootstrap failures record only a stable stage and code, plus an HTTP status when available. Cancellation creates no failure event.
Failure behavior
- An unavailable bootstrap endpoint (404, 405, or 501), or a valid profile without cookies, leaves Basic authentication in use with a one-minute bootstrap cooldown.
- Authentication, network, malformed-response, and other server failures stay failures. The adapter never retries a failed application read.
Deterministic tests cover isolation, retirement, cancellation, bounds, redirects, and unsupported bootstrap behavior. A successful bootstrap does not establish that an app's individual operations are compatible.
Discovery diagnostics
DynamicDiscoveryDiagnostics.kt records bounded stage and outcome tokens for
acquisition, JSON parsing, and descriptor compilation in the existing support
diagnostics. It records no contract content, exception text, account identity,
or request URL. Cancellation propagates without a failure event, and a recorder
failure never discards a usable contract. An unverified app version keeps
writes disabled without showing a permanent refresh spinner.
The contract information dialog shows stable diagnostic codes, such as
server-probe-inconclusive or signed-package-imported. Discovery records
them as typed DynamicDiagnosticCode events, and import codes derive from the
typed acquisition kind, so rewording a diagnostic message never changes a code.
Metadata fallback reasons
Last reviewed: 2026-10-17. This section describes source and deterministic test behavior; the code may have changed since, and the linked sources are authoritative. It is not a claim about a published release.
When no same-origin or App Store source yields a verified contract, discovery
keeps the metadata-only descriptor and records a typed reason in
DynamicContractFallback.kt.
The fallback notice derives its title, explanation, and action from that reason:
- the inspected releases provide no verified contract for the installed version;
- the App Store lists no release matching the installed version;
- the App Store lists the app, but the entry that would be selected lacks a required value such as its certificate, download, signature, or signature digest, or supplies one with the wrong JSON type;
- an App Store catalog document could not be read at all, so no entries were available to check;
- the app's linked source refused or rate limited the last fallback request (HTTP 403 or 429), so a contract may still exist;
- an explicit retry came less than a minute after the previous catalog check and no saved catalog could be reused;
- the App Store returned data this version cannot use, such as a response over its size limit;
- the server's own API catalog or contract probe was inconclusive;
- the server rejected the account's credentials, or the account may not read the server's API catalog, during that probe;
- the server or App Store offered a contract that cannot be shown natively, such as a Swagger 2 document;
- the server or app version could not be confirmed;
- the App Store could not be reached, or did not provide the release;
- the App Store answered, but the app's linked source repository could not be reached; this is kept apart from an App Store outage where the linked request is made, never inferred from exception text;
- the package or its source failed verification;
- the client could not complete the check.
ContractAcquisitionFailure.kt
classifies the module's own failures: HTTP status responses, verification and
origin rejections, malformed request values, network failures, and runtime
linkage errors. Writing a downloaded catalog to the local cache is best effort,
so a local storage failure is never reported as an unreachable App Store.
JvmAppStoreContractAcquisition.kt
translates them once for both JVM targets. It also catches LinkageError. If
acquisition code cannot initialize on a runtime, for example because the
Android ICU engine rejects a regular expression, the result is a client-fault
fallback, not an exception class name. Discovery diagnostics, fallback copy,
and contract information never contain exception messages, request URLs,
hosts, paths, header values, or response bodies. Same-origin diagnostics name
only a stage (catalog, spec, body, or compilation), a typed probe result, an
HTTP status class such as HTTP 5xx, a sanitized spec identifier, and a
bounded media type. A fallback reason is never persisted. The original
exception remains only as the cause of the typed acquisition exception, for
local debugging; it is never written to diagnostics or support reports.
A completed acquisition without a contract is a typed outcome, not a bare
null.
ContractAcquisitionOutcome.kt
separates no matching release, a malformed catalog entry, a temporarily
unavailable linked source, and releases inspected without a usable contract,
and the shared JVM boundary carries that reason to the fallback notice. Catalog
parsing records which required value made each dropped entry unusable. A
required value must have its exact JSON type: a number, boolean, object, array,
or null where a string belongs, or an isNightly that is not a boolean, is
malformed like a missing value and is never coerced.
These readers also require exact JSON types:
- In the acquisition module's contract readers, a non-string
openapiversion, operation ID, parameter name or location, or reference is ignored. A non-booleanrequiredflag counts as required. - The same-origin probe accepts only a string
openapiversion, so a number such as3.0is an unsupported contract. It also matches OCS API Viewer entries by a stringidonly. - The descriptor compiler reads string fields only from JSON strings. These
include
openapi, operation IDs, parameter names and locations, schema types and formats, summaries, descriptions, titles, and references.
The descriptor compiler does not yet type-check boolean flags such as
required, readOnly, and nullable, or the items of string arrays: required
property lists, tags, enum values, and security scopes. Those still accept a
value of another primitive type and read it as text or as a boolean.
A catalog document that is truncated, empty, not JSON, or not an array is an
unreadable catalog, a reason of its own, because no entry could be read. So is
a non-empty array in which no element is an app object with a string id. Such
a document is never cached, so checking again downloads it again.
A corrupt or mismatched App Store-linked source archive yields no candidate,
like an archive without a contract, instead of an unexpected client fault.
ContractAcquisitionEvidence.kt
records what one acquisition actually inspected:
- whether each catalog document was readable;
- the entries dropped as malformed, including a top-level element that is not
an object or has a missing or wrong-typed
idwhile the app was not found, because that element may have been the app, and differing records that share the app'sid, because no single one can be trusted (structurally equal copies are read once; key order does not matter and numbers compare by value, so1equals1.0); - the candidates inspected, and what each provided;
- whether a linked source refused a request.
The no-contract reason comes only from that record, in this order:
- A refused or rate-limited linked source, because a contract may exist there.
- A catalog the refresh window refused with no cached copy, so it was not read
at all:
RecentlyChecked. Waiting out the window is the next step, so this ranks above an unreadable catalog. - An unreadable catalog.
- Malformed evidence that could have matched: an entry for the exact version or with an unreadable version, a patch-compatible entry in the platform catalog, an app without a readable release list, or an unidentified top-level element.
- No usable contract, only when every candidate that could have matched was inspected.
- No matching release, only when the catalogs were fully readable, nothing relevant was dropped, and nothing matched.
A dropped entry for an unrelated version never changes the reason.
App Store catalogs are cached for six hours. The first discovery of an app
screen uses the cache. A discovery started by, or after, an explicit retry on
that screen carries AppStoreCachePolicy.Refresh through the platform
boundary to the acquirer, which downloads each catalog again at most once per
minute per catalog URL. A retry inside that window reuses the cached copy; if
none is available, for example after a cold start or an expired entry, it makes
no request for that catalog. Explicit retries therefore cause at most one App
Store request per catalog URL per window. The window is shared across apps and
versions to protect the App Store, so one catalog can be refused while the other
is downloaded fresh. A refused catalog is uninspected evidence, never absence:
candidates from the catalog that was read are still inspected, and only when
none of them provides a contract does the refused catalog make the result
RecentlyChecked. Automatic discovery
without a cached catalog downloads it normally. A forced download that fails or
is unreadable leaves the cached catalog in place, because only a readable
catalog replaces it, and an older download never replaces a newer one; see the
publication order below.
The same policy covers verified contracts. Automatic discovery serves a cached
verified contract. A refresh looks past it and downloads the package or linked
contract again; a newly verified contract replaces the cached one, while a
failed refresh leaves it in place. When the window refused or served from cache
any catalog a refresh needed, and no candidate it could inspect provided a
contract, the refresh serves the cached contract when one exists. When an acquired contract cannot be parsed or
compiled, discovery discards the cached contract for exactly that app, server
version, and installed version, so the next automatic discovery acquires it
again; other cached contracts stay. If the cached file cannot be deleted, an
invalidation marker beside it, or, when that also fails, a record kept for the
life of the process, makes every later read a miss, and each later read or
store retries the deletion. A VERIFIED_CONTRACT_DELETION_FAILED warning
diagnostic records which of the two applied, with no path or exception text.
Each cache key has an entry file, an optional invalidation marker, an optional
in-process record, and, while a store runs, a temporary file that reads ignore.
VerifiedContractCache.kt
holds one lock for every operation and moves between these states:
| State | Read | Invalidation | Store |
|---|---|---|---|
| Absent | Miss | No change | Write the temporary file, then move it into place |
| Valid entry | Hit | Delete the entry; if that fails, add the record and write the marker | Write the temporary file, delete the entry, move the file into place; if a step fails before the move, delete the older entry or else invalidate it |
| Entry with marker or record | Delete the entry, then clear the marker and record; miss | Retry the deletion; stays invalidated until the entry is gone | Delete the entry first; if that fails, change nothing and refuse. Then clear the marker and record; if that fails, refuse. Then write and move |
| Marker without entry | Clear the marker and record; miss | Clear the marker and record | Clear the marker and record (if that fails, refuse), then write and move |
| Leftover temporary file | Ignored | Ignored | Ignored; each store uses a new name |
An invalidation is removed only after the invalidated entry is gone, and a new
entry is written only after the invalidation is gone. Process death or a failed
write, such as a full disk, at any step therefore leaves either the invalidated
entry with its marker, or no invalidated entry; an invalidated contract never
becomes readable again. A valid entry that cannot be replaced is deleted or
invalidated, so an older contract is not served after a restart in place of a
newer one. Only an entry whose deletion and marker both failed relies on the
in-process record alone, which a restart loses. A refused or failed store keeps
the contract in memory, and a VERIFIED_CONTRACT_NOT_PERSISTED warning
records InvalidationNotCleared or Failed.
Results are ordered per app, server version, and installed version by
ContractPublicationFence.kt.
Each acquisition takes a generation in the same step that registers it as in
flight, so a later refresh or invalidation always sees it as started; a caller
that joins an acquisition already in flight takes none. A generation that has
not been superseded ends as follows:
| Ending | Effect on older generations |
|---|---|
| Verified contract | Published; every older generation is superseded |
| No matching release, no usable contract, or malformed entry | Recorded; every older generation is superseded |
| Refused linked source, unreadable catalog, throttled retry, source or network fault | None |
| Cancellation | None |
| Cached contract served without inspecting releases | None; it is served only while no no-contract result or invalidation is the latest accepted result |
An invalidation supersedes every generation already started. A transient ending fences nothing because it proves nothing about the contract, so an older acquisition that verifies a contract afterwards may still publish it. A superseded acquisition never publishes or reports its own result; it reports the newest accepted one: the newer contract, the newer no-contract reason, or, after an invalidation, no usable contract. A slower automatic acquisition that began before an explicit retry therefore cannot overwrite or contradict the retry's result. A no-contract result does not remove a previously cached contract, but while it or an invalidation is the latest accepted result, a cache read reports that result instead of the cached contract. That record is kept in memory, so after a restart the cache is served until a refresh records it again. A contract read from the persistent cache enters the in-memory cache only through the same ordering: a read that a newer accepted result superseded, or that follows a no-contract result or an invalidation, does not promote it, and a promotion never replaces a contract already in memory. The ordering is kept in memory for each acquirer and never waits for another acquisition, so a cancelled or failed acquisition cannot hold back later ones.
Catalog downloads are ordered per catalog URL by
CatalogPublicationFence.kt.
A download takes a generation before its request is sent, and its readable
catalog replaces the cached copy, in memory or on disk, only if no download of
the same URL that started later was stored first. As for contracts, only
evidence fences: an unreadable catalog, an HTTP or network fault, a refused
refresh, or a cancellation stores nothing and fences nothing, so an older
download that succeeds afterwards is still stored. The fence records the digest
of the newest catalog it accepted, even when storing it failed, and a cached
copy that does not match is read as a miss.
The two orderings compose. A contract or definitive no-contract result records the catalogs it was read from, and it is accepted only while each of them is still the newest catalog for its URL; otherwise the acquisition runs again from the newer catalog, up to three times, and then reports the source as temporarily unavailable, which fences nothing. A result read from the newer catalog outranks an accepted result read from a catalog that was since replaced, even if that result's acquisition started later. A catalog download that finishes after a refresh therefore cannot bring back a removed release.
Every cache that contract acquisition writes, and what keeps an older writer from finishing over a newer one:
| Cache | Key | Writers | Ordering |
|---|---|---|---|
| App Store catalog, in memory or on disk | Catalog URL; a SHA-256 file name on disk | A readable download in AppStoreCatalogReader |
CatalogPublicationFence by download generation; the file cache also holds one lock for every read and write |
| Verified contract, in memory | App, server version, installed version | Publication, invalidation, and promotion of a disk read | ContractPublicationFence: publish, invalidate, and promote each run under its lock and generation rules |
| Verified contract, on disk | SHA-256 of the same key | Publication stores, invalidation removes; a read deletes only an invalidated entry | Stores and removals run inside the contract fence; the cache holds one lock and the state table above |
| Refresh window | Catalog URL | CatalogRefreshThrottle.tryRefresh at the start of a refresh |
One atomic update per URL that also reads the clock, so a caller that read the clock earlier cannot move the window back |
| Acquisitions in flight | Request and cache policy | Registration and completion in acquireOutcome |
Registered with its generation under the contract fence lock; removed only by the acquisition that registered it |
| Fence state | Catalog URL; request | The two fences | Counters only grow, each under its fence's lock |
The fences are in memory for each acquirer, so after a restart the first results are ordered from that point on.
DynamicSameOriginDiscovery.kt
records same-origin probe results as typed DynamicServerProbeFailure values.
When probes disagree, the highest-precedence result wins, and the first one
wins among equals:
- HTTP 401 (
AuthenticationRequired): the card asks the person to sign in again and offers no retry, because checking again would resend the rejected credentials. The app has no reauthentication within a session, so its Open account settings action leaves the app for Settings, where Account holds Sign out and revoke access; the card also names that route. The action only navigates, so nothing is signed out until the person chooses to. A screen that cannot open settings shows the explanation without a button. - HTTP 403 (
PermissionDenied): the account may not read the catalog, which may be limited to administrators. Its Check again action stays, and the card says that checking again helps only after an administrator grants access or the App Store adds a release. - Inconclusive results that a retry may resolve: no response, a 5xx status,
HTTP 429, any other unsuccessful status that is not a definitive absence
(
UnexpectedStatus, for example 400, 405, 408, 409, 412, an unfollowed 3xx redirect, or a 1xx status), or a successful catalog or contract response that is not readable JSON or declares no OpenAPI version (UnreadableResponse). An OCS API Viewer entry for the app whose spec list is missing, not an array, or has a malformed identifier with no usable one left is alsoUnreadableResponse; usable identifiers beside malformed ones are still read. When the catalog does not list the app, an element that is not an object or has no stringidmay have been the app, as in App Store catalogs, so it is alsoUnreadableResponse; such elements beside the app's entry are ignored. Differing records with the app'sidareUnreadableResponsetoo, and none of them is read; identical copies, compared as JSON values, are read once. UnsupportedContract: a JSON contract that declares a version other than OpenAPI 3, such as Swagger 2, or an OpenAPI 3 contract that cannot be compiled.
Only 404 and 410 are definitive absence statuses; every other unsuccessful
status is classified, so a failed request is never read as absence. A 404 or
410, a non-JSON response at a static contract location, an empty OCS API Viewer catalog or one whose entries all name other
apps by a string id, or a well-formed
spec list that is empty or names only other apps is absence and
records nothing. Every App Store path that ends without a usable contract goes
through one precedence point: no release can be selected because the server
version is unavailable, no release or contract exists, acquisition fails with a
typed or unexpected failure, or an acquired contract cannot be parsed or
compiled. Any recorded server result takes precedence over that reason. A
definitive server absence keeps the App Store or version reason. Diagnostics
record both sources either way, and never include request URLs, headers, or
response bodies.
Failure classification
Every failure caused by remote or source data maps to a typed source outcome,
every network failure maps to a network or temporarily unavailable outcome, and
only genuine client faults remain unexpected. Size limits throw
ContractSourceTooLargeException, a source failure.
| Site | Failure | Classification |
|---|---|---|
| Request validation | Malformed app ID, server version, or installed version | Invalid request, shown as an unconfirmed version |
| Verified contract cache | Missing, expired, or unreadable entry | Ignored; acquisition continues |
| Catalog and package requests | No response; non-success status; redirect away from HTTPS | App Store unreachable (network); source unavailable; verification failed |
| Catalog and package bodies | Declared or streamed size over the limit | Source unusable |
| Catalog document | Truncated, empty, not JSON, not an array, or only elements without a readable app identity | Unreadable catalog, never cached |
| Catalog app element | Not an object, or an object with a missing or wrong-typed id, while the app is not found |
Malformed source, not no matching release |
| Catalog app records | More than one differing record with the app's id |
Malformed source; identical copies are read once |
| Catalog entry | Missing value, a required value of the wrong JSON type, or a download that is not an HTTP URL | Malformed source when it would be selected |
| Candidates exhausted | A catalog was unreadable, or an exact, compatible, or unidentified entry was dropped, and no inspected candidate has a contract | Unreadable catalog or malformed source, not no usable contract |
| Verified contract publication | A newer generation published a contract or ended without one definitively, or an invalidation happened | Not published; the newest accepted result is reported |
| Catalog cache write | Local storage failure | Ignored; the next read of the older cached copy is a miss |
| Catalog cache write | A download of the same URL that started later was already stored | Not stored; a result read from it is not accepted and the acquisition runs again |
| Explicit retry inside the refresh window without a cached copy | None | No request for that catalog; candidates from the other catalog are still inspected, and recently checked only if none provides a contract |
| Package verification | The package's signature, certificate, chain, revocation, identity, archive structure, or app metadata rejected | Verification failed |
| Package verification | Bundled root certificate or revocation list missing, unreadable, corrupt, expired, of an unsupported format, or inconsistent | Client fault (runtime incompatible); retrying cannot repair it |
| Package archive limits | Entry, expanded, path, or metadata-count limit exceeded | Source unusable |
| Package OpenAPI JSON or YAML | Unreadable or not OpenAPI 3 | Candidate skipped |
| Linked metadata, tree, spec, schema, and archive requests | 404; size over the limit; other status; no response | Skipped; skipped; source unavailable; linked source unreachable, never App Store unreachable or no usable contract |
| Linked archive request | HTTP 403 or 429 | Source temporarily unavailable |
| Linked archive content | Corrupt, unsafe path, identity mismatch, malformed or misencoded info.xml, size limit |
No candidate |
| Linked JSON or YAML documents | Unreadable | Skipped |
| Acquired contract | Unreadable JSON or a descriptor that cannot be compiled | Unsupported contract; that cached contract is discarded |
| Verified contract cache discard | The cached file cannot be deleted | Marked invalid, or invalidated for the process; never served again |
| Verified contract cache store | An invalidated entry or its marker cannot be removed | Nothing written; the invalidation stays; served from memory; VERIFIED_CONTRACT_NOT_PERSISTED warning (InvalidationNotCleared) |
| Verified contract cache store | The temporary file cannot be written or moved into place, for example on a full disk | No invalidated or replaced entry stays readable; served from memory; VERIFIED_CONTRACT_NOT_PERSISTED warning (Failed) |
| Contract module class loading | LinkageError |
Client fault |
| Same-origin probes | See the precedence list above | Typed probe result |
| Same-origin probe status | 404 or 410 | Absence; records nothing |
| Same-origin probe status | Any other unsuccessful status without a specific kind | Inconclusive (UnexpectedStatus); diagnostics carry only the status class |
| Remaining unexpected failures | XML parser configuration, internal invariants | Client fault |
Read failures
DynamicReadFailure.kt
classifies unsuccessful HTTP reads as authentication, permission, missing
content, throttling, server failure, or rejected request.
- Ordinary UI names the affected collection and a safe next step. It never shows request methods, resolved endpoints, arbitrary server messages, or exception class names.
- The reviewed mailbox-not-synchronized message stays available without revealing a mailbox identifier.
- The exception keeps typed status and method fields. Platform network diagnostics keep status, method, bounded response size, and a redacted URL. Presenting the error never makes another request or duplicates that event.
DynamicReadFailureTest
covers message privacy, status classification, malformed and oversized error
bodies, invalid text, and deeply nested JSON.
Reviewed limits
Server bases and origins
- The Kotlin importer rejects OpenAPI 2 (Swagger) and ambiguous multiple server bases.
- Whole-host server templates are allowed only for trusted package or App
Store-linked contracts. Concrete foreign origins and fixed-host templates such
as
https://{tenant}.vendor.testare never rebased onto the connected server. Relative and concrete same-origin servers stay valid. - Trusted whole-host templates keep the authenticated account authority when the port is omitted or templated. A concrete declared port must match the account port, and a concrete scheme must always match. The importer returns only the validated path base, never a replacement transport origin. Tests cover non-default ports, IPv6, explicit mismatches, and untrusted templates.
- Acquisition rejects concrete package-server authorities because it cannot prove the connected account owns them.
- Host placeholders are parsed without a brace regular expression. The
uibuild checkscommonMain.tools/check-kotlin-architecture.shchecks the shareduisource sets compiled for Android, the contract module, and everyandroidAppsource set except JVM unit tests. AppOwnedOpenApiAndroidInstrumentedTestinitializes every top-level contract-module class, exercises host rejection, the real catalog path with a failing cache, and YAML parsing on the Android runtime. CI does not run instrumented tests; run it with the emulator workflow in CONTRIBUTING.md. The JVM unit testContractModuleInitializationTestloads every facade and fails when one is missing from the instrumented list. JVM loading does not prove ART or ICU compatibility.- Path and operation server overrides must pass the same origin checks and
resolve to the root server path base. Different override bases are rejected,
not ignored. An absent override inherits the base; an explicit empty array
resets it to
/and is rejected if that differs from the document base. See the OpenAPI server and override rules. - Acquisition requires a declared app-owned server base or app-owned operation
paths. A root spec filename and
/api/...paths do not prove an app prefix. Missing or emptyserverslists are never rewritten to/apps/{appId}, because OpenAPI defaults the server base to/.
Parameters and schemas
- API-version defaults are bound only after inherited parameters, operation overrides, and local schema references resolve. A server-derived version must satisfy the parameter's declared enum or default. Unknown schema constraints prevent server-derived defaults instead of being ignored.
- Object
allOfflattening accepts only preserved shape keywords and known descriptive annotations. Conditional, unknown, and malformed member constraints withhold the write action and form. This includes OpenAPI 3.1if/then/else,const, and dependent schemas; see the OpenAPI schema rules. - External schema references in trusted Kotlin imports are sanitized before compilation. Untrusted remote references are unsupported.
- OpenAPI security alternatives are flattened into conservative authentication requirements. Optional or alternative scheme selection is not modeled.
Navigation safety
- Command-like GETs are excluded from root and contextual navigation, including linked child tabs and automatic child selection. Verified provenance does not make reset, delete, toggle, or similar commands safe navigation reads.
- This covers command segments before trailing identifiers and operation IDs with a command verb at any word position. A middle command word is accepted only when the terminal word is status, history, preview, export, or download. Repeated words do not change which word is terminal, and read suffixes cannot override command prefixes or command paths.
Inference and rendering
- JSON inference samples at most 64 objects and 128 fields. Empty collections stay fieldless until a non-empty response or a schema is available.
- JSON examples cannot establish validation rules, pagination, sync semantics, ACL behavior, or write payloads.
- GraphQL introspection, DAV XML schemas, HTML or accessibility inspection, and JavaScript traffic instrumentation are not discovery sources.
- Inferred URL fields are display and copy metadata only. External navigation needs verified policy or an explicit user handoff.
toNativeAppSchema()adapts the descriptor for the renderer, but the executor must keep the original dynamic action, because schema 0.1 cannot carry query, authentication, permission, or OCS metadata.- The common Kotlin compiler provides the same OpenAPI and read-shape paths on Android and desktop. When both sources are supplied, it prefers advertised OpenAPI and does not merge observed fields into it.
Reviewed read semantics
The sections below describe narrow, reviewed rules that improve navigation and presentation for specific shapes. None of them grants write authority. Unless stated otherwise, the evidence is deterministic tests; device and release evidence is recorded in COMPATIBILITY.md.
Message thread read navigation
Mail 5.12.2 MessagesController
provides the reviewed getThread and getBody identity behavior.
A thread collection can return message envelopes while its generated resource is
named after the thread endpoint. DynamicMessageReadSelection recognizes the
reviewed nested message and thread route only when that GET and its sibling
body GET both have verified provenance and stay inside the endpoint policy. The
exact route resource wins over singular or plural aliases.
- An explicit positive
databaseId, a matching parsed record identity, and a compatible mailbox context bind the selected message. - Protocol Message-ID, IMAP UID, mailbox ID, and the previously selected message cannot substitute for this identity.
- The rebound selection authorizes reads only. Missing evidence keeps ordinary navigation.
Tests cover identity separation, stale parent parameters, missing provenance, unsafe routes, and unavailable body actions.
Media container entry points
Album and playlist selections open a single existing track or song collection
when a verified read action declares a parent filter or nested parent parameter
and the navigation plan binds it to the selected container. The rule uses
resource meaning and verified parameter bindings, not app IDs or invented
routes. Ambiguous collections, stale parent bindings, and unverified actions
stay explicit choices. DynamicMediaNavigationTest covers filtered and nested
reads, identity separation, and refusal cases.
Reviewed playlist expansion
Music 3.2.1 PlaylistApiController
declares the fulltree read option and the ordered complete track response.
MusicPlaylistRead.ktrequests this option only for that reviewed version and route, with signed package provenance and a declared scalar union that accepts booleans. Explicit caller choices stay intact.NativePlaylistTracksuses the existing media collection UI for complete, bounded track objects. It keeps playlist order and repeated tracks, and keeps observed identities read-only.- URI-only references, missing playback evidence, ambiguous indices, and truncated responses are not expanded.
Budget dashboard source selection
withNativeBudgetDashboard in NativeBudgetSemantics.kt selects an existing
verified accounts-collection GET that needs no path or query context.
- An account detail route cannot supply the dashboard's root data, even when its generated view appears first.
- Dashboard account rows use the verified parameter-free accounts list, including an OCS primary action whose older non-OCS route is fallback-only.
- Optional cash-flow totals stay unavailable when the contract has no compatible report summary read. Recent transactions are not extrapolated into totals, and per-account balances are never summed and labeled net worth.
- Optional summary failures stay visible as partial results.
Tests cover the Budget 2.54.0 descriptor-to-schema shape, detail-first ordering, and unavailable required context.
Table row and view containers
The composite table mapper tells a row collection from a related view container
by its declared child collection read. A container that also has a cell-map
field does not make the leaf rows ambiguous; unrelated candidates stay
ambiguous. DynamicTableDetailPipelineTest covers descriptor mapping, sparse
row parsing, table-scoped column loading, and named-cell projection together.
Table row details use the projected columns to choose a display-only title, which never replaces the authoritative row ID.
- The primary cell appears once with its column label, and the remaining typed cells stay together.
- Inventory cards summarize declared row and column counts and put secondary metadata behind Details.
- Collection summaries say how many records are loaded rather than presenting a partial page as a server total.
- Compact row cards show up to three labeled user columns and the number of additional fields. Envelope ownership and timestamps do not displace them. Original records still supply selection and edit identity.
Recipe collection pagination
The recipe surface keeps the collection's paging state and load-next-page
callback. Filtering searches loaded recipes and does not claim server-wide
search. An empty filtered page keeps pagination and retry reachable, so a
matching recipe on a later page can still appear. Loading stays
repository-owned. RecipeCollectionPaginationSceneTest covers dispatch,
loading, retry, and later pages.
Mail reading hierarchy
Mail reading sections put the verified message body and thread reads first. DKIM, raw source, smart-reply, and itinerary probe routes stay in the contract but are left out of the ordinary section chooser. This issues no optional reads and invents no diagnostics destination. Attachment cards show bounded metadata only; opening an attachment needs a separate validated message and attachment binding plus native download integration.
Pantry timestamps and cards
For Pantry 0.34.0 only, the presentation adapter marks integer createdAt and
updatedAt fields on houses, lists, and items as epoch seconds, and only with
verified contract evidence. The upstream HouseService and ChecklistService
assign PHP time() to these fields; see the
Pantry source repository.
Rendering shows an explicit UTC date and time while keeping the integer field
kind, original values, and action bindings. Other versions and shapes are
unchanged.
For the same version, household and list cards put names and descriptions first. Item rows keep task completion and recovery ownership while showing quantities and descriptions. Reminder, retention, permission, and other secondary fields stay reachable through details and forms.
Activity and Search links
A server-provided search or activity URL is considered before broad provider or parent-folder hints when the shared link policy recognizes an exact native Files destination or installed app root. A web URL containing a board, note, event, or other item ID is not evidence for an API action binding. Unsupported item routes keep the native fallback until a reviewed typed route mapping exists; no endpoint or parameter is synthesized from the URL. The navigation rules are in ADAPTER_ARCHITECTURE.md.
Compact record summaries
Card subtitles and inline facts show a few values without much context, so
NativeSummaryFieldPolicy.kt
keeps values that cannot explain themselves out of those slots. The excluded
fields stay available in the record's Details section.
- An integer named as a point in time, such as
lastUpdated,lockedUntil, orcreated_at, is excluded unless a reviewed adapter declared its epoch unit. The unit is never guessed from the value's magnitude. - An integer status, state, type, mode, or access-level code is excluded unless the contract declares labels for its values. A bare integer is never a subtitle.
- Response bookkeeping such as integrity hashes, partial-object flags, lock
holders, trash counters, and negative configuration flags such as
deletiondisabledis excluded. - A count without a noun, such as
2 items, and a single-character code are not subtitles. Sort-order configuration fields are excluded. - Count labels drop API prefixes, so
Nb Billsreads asBills.
NativeSummaryFieldPolicyTest covers these rules with Forms- and
Cospend-shaped records.
Auxiliary protocol destinations
Session, token, connection-test, and keep-alive reads exist for web clients.
DynamicAuxiliaryDestinations.kt
removes them from root and contextual navigation tabs. It matches whole words in
the resource ID and label, never substrings or the app ID, and never removes the
only remaining destination. DynamicAuxiliaryDestinationsTest covers the
matching and the last-destination rule.
Metadata-only fallback
When discovery finds no verified contract, the workspace shows a notice in place of the app's content, built from the typed fallback reason above. When the installed version publishes no interface the client can verify, the notice names the app, says so, and offers Check again. Every other reason keeps its own explanation and action, so an unreachable source asks to try again and rejected credentials lead to account settings. The notice does not render the app identity record as content, and it does not show discovery diagnostics, which can contain exception text; those stay in support diagnostics.