Public API stability
What an integrator can rely on, what counts as a breaking change, how the version responds to one, and who decides.
What is covered
The Python surface is the set of names in engine/public.py, listed in its __all__. Import them
from engine.public, not from the module that defines them. A name is in that module because building
a Node Type, or a conformance harness for one, cannot be done without it.
Two kinds of entry:
- A fully covered name: its signature, and for a class every public method and property, every model or dataclass field, and every enum member.
- A constructor-only name (
ActivityLog,TriggerQueue): a class an integrator builds and hands to the conformance suite. Only its constructor and the members listed inCOVERED_MEMBERSinengine/public.pyare covered.
The management API under /v1 is covered as its OpenAPI document (GET /v1/openapi.json) describes
it: each route and method, its required scope, its parameters, its request body and its responses.
Documentation text in that document is not covered.
The offline-check command, python -m engine.offline_check_cli, is covered by its exit codes (0 to 5)
and the names and meanings of its options. The text it prints is not covered; do not parse it. No
tool compares these with a baseline: the tests pin each exit code. Changing what a code means,
adding a code, or removing or changing an option is a breaking change and is listed in
the changes file with how to migrate; a new option is compatible.
The config-bundle command, python3 -m engine.config_bundle_cli, is covered by its exit codes (0 the bundle was
written, 1 the config is invalid, 2 the command could not run, 3 the ref or the config file at it was not found, 4 the
bundle was written but the offline check had no verdict) and the names and meanings of its options. The text it prints
is not covered; do not parse it. The bundle file it writes is a JSON object whose keys may only be added to
(the management API guide). The same rules for a breaking change apply to it.
The mapping-preview command, python -m engine.mapping_preview_cli, is covered the same way by its
exit codes (0 no gaps found, 1 a gap or a flagged event found, 2 the inputs could not be used) and the
names and meanings of its options. The text it prints is not covered. The same rules for a breaking
change apply to it.
The document chunk-preview command, python3 -m engine.document_preview_cli, is covered the same way by its
exit codes (0 the Node would ingest the document with nothing to look at, 1 it would refuse the document, 2 the
request could not be used, 3 it would ingest the document with findings) and the names and meanings of its
options. The text it prints is not covered; do not parse it. --json is the form for a program, and its keys
may only be added to (document-chunk-preview.md). The same rules for a breaking
change apply to it.
The OPC UA browse command, python -m engine.opcua_browse_cli, is covered the same way by its exit
codes (0 to 5: 0 the listing is complete, 1 the config is invalid, 2 the command could not run, 3 the
target could not be browsed, 4 the listing is partial, 5 no verdict because the config is encrypted and
no key is available) and the names and meanings of its options. The text it prints is not covered; do not
parse it (opcua-browse.md). The same rules for a breaking change apply to it.
The MQTT payload player, python -m engine.mqtt_player_cli, is test tooling and is not covered:
its options, its message file format and its exit codes may change in any release
(mqtt-player.md).
The stand-in database row player, python -m engine.db_row_player_cli, is test tooling and is not
covered: its commands, options, statement file format, archetype files and exit codes may change in any
release (db-row-player.md).
The file-driven OPC UA test server, kindred-opcua-node-server (built from sidecar/node_server), is
test tooling and is not covered: its options, its node file format and its exit codes may change in any
release (opcua-node-server.md).
The stand-in command, python3 -m engine.stand_in_cli, is test tooling and is not covered: its options and
its exit codes may change in any release (opcua-stand-in-command.md).
The REST stand-in, python3 -m engine.rest_stand_in_cli, is test tooling and is not covered: its commands,
options, routes file format, control routes and exit codes may change in any release
(rest-stand-in.md).
The scenario generator and the shape comparison, python -m engine.scenario_cli and
python -m engine.shape_comparison_cli, are test tooling and are not covered: their options, the
scenario file and manifest formats and their exit codes may change in any release
(integration-shape-simulator.md).
The tools are described together in fixture-kit.md.
Everything else is internal: every other module, and every name with a leading underscore. It may
change in any release without notice. A name not in engine.public is not part of this promise even if
it looks stable.
What counts as breaking
A change is breaking if code written against the baseline would stop working, or an implementation
written against it would stop being valid. The baseline check (python -m engine.public_baseline)
and the release check (below) detect these kinds:
| Kind | Example |
|---|---|
| Removed name | a name leaves engine.public, or a covered method or enum member is removed |
| Renamed name | the same definition appears under a different name |
| Changed signature | a parameter is removed, renamed, retyped, reordered, becomes required, changes its default or kind; the return annotation changes; a new required parameter is added; a function becomes async; a new abstract method is added to a class an integrator subclasses |
| Changed model field | a field of a model or dataclass in the surface is removed or retyped, or a new required field is added; a model's configuration (such as extra or frozen) or a field's alias changes |
| Changed Node Type Configuration Schema | a Node Type's config_schema differs from the last release's while its identity.version is the same, not counting its description, title, $comment and examples annotations; a Node Type is removed |
| Changed OpenAPI route or field | a route is removed, or its scope, a parameter, a request field or a response field is removed or retyped, or a new required parameter or request field is added; a new constraint is put on a request field or parameter that had none (maxLength, pattern, enum and the like); a response gains a new enum value or alternative type |
The annotations are part of the promise. The package ships engine/py.typed, so an integrator's type
checker reads the annotations of the names in the surface and holds their code to them. The baseline records
a parameter's and a return value's annotation, a model or dataclass field's annotation, and a property's
return annotation, and a change to any of these is judged by the same rules as any other change to a
signature or a field: it is breaking, narrowing or widening alike, because it can turn code that passed an
integrator's checker into code that fails it. The annotations of internal names are not covered.
A stricter Configuration Schema for an existing Node Type version (a config that validated before
stops validating) is breaking. Whether one schema is stricter than another cannot be decided in
general, so the rule is simpler: a Node Type's config_schema may not change at all while its
identity.version stays the same. Changing it means bumping that version, which makes a new
version of the Node Type rather than a break of the old one.
The one exception is the text that explains a field. A description, title, $comment or examples
annotation changes nothing a config means, so it may be added or reworded without a version bump, and the
release check compares the schemas without them. A field that is itself called description is a field,
not an annotation, and a change to it counts. A default is not exempt.
These are compatible: a new name, a new optional parameter, a new optional model field, a new method, a new enum member, a new route, a new field in a response, and a new Node Type.
A change to behaviour that no description above captures (a different result for the same input) is judged by the maintainer; if a reasonable integrator would have relied on the old behaviour, it is treated as breaking.
A token command or route that stops accepting an input it accepted before is that kind of change. The
management token commands are the clearest case: a script that mints a token the command now refuses (a
mint with no expiry, or --no-expiry for a scope a person holds, such as correlation), or a client that
calls the rotation route again within a minute of its last rotation, gets a different result for the same
input. These are treated as breaking for the script or client that does that, and are listed in
the changes file with the action to take.
The baseline
engine/public_api_baseline.json records the surface and the /v1 routes. The check compares the
code with it and reports the names added, removed, renamed and changed. It never writes the baseline.
Regenerating it is an explicit act: python -m engine.public_baseline --regenerate. The command prints
the same report, and the new file is committed in the same change as the code, so the review sees both.
A breaking change that is intended is the same change plus that regenerated baseline, the version bump
it needs, and an entry in the changes file.
The baseline also carries a since map: the release each name first shipped in. Only the maintainer's
release script writes it, regenerating keeps it, the comparison ignores it, and the API reference
prints it (a name with none shows as not yet released).
The baseline a release is judged against is the one committed at the last release tag, not the working copy: the working copy moves with every change to the surface, and the tag is what was published.
Versioning
The package follows semantic versioning (MAJOR.MINOR.PATCH), and /v1 of the management API follows
the same rules. A new major version of the API would be served beside /v1, never in place of it.
| Change | Before 1.0 | From 1.0 |
|---|---|---|
| Breaking | minor bump | major bump |
| Compatible addition | patch or minor bump | minor bump |
| Fix with no surface change | patch bump | patch bump |
Before 1.0 the surface may still change between minor versions, and the changes file says when it does.
The version is set in one place, pyproject.toml, and engine.__version__ reports it. A release is an
annotated vMAJOR.MINOR.PATCH tag on main; the first is v0.1.0, published to the public repository by the sync of that tagged commit. Changes made after a release carry no promise until the next one is published.
The release check
python -m engine.release_check compares the working tree with the highest release tag (whether or not it is an ancestor of the checkout) and exits 0 (pass),
1 (blocked) or 2 (no usable git history). It classifies the difference as breaking, compatible or none,
across the Python surface, /v1 and the Node Types, and then holds that against the version in
pyproject.toml:
- A breaking change needs a minor bump before 1.0 and a major bump from 1.0, and every breaking
change must be named under the
## VERSIONheading for the new version in the changes file, with how to migrate. Without both, the release is blocked. - From 1.0 a compatible addition with only a patch bump (or none) is a warning.
- With no release tag yet there is nothing to compare with: it passes and says so, and
v0.1.0becomes the first baseline. (--require-tag, which CI uses once a release exists, blocks instead, so a clone that lacks the tags cannot switch the check off.)
The check needs git history and tags, so it is a maintainer tool: a clone of the public repository
has neither, and nothing else in the repository depends on it. The maintainer's release script runs
the check, changes nothing if it fails, then records since for the names that have none, commits that
and creates the annotated tag. It never pushes.
Deprecation
A name that is going to be removed or changed incompatibly is deprecated first: it keeps working,
raises a DeprecationWarning that names its replacement, and is listed in the changes file.
| Before 1.0 | From 1.0 |
|---|---|
| it stays for one minor release | it stays for two minor releases |
A name can be removed without a deprecation period only to fix a security problem, and the changes file says so.
Who decides
The maintainer decides what is in the surface, whether a change is breaking, when a deprecated name is removed, and when a breaking change is released. A contributor proposing a change to the surface proposes the regenerated baseline with it; the maintainer reviews and merges it.
Documentation
Every name in the surface is documented through its docstring, and the docstrings are the source of the
API reference in docs/reference/. The baseline check fails for a name that has no docstring, and a name
is documented before it is merged: there is no list of names exempt from this.
Release: v0.11.0