# Portable runtime (/docs/cloud/portable-runtime)

<CloudWaitlistNotice />

The UI can author a portable deployment definition directly. Validate it using
the protocol package, then load it with `rehydrateProtocolDeploymentContract`.
TypeScript and Python authors export the same deployment vocabulary. Cloud's
portable runtime rebuilds these definitions and uses the TS dataset compiler;
Python local execution uses its own native planner.

Providers can use `createPortableSemanticRuntime({ queryBuilder: db })` for both
`runtime.compile(input)` and `runtime.execute(input)`. Both resolve the same
activation catalog, tenant context, and row budget. These are trusted adapter
operations: the deployment data plane or an equivalent provider boundary must
authenticate and authorize the request before supplying the input. Compilation
does not run preflight guard statements; execution runs them before reading rows.
Portable compilation includes `activationRevision` in its structural description
so the diagnostic record identifies the definition generation used.

The shipped capability matrix says what Core supports for each feature:

<CodeBlock>
```typescript
import { DATASET_EXECUTION_CAPABILITIES } from '@hypequery/datasets';

const portableFeatures = DATASET_EXECUTION_CAPABILITIES.features
  .filter(feature => feature.portable)
  .map(feature => feature.feature);
```
</CodeBlock>

The matrix distinguishes protocol representation, TS/Python local support,
TS/Python publication, and Core's portable runtime. It covers base and derived
measures, segments, window/shift measures, approximate distinct counts, and sub-day
grains. It is a conservative feature discovery aid, not per-definition validation.
It makes no claim about a hosted service. A deployment target says which
deployment contract and semantic invocation versions it accepts in its live
state (`accepts`, RFC 0030), and `hypequery deploy` checks a deployment against
it before upload. The deprecated `cloud` flag and `cloudDeploymentVersion` never
described Cloud and will be removed in a major release.

Publishing emits deployment v2 unless a dataset uses a contract 3 feature. Its formula grammar is narrower than
local planning: a derived measure may reference only base measures, and a
literal may appear only as `round` decimals or a `coalesce` fallback.
`buildProtocolDeploymentContract` and `assertDeployable` refuse anything else
with an error that names the dataset and measure; see
[Deployable formulas](/docs/datasets/measures#deployable-formulas). Protocol v3
acceptance alone does not enable v3 features in the portable runtime. When adding a portable dataset feature,
complete its protocol representation, SDK authoring/export, cloud rehydration and
execution, and Python native planning; update the matrix and its TS/Python probes
together. Enable UI controls only for a target whose executable support is present.
