Skip to content

feat(data): show the OSM extract's age and let Nominatim follow its feed - #737

Merged
Medformatik merged 2 commits into
mainfrom
claude/confident-volta-2tlyvq
Nov 1, 2026
Merged

Medformatik merged 2 commits into
mainfrom
claude/confident-volta-2tlyvq

Conversation

@Medformatik

@Medformatik Medformatik commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

The first two of #303's three parts. The third, the scheduled refresh, comes in a separate PR because it needs a new ops-agent operation for data-manager.

OSM extract age in the admin panel. The admin panel only showed when the PBF was downloaded, which says nothing about how current the data is. A mirror can serve a weeks-old file today. The extract's own header has the real time (osmosis_replication_timestamp) and the diff feed that continues it (osmosis_replication_base_url). Geofabrik and the planet dumps set both.

  • Reading the header: data-manager reads both from the PBF's first blob with a small parser, so it doesn't need to run osmium. It records them on the osm-pbf dataset when it downloads, and once at startup for a PBF that was downloaded earlier.
  • Admin route: GET /api/admin/services/data adds osmExtract { timestamp, replicationUrl? }. It only uses the dataset whose file name and size match what the ops-agent inventory found, so a record of an older or different file is never shown. If data-manager can't be reached, the field is left out. The ops-agent contract is unchanged.
  • OSM card on Data workflows: shows "Data as of" with the time and its age (for example "3 days ago"). Past 30 days it adds an "Older than 30 days" flag. It also shows the extract's update feed, labelled as the value for NOMINATIM_REPLICATION_URL.

Nominatim replication is now configurable. The manifest hard-coded the planet feed and set no UPDATE_MODE. The mediagis 5.3 image defaults that mode to none, so Nominatim never applied diffs and search stayed at its import date.

  • New settings: NOMINATIM_REPLICATION_URL, NOMINATIM_UPDATE_MODE, NOMINATIM_REPLICATION_UPDATE_INTERVAL and NOMINATIM_REPLICATION_RECHECK_INTERVAL.
  • The defaults are unchanged (planet feed, mode none, 86400 s and 900 s), so existing installs behave exactly as before.
  • .env.example, configuration.md and preparing-data.md explain that a regional import must follow its own Geofabrik feed. Otherwise the planet diffs pull in changes from everywhere, the same rule OVERPASS_DIFF_URL already documents.

Related work

Part of #303. Still to do: an optional data-manager schedule that runs the checksummed PBF download, then rebuilds and restarts the consumers. That needs a typed ops-agent operation data-manager may call; today all lifecycle and build operations are API-only.

Verification

  • npx vitest run services/data-manager/__tests__ apps/api/src/services/osm-extract.test.ts apps/api/src/routes/__tests__/admin-services-sdk.test.ts apps/web/src/components/admin/services scripts/ops-authority-inventory.test.ts packages/core/src/api/contracts/service-admin.test.ts packages/core/src/services: everything passes except four tests in packages/core/src/services/__tests__ (checkout-layout, deployment-user, traefik-files). Those four fail identically on main in this environment, which runs as root.
  • Parser tests: use two fixtures written by libosmium (pyosmium) from the existing traffic-engine fixture, one zlib-compressed and one raw, each with a Geofabrik-style replication header. They also cover a PBF without replication data, a file that isn't a PBF, a truncated file, and a non-https feed being dropped.
  • Download and admin tests:
    • the download records the header fields
    • the backfill fills only PBFs that are missing them
    • the admin lookup ignores records for a different file or size
    • the card shows the age, the 30-day flag and the "unknown" state
  • Type checks and generated files:
    • tsc --noEmit passes in packages/core, services/data-manager, apps/api and apps/web.
    • check-openapi, check-api-sdk, check-data-manager-openapi, check-data-manager-sdk and check-ops-authority pass.
    • Both OpenAPI documents were regenerated, and their diffs contain only the new fields.
  • Not done:
    • I couldn't download a real Geofabrik extract here (the proxy blocks it), so the parser hasn't been run against one.
    • The Nominatim behaviour comes from reading the mediagis 5.3 image's start.sh, init.sh and config.sh, not from a running instance.
    • No browser check of the admin card.

Release and upgrade impact

@openmapx/extension-cli bundles the data-manager dataset schema, which gains two optional fields, so there's a patch Changeset. No operator action: the new Nominatim settings default to the old fixed values. To keep search current on a regional install, set NOMINATIM_REPLICATION_URL to the extract's feed (shown on the OSM card) and NOMINATIM_UPDATE_MODE=continuous, then recreate Nominatim.

An OSM extract's header says when its data is current to and which diff feed
continues it. data-manager now reads both when it downloads a PBF, and once
at startup for a PBF downloaded before, and records them with the dataset.
The admin data route reports them for the file the inventory found, and the
Data workflows OSM card shows the time, its age, a flag past 30 days and the
feed.

Nominatim's replication URL, update mode and intervals were fixed in its
manifest: the planet feed with the image's default mode `none`, so a regional
import never applied diffs. They are now NOMINATIM_REPLICATION_URL,
NOMINATIM_UPDATE_MODE, NOMINATIM_REPLICATION_UPDATE_INTERVAL and
NOMINATIM_REPLICATION_RECHECK_INTERVAL, with the same defaults, documented
with the regional Geofabrik feed.

Part of #303
@Medformatik
Medformatik merged commit 4323c5f into main Nov 1, 2026
33 of 67 checks passed
@Medformatik
Medformatik deleted the claude/confident-volta-2tlyvq branch November 1, 2026 20:25
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 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