# Compatibility and versioning policy

**Status: draft, applies to the v0.1 drafts.** This document states what
may change, how changes are signalled, and what implementations must do to
remain interoperable across versions. Where a specification's own
"Compatibility" section is more specific, that section governs for that
specification.

## 1. Independently versioned specifications

OpenFlange is a family of specifications. Each has its own identifier and
its own version, and each can advance without the others.

| Specification | Identifier |
|---|---|
| Pipe | `openflange.org/pipe/v0.1` |
| Pipeline | `openflange.org/pipeline/v0.1` |
| CLI | `openflange.org/cli/v0.1` |
| HTTP | `openflange.org/http/v0.1` |
| Registry | `openflange.org/registry/v0.1` |
| Standard library | `openflange.org/std/v0.1` |
| Portable tests | `openflange.org/test/v0.1` |
| Lockfile | `openflange.org/lock/v0.1` |

Auxiliary document formats defined by those specifications use the same
scheme (`openflange.org/package/v0.1`, `openflange.org/layout/v0.1`).

The identifier has the form `openflange.org/<name>/v<major>.<minor>`. It
is a name, not a URL to be fetched. Documents and protocol messages carry
it in their `spec` member, so every artefact states which contract it was
written against.

Each specification document also has a full version in its frontmatter
(currently `0.1.0-draft`). The patch component and the `-draft` suffix
track editorial revisions of the text; they never appear in `spec`
members.

## 2. What a version number promises

### During 0.x (now)

All v0.1 contracts are `experimental` unless labelled otherwise.

- A **patch or draft revision** (0.1.0-draft to 0.1.0, 0.1.0 to 0.1.1)
  contains clarifications and corrections. Where a correction changes
  behaviour that fixtures already pinned down, it is listed in
  [CHANGELOG.md](CHANGELOG.md) under "Changed".
- A **minor version** (v0.1 to v0.2) **may break compatibility**. Every
  incompatible change is announced in the changelog with a migration note,
  and goes through an RFC. The identifier changes
  (`openflange.org/pipe/v0.2`), so old and new documents remain
  distinguishable.
- Until the first drafts are published, the v0.1 drafts themselves may
  still change incompatibly; the changelog records it.

### After 1.0 (intent)

"Stable" will mean:

- a document that is valid under `v1.x` is valid, with the same meaning,
  under every later `v1.y`;
- a minor version only adds: optional members, new enumerated values in
  places declared extensible, new optional features gated by `requires`,
  new error codes;
- removal or change of meaning happens only in a new major version, after
  the feature has been `deprecated` (section 6);
- a runner that implements `v1.y` accepts documents written for any
  `v1.x` with `x <= y`.

No date is set for 1.0. The conditions for promoting features to `stable`
are in [GOVERNANCE.md](GOVERNANCE.md).

## 3. What implementations do with versions

- A processor MUST read the `spec` member of every document it handles
  and MUST reject a document whose `spec` it does not implement
  (`E_UNSUPPORTED`), rather than guessing. A missing `spec` where one is
  required is `E_MANIFEST`.
- A processor MAY implement several versions of a specification side by
  side and select by `spec`.
- Mixed versions across specifications are expected: a runner may, for
  example, implement Pipe v0.1 and HTTP v0.2. Compatibility between
  particular versions of different specifications is stated in the newer
  specification.

### Advertising implemented versions

A runner advertises the specification versions, standard pipes and
optional capabilities it implements through `openflange version
--capabilities` (CLI specification). HTTP pipe servers state the protocol
version in the `spec` member of `GET {base}/pipes`. Tools SHOULD check
these before execution and report unsupported requirements up front
instead of failing mid-run.

## 4. Mandatory features: `requires`

Optional and newer features are gated explicitly instead of being inferred.
A pipe manifest lists in `requires` the features a runner must implement
to execute it correctly.

- A runner MUST reject a manifest that requires a feature it does not
  implement, or does not recognise, with `E_UNSUPPORTED`. It MUST NOT run
  the pipe in a degraded way.
- Feature identifiers defined for v0.1: `windows`,
  `processing-time-windows`, `arrow`, `variadic`. The list is extended only
  by RFC.
- The same rule applies to other closed sets that select behaviour: an
  unknown `implementation.type`, or a reference scheme that the runner
  recognises but cannot install (`pypi:`, `cran:`, `oci:` in v0.1), is
  reported as `E_UNSUPPORTED`.

This is what allows features to be added in minor versions without older
runners silently misinterpreting newer pipes.

## 5. Extensions: `x-` keys

- Unknown keys are rejected (`E_MANIFEST`) so that misspellings are caught.
  The exception is keys beginning with `x-`, which are reserved for
  extensions and SHOULD be namespaced as `x-<vendor>-<name>`.
- Processors MUST accept `x-` keys they do not understand and MUST ignore
  them. An `x-` key MUST NOT change the meaning of standard members; a
  document must remain correct for a processor that ignores every `x-` key.
  Behaviour that a runner must honour belongs in `requires`, not in an
  extension key.
- The specifications will never define a standard key beginning with
  `x-`. An extension that is standardised gets a new unprefixed name.
- Extensible value sets follow the same convention where a specification
  says so (for example schema formats `x-<vendor>`).
- In JSON bodies that a peer *receives* over a protocol (HTTP responses,
  run reports), receivers MUST ignore unknown members, so that senders can
  add members in minor versions.

## 6. Maturity labels and deprecation

Every feature is labelled:

| Label | Compatibility meaning |
|---|---|
| `proposed` | No compatibility promise. May change or be removed in any revision. Backed by an open RFC. |
| `experimental` | May change incompatibly in a minor version, with a changelog notice. |
| `stable` | Changes only as described under "After 1.0" above. |
| `deprecated` | Still works; scheduled for removal. |

Deprecation policy:

- a feature is marked `deprecated` by an RFC, in a minor version, with the
  reason and the replacement (if any) stated in the specification and the
  changelog;
- a deprecated feature is **kept for at least one further minor version**
  after the one that deprecated it, and a deprecated `stable` feature is
  removed only in a major version;
- implementations SHOULD warn, not fail, when they meet a deprecated
  feature;
- `proposed` features may be withdrawn without a deprecation period.

In v0.1, window framing (the `windows` port kind, `std:window`) and
processing-time windows are `proposed`; see
[RFC 0001](rfcs/0001-window-framing.md).

## 7. Schemas

- Every schema has an `$id` under `https://openflange.org/schemas/` that
  includes the specification version, for example
  `https://openflange.org/schemas/pipe-v0.1.schema.json`.
- An `$id` is **immutable per version**: it always denotes the schema of
  that specification version. A new minor or major version gets a new file
  and a new `$id`; the old one is kept.
- While v0.1 is a draft, the content behind a v0.1 `$id` may still be
  corrected; changes are recorded in the changelog. After v0.1 is
  finalised, a published schema changes only to fix defects in ways that
  do not alter which conforming documents it accepts.
- Schemas describe structure. A document that validates may still be
  rejected for semantic reasons defined in the prose (references, paths,
  attribution, permissions); the prose is authoritative where the two
  differ, and such a difference is a defect to be reported.
- Schemas use JSON Schema 2020-12 and avoid regular-expression features
  that are not portable across common engines (no look-around).

## 8. Error codes

Error and warning codes (`E_*`, `W_*`) are part of the contract: tools and
tests match on them.

- The set of codes is **append-only**. A code is never removed, renamed or
  reused with a different meaning.
- A new minor version may add codes. Consumers MUST treat an unknown `E_*`
  code as an error and an unknown `W_*` code as a warning.
- Which code is reported for a given defect is normative where the
  specification or a conformance fixture says so. Messages are for humans
  and are not stable.

## 9. Wire formats and protocols

- Media types are stable identifiers. `application/jsonl` is an accepted
  alias of `application/x-ndjson`.
- CLI: an executable written for CLI v0.1 keeps working with a newer
  runner that still implements v0.1; the configuration file states its
  `spec`. Executables MUST ignore unknown configuration members.
- HTTP: clients construct URLs canonically from the base URL as defined by
  the protocol version they implement. v0.1 has no reconnect; adding it
  later will be opt-in.
- Lockfiles: a runner MUST NOT silently rewrite a lockfile written for a
  different `spec` version; it reports `E_LOCK` and leaves upgrading to an
  explicit command.

## 10. Standard library

The standard library has its own version, used in references such as
`std:filter@0.1`. Within 0.x, a new std minor version may change a pipe's
behaviour; references that pin a version keep their meaning for as long as
the runner ships that version. A runner advertises which std pipes and
versions it supports. Runtime-specific `builtin:` pipes are outside this
policy and are versioned by their runtime.

## 11. Conformance fixtures

- The fixtures in `conformance/` are versioned with this repository; a
  conformance result should cite the commit (or, later, the tag) of the
  fixtures that were run.
- Fixtures for a specification version only assert behaviour that the
  text of that version requires. A fixture that asserts more than the text
  is a defect.
- Within a specification version, fixtures are added freely. Changing or
  removing an existing fixture's expectation is a behavioural change and
  is listed in the changelog.
- Fixtures for `proposed` features (for example windows) are provided so
  that the proposals can be validated; failing them does not make an
  implementation non-conformant with the `experimental` core, provided it
  rejects the feature with `E_UNSUPPORTED` rather than misbehaving.
- A runner may skip fixtures for optional capabilities it does not
  advertise, and should report them as skipped, not passed.

## 12. Deferred

The following are explicitly outside v0.1 and carry no compatibility
commitment: event-time watermarks, session windows, checkpointing and
recovery, distributed scheduling, WASM implementations, HTTP stream
reconnect, and dynamic ports.
