Skip to content

fix!: settle the instance id, relay trust, claim version and manifests before the first release - #460

Merged
Medformatik merged 19 commits into
mainfrom
fix/pre-launch-contracts
Nov 25, 2026
Merged

Medformatik merged 19 commits into
mainfrom
fix/pre-launch-contracts

Conversation

@Medformatik

Copy link
Copy Markdown
Contributor

What changed and why

These are the OpenConditions side of the pre-launch contract fixes that OpenMapX merged in OpenMapX/openmapx#1083. They fix formats and configuration that cannot change once instances run.

The instance id is now required. OPENCONDITIONS_INSTANCE_ID has no local default and must be a lower-case DNS name. The first ingest process seals it in the new one-row table conditions.instance_identity, and ingest, contributions-api and federation (also when disabled), as well as federation-admin, refuse to start with another id. The baseline is regenerated with the table and the contributions role's read grant.

contributions-api trusts a relay. With OPENCONDITIONS_RELAY_TOKEN set (at least 32 characters, compared in constant time), enrollments that bear it share one bucket of OPENCONDITIONS_RELAY_ENROLL_LIMIT_PER_MINUTE (default 600) instead of the relay's address. Enrollment is the only address-keyed limit. A request with another bearer is logged as a warning at most every ten minutes, naming neither the token nor the address.

Every signed claim and sub-claim body carries "v": 1 inside its JCS bytes. A missing or other version is answered with 400 and code: "CLAIM_VERSION_UNSUPPORTED". The protocol document records the version rule, and that claims deliberately name no target instance. The cross-repo conformance pin changes with OpenMapX's client.

The manifests follow OpenMapX's community rules:

  • platform: "1.0" and quality: "community" on every service manifest;
  • AGPL-3.0-or-later on the extension, the licence of the services it installs;
  • configSchema.required for what each service cannot start without, which OpenMapX now enforces at apply, naming what is missing;
  • openmapx-overpass in the Overpass host examples.

Peer and actor configs now use the same DNS-name grammar as configured instance ids.

scripts/openmapx-product-contracts.json now pins OpenMapX 19754a18a752b9a6df1369007764fd44020bd195. The CLI, admission, consumer-lock and tree hashes are rebuilt from that commit.

Docs:

  • the federation compose example uses the real network and volume names, pins the image to the release tag and Caddy by digest, and says the containers join OpenMapX's platform network;
  • the ingest OpenAPI document now describes the six routing, speed and status routes OpenMapX reads, and states that paths never break;
  • .env.example, CONTRIBUTING, the READMEs and a release note cover the operator actions.

Container qualification starts every image with an instance id. It seals the id for contributions-api and federation as ingest does, checks the sealed row after health, and its producer pin follows.

Related work

OpenMapX/openmapx#1083: the OpenMapX client, relay, manifest rules and required semantics this PR pairs with.

Verification and limits

Local, on the final head:

  • passed: pnpm lint, pnpm typecheck, pnpm check:migrations, pnpm check-credentials, pnpm check:feed-schemas, pnpm feeds:lint, pnpm check:ci, and pnpm check:release-information (0 changesets);
  • the whole unit project passed: 567 files and 7922 tests;
  • the pinned OpenMapX CLI (validate) and admission export (validate-product-manifests.mjs) were built twice from 19754a18 with identical bytes; they accept the extension and all four service manifests with no problems;
  • OpenMapX 19754a18's configuration-schema.ts accepts every schema, treats empty values as well-formed, names exactly the required keys when they are missing (defaults included), and is satisfied by a value, a stored secret or an environment value.

Integration suites, run earlier on this branch on the repository's testcontainers PostGIS, with no runtime code changed since: services/ingest (94 files), services/contributions-api, services/federation, packages/core, packages/storage and packages/federation (75 files), the docker-context integration, and the claim, relay and instance-id suites.

The qualification's seal snippet and post-health query were checked against a disposable PostGIS 18.

Not run locally: the full image qualification (linux/amd64 builds, Trivy and evidence; hosted CI's build-images is its first end-to-end run), check:packed-packages (no public package changed), the Python resolver checks, interop and production audits. Nothing was deployed.

Release and upgrade impact

Breaking, before the first installation:

  • set OPENCONDITIONS_INSTANCE_ID on every OpenConditions service before the first start; it is sealed and cannot change;
  • under OpenMapX, set the same OPENCONDITIONS_RELAY_TOKEN in OpenMapX's .env and in the contributions-api credentials;
  • clients must sign "v": 1.

The regenerated baseline does not upgrade a database created by an earlier build; recreate the conditions schema. OpenMapX now refuses to apply a configuration until an enabled service's required settings are set, and names them.

The federation guide pins federation:0.8.1; the next release preparation should bump it. See docs/release-notes/pre-launch-contracts.md.

OPENCONDITIONS_INSTANCE_ID no longer defaults to "local". Every service
refuses to start without it or with a value that is not a lower-case DNS
name. The first ingest process to start seals it in the new one-row table
conditions.instance_identity; ingest, contributions-api and federation
refuse to start with another id. The baseline is regenerated with the
table, and the contributions role may read it.
A fronting application such as OpenMapX relays its users' crowd requests
from one address and forwards none of theirs. With OPENCONDITIONS_RELAY_TOKEN
set, a request bearing that token (compared in constant time) is counted in
one relay bucket of OPENCONDITIONS_RELAY_ENROLL_LIMIT_PER_MINUTE (default
600) instead of its address's. Enrollment is the service's only
address-keyed limit. A set token shorter than 32 characters fails boot.
…a record

eraseRecord read OPENCONDITIONS_INSTANCE_ID from the environment as a
default argument; its one caller, the federation admin command, already
passes the resolved id. The contributions build tests now set the required
id and cover a missing one and one sealed for another instance.
Report claims and sub-claim bodies carry the top-level member v, the claim
format version, inside the JCS-signed bytes. Signing and verification
refuse a body without it or of another version, and contributions-api
answers such a report or vote with 400 and code CLAIM_VERSION_UNSUPPORTED
before the signature is checked. The protocol document records the
version rule and that claims deliberately name no target instance. The
cross-repo conformance pin changes with the new member.
Every service manifest declares platform 1.0 and the quality community
(community-verified is gone). The extension declares AGPL-3.0-or-later,
the licence of both services it installs. The Overpass host examples name
openmapx-overpass. A test checks the platform, semver version, id grammar,
vendor-namespaced capabilities, licence agreement and that no manifest
lists configSchema required fields, which OpenMapX would check against
the saved non-secret values.
Name OpenMapX's network openmapx_openmapx and the ingest volume with its
project prefix, pin the image to the release tag instead of latest, and
say that these containers join OpenMapX's platform network outside its
isolation.
The ingest OpenAPI document now describes /feeds/status,
/valhalla/exclusions.json, /segments.geojson, /segments/speed.csv,
/segments/profiles.json and /segments/conditions.json, which OpenMapX's
routing and overlay read; a test keeps it equal to what
registerPublishRoutes registers. The API documentation states that paths
never break: a breaking change gets a new path.
Polls write as the instance id in their environment, which the service
validates at boot. The unit and integration projects now set one, so the
ingest pipeline suites no longer rely on the removed "local" default;
tests of a missing or another id pass their own environment. The road
restriction smoke validates against the registry without needing an id.
The container qualification started ingest, contributions-api and
federation without OPENCONDITIONS_INSTANCE_ID, and nothing sealed it, so
the three images could not become healthy. Every service now runs with
qualification.example.org. For contributions-api and federation, which
wait for the ingest service's seal, the script seals the row inside the
image as ingest does; after health it checks the sealed id. The producer
pin in check-docker-contexts.mjs follows the script.
The service block of .env.example, and the preamble gen:credentials seeds,
name OPENCONDITIONS_INSTANCE_ID as required. CONTRIBUTING's command for
running the ingest service sets it and the secrets key, as the README's
quick start does.
The erase command rewrites records under the instance id it is given. It
now checks OPENCONDITIONS_INSTANCE_ID against conditions.instance_identity,
as every service does at start, and stops when nothing is sealed yet or
the id differs.
With a relay token set, an enrollment that carries another bearer is the
sign of a relay whose token differs; it is limited by its address for all
the relay's users. Log one warning at most every ten minutes, naming
neither the token nor the address. The reviewer and relay checks now share
one bearer reader and constant-time compare.
…tration

The service validated it at boot, before the routes are registered, and
the test projects set it, so the route need not read the environment on
every request.
…mmar

The actor and peers configs accepted any non-empty instance id, while an
instance can only configure a lower-case DNS name. Both now use
isInstanceId, as the registry already did. The looser record-id namespace
pattern stays for parsing record ids and provenance, which also name
sources; identity.ts says so.
Replacing the instance id means dropping the conditions schema (under
OpenMapX never the shared database), or, while no record carries the old
id, deleting the one sealed row. The federation compose example pins its
archive server to a Caddy release by digest.
The portable CLI and the community admission export are built from
OpenMapX 19754a18a752b9a6df1369007764fd44020bd195, which carries the
manifest rules this branch applies. The source, archive, admission bundle
and installed package tree hashes and the consumer lock's tarball
integrity follow; commander is unchanged. The pinned validator and
admission accept the extension and all four service manifests.
…required

OpenMapX 19754a18 gives configSchema.required operator semantics: it
applies a configuration only once every enabled service has a value, a
stored secret or an environment value for each required key, and names
the missing ones. The ingest manifests, generated by gen:credentials,
require the database URL, secrets key and instance id, and the
heavy-feeds process also the feeds it polls; contributions-api adds its
grant secret and reviewer token; federation requires the database URL and
instance id. The tests that kept required out now check these lists.
@Medformatik Medformatik self-assigned this Nov 25, 2026
…ecks

The qualification records the sealedInstanceId check for every Node image,
but the verifier still required exactly the earlier set of checks, so
ingest, contributions-api and federation failed with "missing required
runtime/native checks". The verifier now expects it and requires the
fixture's id; the report fixtures carry it, and a missing or other sealed
id is refused. The producer pin follows the script.
@Medformatik
Medformatik merged commit 0b87622 into main Nov 25, 2026
21 checks passed
@Medformatik
Medformatik deleted the fix/pre-launch-contracts branch November 25, 2026 06:21
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant