Skip to content

Publishing

miracle091 edited this page Dec 2, 2026 · 6 revisions

Publishing

English · Italiano

The project has no server: the app, the catalog and the data are published with seven GitHub Actions workflows, on GitHub Pages and on the repository's releases. This page explains how the workflows are built, which checks stop a publication, how files are signed and how versions are handled. The commands to use them are in the developer guide (Italian) and in the data pipeline README (Italian).

A few terms recur throughout the page:

  • an asset is a file attached to a GitHub release, which the app can download;
  • an artifact is a file that a job leaves to the run, so that the other jobs of the same run can read it;
  • the SHA-256 hash is a code of 64 hexadecimal digits computed from the content of a file: it changes if even a single byte changes;
  • a shard is a group of regions that a job of publish-regions.yml generates in parallel with the others;
  • a continuation run is a new run of publish-regions.yml that the workflow launches by itself for the postponed regions.

Workflows

Workflow When it starts What it does
android-ci.yml on every push, except those that touch only .md files or docs/ builds, tests and checks the app and the pipeline
publish-apk.yml on every new version on main, or manually signs the APK, creates the release and updates app-status.json
publish-online-models.yml on every push to main that changes the list of online models, every Monday at 04:17 UTC, or manually publishes the models offered for the Online engine
publish-exchange-rates.yml every day at 17:47 UTC, on every push to main that changes exchange_rates.py, or manually publishes the exchange rates
release-notes.yml on every push to main that changes CHANGELOG.md, or manually realigns the release notes with the CHANGELOG
publish-regions.yml every night (cron at 02:17 UTC) regenerates a part of the regions and publishes the catalog
cache-cleanup.yml every day at 05:00 UTC, or manually removes outdated Actions caches

android-ci.yml

Pushes that touch only .md files or docs/ do not start the CI. The model cards in tools/data-pipeline/model-cards/ count as code, because a test reads them.

On every push the workflow runs these steps:

  • It downloads the llama.cpp, BRouter and bergamot-translator submodules. The internal Bergamot submodules are downloaded with third-party/init-bergamot-submodules.sh, at depth 1.
  • It checks that the third-party patches (third-party/patches/) still apply. It warns if a patch is already in the submodule.
  • It builds the app, including the unsigned release APK.
  • It checks that the debug and release APKs contain no classes from Google Play Services, Firebase, Play libraries or ML Kit. The check uses dexdump, without a network. The debug APK is needed too, because R8 renames the packages in the release.
  • It looks for known trackers with exodus-standalone in Docker, using the εxodus signatures. A tracker found makes the job fail. If the signature service does not respond after four attempts, only a warning remains.
  • It runs lint and detekt, with the ktlint formatting rules, also on core:poi and on the pipeline.
  • It runs the tests of the app and of the pipeline. A Python test that leaves files open, or an unhandled exception even in a thread, makes the job fail.
  • It runs shellcheck (a static check of shell scripts) on all .sh scripts and checks the region calendar.
  • It verifies the signature of the published app-status.json (verify-app-status.sh).
  • It looks for vulnerabilities in the dependencies with .github/scripts/check-dependencies.py. The script searches OSV, the public database of known vulnerabilities, for all libraries resolved by Gradle, transitive ones included. A known vulnerability makes the job fail. A version newer than those in the version catalog is only a note. A service that does not respond gives a warning, so that the CI does not fail because of a third-party API.
  • It checks that the dependencies of the release APK are those in app/dependencies/releaseRuntimeClasspath.txt (Dependency Guard).

The workflow also has four separate jobs:

  • device-tests runs the device tests in parallel on an emulator (API 34, x86_64, with KVM): Compose interface, navigation routes, Room migrations and package installation. Tests that require the GGUF model or the .rd5 segments skip themselves.
  • actionlint checks all workflows with actionlint (a static check of workflow files) and shellcheck. The actionlint version and sha256 are pinned.
  • windows-scripts runs the Python tests and a trial of the workflow scripts on Windows (see "Workflow scripts").
  • llm-smoke builds llama-server for the CPU with the patches and checks a few fixed answers of the smallest model in the model catalog: expected answer, refusal, no <think> block, category grammar. It starts only when the llama.cpp patches, the submodule commit, the model catalog, or the scripts and files that the test reads change.

publish-apk.yml

The workflow starts only with a push to main that touches app/build.gradle.kts. It publishes only if versionCode increases, and never below the versionCode already published.

  • It runs lint and unit tests, then signs the APK.
  • It creates the release vX.Y.Z already with the APK and with the notes taken from the CHANGELOG.
  • The app release is the only one with the "Latest" badge: data releases are created with --latest=false.
  • It updates and signs app-status.json, from which the app learns that an update exists.

A rerun on the same version rebuilds the APK only from the same commit as the tag. From another commit a new versionCode is required. When started manually, the workflow only updates app-status.json (see "app-status.json and model hashes").

publish-online-models.yml

The workflow also starts with a push to main that changes feature/ai/src/main/assets/online-models.json or online_models.py. It publishes online-models.json on the app-status release: this way the models offered for the Online engine change without releasing the app.

  • It checks the same rules as the app with jq: only one Automatic model per service, no repeated names, no negative prices.
  • It adds otherModels from LiteLLM and models.dev (online_models.py). Without the sources, with more than 60 models per service or with a price above $1,000 per million tokens, it publishes without otherModels, with a warning.
  • It adds publishedAt, signs the file and publishes it.

publish-exchange-rates.yml

The workflow downloads from Frankfurter v2 the exchange rates against the euro, that is the average of the central banks' rates. For the Cuban peso it uses the rate of the Central Bank of Cuba.

  • exchange_rates.py keeps only the three-letter uppercase codes with a positive rate, and fails below 100 currencies.
  • The workflow adds publishedAt, signs exchange-rates.json and publishes it on the app-status release.
  • If Frankfurter does not respond, the job fails and the previous file stays published.

release-notes.yml

The workflow realigns the notes of the vX.Y.Z releases with the sections of the CHANGELOG (sync-release-notes.sh). This way an entry added after the release also reaches the release, for example a breaking change that emerged later. The workflow modifies only the notes that differ. It writes to the releases only from main, even when started manually from another branch.

publish-regions.yml

The cron is at 02:17 UTC because jobs scheduled at minute 0 run hours late on GitHub. Every night the workflow:

  • regenerates a seventh of the regions and a thirtieth of the house number cells;
  • regenerates the guides in Italian and English, with the embassies and consulates from Wikidata;
  • adds to the English guides the travel advice from travel.gc.ca and gov.uk, republished at most once a week if the risk level does not change;
  • regenerates, for each region, the cities in both languages;
  • merges the catalog, validates it, signs it and publishes it on GitHub Pages.

The order of the jobs of publish-regions.yml: the arrows follow the workflow's needs. The check jobs (Overture, vaccinations) run separately and do not stop the publication.

flowchart LR
    accTitle: Jobs of publish-regions
    accDescr: Shard plan starts Guides, Public transport and Regions split into shards. World map and House numbers start on their own. Publication waits for Guides, World map, House numbers, Public transport and Regions; then come Sign and deploy, After deploy and Asset cleanup.
    plan["Shard plan"] --> guides["Guides"]
    plan --> transit["Public transport"]
    plan --> build["Regions<br/>shard 0, 1, 2…"]
    world["World map"] --> publish["Publication"]
    grid["House numbers"] --> publish
    guides --> publish
    transit --> publish
    build --> publish
    publish --> deploy["Sign and deploy"]
    deploy --> after["After deploy"]
    after --> cleanup["Asset cleanup"]
Loading

On Mondays the workflow also checks the sources of the vaccination data. With the repository variable TRANSLATE_GUIDES equal to true it adds to the Italian guides the translated travel advice of the Government of Canada (see "Guide translation"). After the deploy, the cleanup job removes the assets that are no longer used from the releases.

cache-cleanup.yml

The workflow removes outdated Actions caches (see "GitHub Actions cache"). It runs at 05:00 UTC, before the runs of publish-regions.yml. Started manually with dry_run, it lists the entries without deleting them.

GitHub Actions cache

The repository has 10 GB of cache. Beyond the limit GitHub removes the least recently used entries, including useful ones, such as the Wikivoyage dumps and the translated sentences.

  • The Gradle cache is written only by the build job of android-ci.yml, on every push to main. The job builds the app and the pipeline, so the cache contains the dependencies of all jobs. The other jobs only read it (cache-read-only of setup-gradle).
  • The Gradle build cache is also enabled locally (org.gradle.caching=true). If it contains an empty KSP result for a module, the build stops with [Dagger/MissingBinding] errors for all bindings of that module, in every worktree or clone of the same commit. It is repaired by rerunning the module's KSP task with --rerun (command and details in docs/GUIDA.md, "Compilare e provare").
  • The build and device-tests jobs of android-ci.yml build llama.cpp and bergamot-translator for the app with ccache, at most 500 MB.
  • The ccache cache changes only with the llama.cpp or bergamot-translator submodule commit, with their patches, with the native code of feature/ai and core/translate or with their build.gradle.kts. The compiler check uses the NDK version read from ndkVersion.
  • The ccache cache is written only by the build job, even when the job fails, because the objects already compiled are useful to the next run. device-tests and the release build of publish-apk.yml only read it.
  • Installing ccache and restoring it are in a shared action (.github/actions/setup-ccache-llama), so the three jobs use the same key.
  • In CI, Gradle has 3 GB of heap instead of the 2 GB of gradle.properties, and the device-tests emulator uses 4 cores.
  • The llm-smoke job of android-ci.yml caches the model it tests (about 530 MB, with a key that contains the sha256 of the model catalog) and the compiled llama.cpp files for Linux. The job runs rarely, and GitHub removes entries unused for 7 days: in that case the model is downloaded again from Hugging Face.
  • A cached model with a hash different from the one in the catalog is downloaded again and saved with a new key, which later restores prefer.
  • The system image of the device-tests emulator (about 1.3 GB) is cached with a fixed key, so it is not downloaded again on every run.

cache-cleanup.yml groups the entries by key family, that is the key without hash, date or run number. It keeps the 2 most recently used entries of each family. It removes the entries of a single run after 3 days, except the most recent one of the family, and the entries of branches other than main. The run summary shows the entries removed and the space before and after.

Checks before publishing the data

Catalog validation

  • The catalog is validated: allowed addresses, sha256, zoom, bounding boxes.
  • In transit.json a network with an empty name is rejected. An entry of missing with an empty name or with unsafe region ids is rejected too.
  • In address-grid.json the cell ids must be in canonical form, without leading zeros ("1/1/0", not "1/01/0").
  • If the new catalog loses regions compared with the previous one, the publication stops: it is almost always an error, not a choice.
  • If the data require an app version not yet released, the publication stops.
  • Before publishing, publish-regions.yml checks the sha256 of address-grid.json and transit.json against manifest.json.

Previous catalog and published signatures

  • The previous catalog is mandatory, because it is needed for the comparison of the regions and for the asset cleanup. Only a 404 counts as a first publication. Any other outcome (network, 5xx error) after the retries stops the publication: silently skipping the comparison and the cleanup would be worse.
  • In the project's CI the jobs use the published manifest.json, address-grid.json and transit.json only if the signature verifies with the key embedded in the app (verify_published_signature). In forks, signed with another key, the check is skipped.
  • The catalog download retries once on network errors.
  • Right after a deploy, the CDN (the network of servers that distributes GitHub Pages) may serve the catalog and the signature of different versions for a few minutes. For this reason the publication retries the signature up to 4 times, 20 seconds apart. If it fails, it writes to the log the HTTP code of the .sig file or the outcome of the verification.
  • The already published manifest.json, address-grid.json and transit.json are read with a different parameter on every run and with Cache-Control: no-cache. GitHub Pages responds with max-age=600 behind the CDN: without these measures a run that started less than 10 minutes after the previous deploy would merge the regions into an old catalog.

Published data format

A change to the format of the published data makes PublishedFormatTest, a pipeline test, fail, and so the CI too. The test compares with a snapshot in the repository the schema and the format markers of the databases, the compression of the house number tiles and the fields of manifest.json and address-grid.json. The xz compression and the fields added by the scripts with jq are left out.

The test message asks to decide whether the apps already released still read the data. If they do not, tools/data-pipeline/min-app-version-code is raised and the entry is written in "Breaking changes" of the CHANGELOG ("Cambiamenti incompatibili"). Then the snapshot is updated.

Content that fails

  • If the job of the house number cells or the public transport job fails, its index from the previous night stays published.
  • The publication job downloads the two indexes only if their job succeeded. In a continuation run those jobs do not run, and a download without an artifact would mark an error in the run.
  • A house number cell that splits and has a failed child exits with an error, and the parent cell stays in the index.
  • region-timings.tsv is reset only on a 404, not on a transient error.
  • If the English part of guides or cities fails, the Italian one is published anyway and the previous night's English version stays.
  • Points of interest with failed requests and without an already published package exit with a warning and with poi.partial, and are regenerated at the next run.

Cities

The cities/citiesEn entry of the catalog has stats: cities with population, cities with coordinates, sections from Wikipedia. If one of the three values drops by more than 10% compared with the published entry, build-cities.sh leaves a warning and the published database stays. Entries without stats are not compared.

When the data have dropped at the source, a manual run with the force_cities input publishes the new database anyway. The input reaches build-cities.sh as FORCE_CITIES=1 and is also passed to the automatic continuation runs.

Empty road network tiles

A road network tile that is empty after clipping is recorded in routing.emptyTiles with its source. This way the comparison with the catalog does not count it as missing, and the region is not regenerated on every run.

A changed tile that is empty after clipping makes the region regenerate in full, and the regeneration moves it to routing.emptyTiles. The incremental run, instead, would download it again on every run.

Permissions, times and credentials

  • publish-apk.yml runs lint and unit tests before signing: a version change on a commit with failing tests does not produce a release.
  • Every job has only the permissions it needs. In publish-apk.yml only the job that publishes the release has the write permission.
  • Every job has a maximum time (timeout-minutes): from 10 minutes for the version check to 350 for the region shards.
  • The pipeline's curl downloads have a time limit (--max-time) and a minimum speed limit (--speed-limit). This way a hung connection fails and is retried, instead of holding the job until the 6-hour limit.
  • The checkouts of jobs with write permission have persist-credentials: false, so the write token is not left saved in the cloned repository. The same applies to the checkouts of android-ci.yml and of the checks of publish-regions.yml (overture-check, vaccinations-check).
  • In publish-apk.yml and publish-regions.yml GH_TOKEN is passed only to the steps that call gh. The scripts that process the region data run without it.
  • In publish-apk.yml the publication of the APK and the update of app-status.json have two separate concurrency blocks.
  • go-pmtiles is installed from a single script (.github/scripts/install-go-pmtiles.sh), the same for all jobs, with version and sha256 pinned. The download is also retried after a series of GitHub 504 errors. The world map installs go-pmtiles only when it is regenerated.

Asset cleanup

  • publish-regions.yml publishes only from refs/heads/main.
  • The asset cleanup starts from a list written to a file and deletes by id, after the continuation runs.
  • The cleanup retries every deletion. If one fails, for example because of a GitHub 502, only a warning remains and the asset is removed by the next night's cleanup. This way a job that has already published does not fail.

Manual runs and concurrency

  • A day of the weekly calendar without regions publishes only the regions that are late according to the adaptive quota (see "6-hour limit"). "All regions" applies only to manual runs without regions.
  • A manual run with the only input (addresses, transit, guides, world-map or regions) builds only that type of data. The other jobs do not start and the catalog keeps their published entries.
  • Shards without regions never start.
  • With guides or world-map there may be nothing to publish, if guides or map have not changed. In that case the run ends green with a warning, without a deploy.
  • The pages concurrency group keeps only one run waiting to publish, and a new run cancels the one waiting. With three runs close together the publication of the middle one is lost. Its regions are recovered from the pending fragments of region-fragments (see "Independent regions"); guides, world map and the house number and public transport indexes are not.
  • A manual run cannot be started while another is waiting for publication.
  • The pages group does not keep publish and deploy of a run together. If another run has published in the meantime, the online manifest.json is no longer the one publish merged into. In that case deploy stops with an error instead of signing a catalog without the other run's entries, and the run must be restarted.

Vaccination sources

The vaccinations-check job compares three sources with a snapshot in the repository: Travel.gc.ca, the Saudi PDF for Hajj and Umrah and the latest WHO statement on polio. It runs on Mondays and in manual runs with only equal to all.

If something has changed, the job leaves a warning and the report in the summary, without touching the data and without blocking the publication. The TSVs are updated by hand, and the snapshot is regenerated with vaccinations_drift.py --update.

Warnings in the CI logs

Build and tests must not leave project warnings. Many tasks in the CI come from the cache and do not print their warnings again: to see them all, the check is rerun locally with --rerun-tasks --warning-mode all. Two warnings remain that do not depend on the project's code:

  • "Deprecated Gradle features were used" comes from the detekt plugin 2.0.0-alpha.6 (Configuration.setVisible). It disappears with a detekt version that fixes it.
  • sun.misc.Unsafe from protobuf in the device tests comes from the process that AGP starts to run them, to which the project cannot pass JVM options. JAVA_TOOL_OPTIONS would remove it, but it prints a warning of its own in every Java process.

The emulator messages (libX11, Netsim, Quickboot) come from the emulator and from the action that starts it.

Workflow scripts

The long steps of the jobs are in scripts (.github/scripts/, .github/scripts/publish-regions/), not in the YAML files. The CI checks them with shellcheck and actionlint, and the Python tests of the pipeline and of the workflows exercise them. The common setup of the region jobs (JDK, Gradle, go-pmtiles, duckdb, osmium) is the action .github/actions/setup-pipeline.

The scripts also run on a PC, Linux or Windows with Git Bash (not macOS). Outside GitHub Actions they run only the gh commands that read. The commands that would write to the repository (uploads, deletions, caches, issues, new runs) they only print. This way a local trial does not touch the published data. Requirements, examples and the way to actually run the writes are in the data pipeline README (Italian), paragraph "Prove in locale" (Local tests).

Catalog signature

The JSON files that the app downloads are signed with ECDSA P-256 and SHA-256. Why and how the app verifies them is explained in Privacy and security. Next to each file a <name>.sig is published. The files and the workflows that sign them:

File Workflow
manifest.json, transit.json, address-grid.json publish-regions.yml, after validation and before the deploy to GitHub Pages
app-status.json publish-apk.yml
online-models.json publish-online-models.yml
exchange-rates.json publish-exchange-rates.yml

Signing key

  • Signing is done by the script .github/scripts/sign-files.sh, with openssl.
  • The private key (PEM) comes from the secret MANIFEST_SIGNING_KEY. The secret goes only to the signing step, in a separate job that runs neither Gradle nor the scripts that process the data. The key is on disk, with 0600 permissions, only for the duration of the script.
  • After each signature the script verifies it with the derived public key.
  • In the project's repository the derived public key must match OFFICIAL_PUBLIC_KEY in SyncConfig.kt, otherwise the script does not sign. With another P-256 key the signatures would be valid for openssl, but the app would reject them all. In a fork the check does not apply, because the fork signs with its own key.
  • Without the secret the job fails: publishing unsigned files would break the app for all users as soon as the app requires the signature.
  • A key that is not P-256 also makes the step fail, because the app would not verify any signature.
  • The key is generated only once. The public key, in DER and base64, is embedded in the app (SyncConfig.MANIFEST_PUBLIC_KEY). The exact commands, including the manual check of a downloaded file, are in the data pipeline README (Italian).
  • The private key never goes into the repository: .gitignore excludes *.pem, *.jks, *.keystore, *.p12 and keystore.properties.

Publication time

Before signing, every JSON file receives the publication time publishedAt, in Unix seconds. For manifest.json, transit.json, app-status.json, online-models.json and exchange-rates.json it is written by jq in the workflows; for address-grid.json by the generator (GenerateAddressGrid). The app rejects a file older than the last one accepted.

Release order and key change

An app version that verifies signatures is released only after a regions publication with signatures (publish-regions.yml, which publishes .sig next to every JSON). In the reverse order the new app would find a catalog without signatures and reject it. Apps without verification ignore the .sig files.

Changing the key requires a new app version with the new public key: apps with the old key would reject the files signed with the new one.

app-status.json and model hashes

app-status.json tells the app the latest version, with the hash (apkSha256) and size (apkSizeBytes) of its APK. It also contains the assistant's models, with SHA-256 hash and size. The app verifies the model downloads with these hashes; versions before 0.10.0 do not use them (see Updates and model hashes).

publish-apk.yml updates the file in three ways. None of the three requires a new versionCode just to change a hash.

At release

When versionCode changes, the version comes from the catalog on main. The sha256 and size of app-release.apk are computed in the job that builds it (apk-fingerprint.sh), not on the release asset, which someone with write access could replace. Files published up to 0.14.0 do not have these two fields.

For each model the job takes the hash that matches the file on Hugging Face. It takes it from the catalog or from the online file, if its signature is valid (resolve-ai-models.sh and resolve_ai_models.py). The scripts read X-Linked-ETag and X-Linked-Size, the headers with which Hugging Face gives the hash and size of the file, with a HEAD request that does not follow the redirect. If no hash matches, the job stops before building: a release that would reject the downloads is not published.

By hand with update_models

This mode is started by upload_hf.py --push --update-app-status, after uploading a GGUF with the same file name. The update-app-status-models job:

  • downloads the online file and verifies its signature (verify-app-status.sh), so as never to sign a tampered asset;
  • takes the model URL from the catalog of the released tag;
  • checks that sha256 and size match Hugging Face;
  • changes only those entries, with a new publishedAt.

The input passes through the environment, not inside the script, and has a strict format: id, sha256 of 64 hexadecimal digits, integer size. The script puts an identifier in the run name (request_id), so that it follows its own run and not another manual launch. It updates LlmModelCatalog.kt only if the job succeeds.

The job changes only the models already present in app-status.json. For a new model the script writes the hashes only in LlmModelCatalog.kt, and publish-apk.yml carries them into app-status.json at the next release.

verify-app-status.sh reads the public key from OFFICIAL_PUBLIC_KEY in SyncConfig.kt and, if it does not find it, says so with an error. resolve-ai-models.sh distinguishes in the log a file that cannot be downloaded from an invalid signature.

By hand with resign_app_status

This mode rebuilds the file from the sources of the released version's tag and signs it. For the hashes the same rules as at release apply. The APK hash comes only from the online file with a valid signature and with the same versionCode; otherwise the file does not have one.

6-hour limit

GitHub interrupts a job after 6 hours, and an interrupted job delivers nothing. On Sep 28, 2026 a full regeneration stopped after 258 regions out of 355, without publishing any. For this reason publish-regions.yml divides the work like this:

  • Each shard starts no further regions after 270 minutes: it publishes those done and postpones the others.
  • The publication job relaunches the postponed regions by itself in a continuation run, at most four times in a row.
  • Continuation runs do not redo guides, world map and house numbers.
  • Continuation runs do not remove the outdated assets. They publish a catalog a few minutes after that of the main run, and the cleanup would remove assets of the previous catalog still in use by apps.
  • A single region cannot last more than 45 minutes. The limit is 70 minutes for Germany, the United Kingdom, Russia - Siberia and Canada - Nunavut, which with slow Geofabrik downloads exceed 45. Among the other regions the slowest measured, Tibet at its first generation, took 34 minutes.
  • The weight of the regions for dividing them among the shards is the time of the last complete generation. For regions never measured, 50 seconds per tile are estimated.

The adaptive quota uses the free time of the shards. When the day's regions are finished, each shard takes others as long as the estimate from region-timings.tsv still fits in the time, and never postpones them to a continuation run. It takes the late regions first, oldest first: those with points of interest published more than POI_MAX_AGE_DAYS days ago or never published. Then it takes those of the next day. This way days with little work lighten the following ones.

Independent regions

The work done is not lost, even if a region fails or a job dies:

  • After each region, its piece of the catalog (fragment) is saved immediately on a dedicated release, region-fragments, not only at the end of the job.
  • The publication of any run, including the nightly one, recovers the fragments left pending by canceled or interrupted runs. It recovers them if they are more recent than what is published and not older than 7 days.
  • Each region is checked on its own: an invalid fragment is discarded with a warning, and the other regions are published.
  • Failed regions, with the reason (timeout, upload, error), are retried once in the first continuation run.
  • The run summary gives the outcome of each fragment: published, recovered, discarded, superseded.

The mechanism was verified on Oct 1, 2026. A nightly run canceled halfway had left 38 fragments, and all 38 regions entered the catalog with the next run, which then emptied region-fragments. The same day a continuation run started with only the failed region to retry, and another with 33 regions (28 postponed for time plus the failed ones), all published.

Region generation times

Points of interest from Geofabrik extracts

Points of interest come from Geofabrik's daily extracts: the same OpenStreetMap data, filtered with osmium in a few seconds. Requests to the public Overpass servers, with many attempts and waits, took almost three quarters of the time of a full generation. Overpass remains the fallback when the extracts cannot be used.

Choice of extracts

  • Of the Geofabrik extracts, only the "leaves" that touch the region's border are taken, not just its bounding box. For Nunavut that is 9 out of 14, without Alberta and British Columbia.
  • Extracts that contain others are discarded. Without this rule Yukon would download all of the United States and exceed the region's time.
  • An extract that the others cover for less than 15% counts as a leaf, except the top-level ones (the continents). This is the case of Russia's Northwestern district, which contains only the Kaliningrad extract. Its separate areas that this extract covers by at least 95% do not count, so the Kaliningrad region uses only its own extract.
  • A composite extract can share its border with the leaf (us and us-pacific with us/alaska), so a point on the edge counts as inside.
  • 3 extracts are downloaded at a time.
  • Each region takes only the extracts of its own country: the ISO code from the Geofabrik index, also from iso3166-2 or from the parent. The bounding box applies only if no code matches. Norway's bounding box includes Sweden and Finland, Saudi Arabia's includes Egypt, Iran and Iraq.
  • With the extracts of the country alone, Norway downloads 1.3 GB instead of 3.7, Saudi Arabia 242 MB instead of 1.1 GB, Italy 2.1 GB instead of 5.8.
  • Points of interest of neighboring countries inside the bounding box stay in their own regions.

Countries without an extract of their own

Some countries do not have an extract of their own, and their land is in no leaf that touches the bounding box. For them the extract is specified in geofabrik_pois.py (ESTRATTI_DELLE_NAZIONI):

  • The British Virgin Islands and Trinidad and Tobago take central-america. The extracts of the US Virgin Islands and Venezuela do not contain them, and after clipping at the border only one point of interest would remain.
  • San Marino lies between the polygons of centro and nord-est without being covered by them, and only italy (2.1 GB) contains it: at 0.4 MB/s the download takes longer than the 45 minutes given to each region. It takes the daily extract from openstreetmap.fr (extracts/europe/san_marino, 1.6 MB).
  • Saint-Pierre and Miquelon is only in canada (6.5 GB), and the newfoundland-and-labrador leaf has just one object of it. It takes the daily extract from openstreetmap.fr (extracts/north-america/saint_pierre_et_miquelon, 1.5 MB, the same OpenStreetMap data), given in the table with the full URL. If that download fails, the region falls back to Overpass as for the Geofabrik extracts.

Missing files and empty polygons

  • If a -latest extract responds 404 or with a looping redirect, the dated file of the day is used. This also applies to top-level areas (in asia/ and in the root), whose dated files are read from the extract's page. This way Saudi Arabia and the Marshall Islands do not fall back to Overpass.
  • An extract with an empty polygon in the index (it happens, for example, to Japan) takes the polygon from its .geojson file, next to the pbf. The .geojson contains only the geometry, full even where the .poly is empty, as for Kyushu.
  • If the .geojson is empty, the extract takes the polygon from the .poly. If both are empty, it takes that of the nearest ancestor. Without a polygon the region would fall back to Overpass, which answers 429 with several shards together.
  • The ancestor's polygon is larger than the real one: at worst it causes one extra extract to be downloaded, and never any missing points.
  • An empty file does not stay in the cache. Geofabrik responds without content while it regenerates the polygons.

Geofabrik errors and fallback to Overpass

A temporary Geofabrik error is retried for about 4 minutes, with waits of 15, 30, 60 and 120 seconds, before moving to Overpass. If Geofabrik does not respond even so, for half an hour the following regions of the same job do not try it and go straight to Overpass. The signal is a fuori-uso-<host> file in the extracts folder, outside the caches. This way, with Geofabrik down for hours, the 4 minutes of waiting are lost by one region every half hour, not by every region.

When the extracts cannot be used, the region reports it among the run's warnings. Overpass then makes two rounds over the mirrors instead of one, with waits of up to 2 minutes.

Extract cache

  • In the build job the extracts reduced to points of interest and the index are in a GitHub Actions cache that is valid for one day. Continuation runs and new attempts of the same day reuse them, also across shards.
  • The Nominatim borders and the extract polygons are in a cache that is valid for one week.
  • The caches are saved even if the job fails, only if the run added files, and never beyond 1.5 GB of extracts per shard.
  • The day's extracts are removed by the last run of the chain, the one that does not launch a continuation run. This way they do not occupy about 1.5 GB of cache until the next day.

Clipping at the country border

Points of interest are clipped at the country's OpenStreetMap border. country_border.py requests it from Nominatim, once per country and per job. The clipping uses osmium extract -p on the extracts and the relation's area in the Overpass query.

The bounding box alone includes neighboring countries. The measurement of Oct 11, 2026 on the published packages gave 2.8% of the points in another country: half in San Marino, 47% in Hungary, 67% in Oman.

  • Only the relation with the same ISO 3166-1 code applies: for pr Nominatim returns Peru.
  • Maritime borders are discarded and the territory applies. For "New Caledonia" Nominatim first returns the exclusive economic zone, with the same code NC, from which osmium extracts no points of interest.
  • Cached results are reevaluated on every run.
  • Territories that are not countries for Nominatim (Réunion, Puerto Rico, Hong Kong) are searched by name, with the region's Wikivoyage title. Only the Canary Islands, Bonaire and Sint Eustatius stay on the bounding box.

Clipping at the subdivision border

The regions of a divided country are clipped at the border of their own subdivision. The group is in regions.sh: US states, provinces of Canada and China, regions of France. Without this clipping 31% of the points fall outside the region, partly abroad (West Virginia: 73%).

  • The subdivision is searched by name, with the country's ISO 3166-2 code.
  • The subdivision applies only if its bounding box covers at least 70% of the region's, because the name alone can match the wrong place: for "Hubei" Nominatim also returns Hebei, which does not cover it at all.
  • The bounding box is passed to country_border.py as --bbox=…, with the equals sign. Detached, a bounding box that starts with a negative longitude looks to argparse like another option.
  • Intersection over union is not used: in OpenStreetMap the bounding box of Hawaii, Alaska, Shanghai and Tianjin includes distant islands or sea.
  • Without a valid subdivision, as for the economic regions of Russia, the country's border applies.

Border in the catalog

  • The catalog records the relation used (poi.borderRelation). When it changes, the points of interest are regenerated immediately, and the check on the number of points does not compare packages clipped in different ways.
  • The poi entry of the catalog has border: true. The "at least half of the published points" check compares only packages clipped the same way.
  • If the border is not found for a region already clipped, the region fails instead of republishing the points of neighboring countries.
  • Points of interest published without clipping are regenerated at the first run, even if they are less than 6 days old.

Points of interest taken as areas

Some points of interest are also taken as areas, not only as points: stations, bus stations, ferry terminals, parking lots, marinas, museums, galleries, attractions, castles, monuments, ruins, archaeological sites, forts and city gates with a name. As points alone the Eiffel Tower (a building) and the Louvre (a complex) would be missing: in central Paris the areas add 85 places.

Reused work

  • Nearby regions of the same group reuse the already filtered extracts and the already downloaded parts of the road network segments.
  • The Wikivoyage dumps are in the GitHub Actions cache for the whole month. At the beginning of the month, until the new dump is finished, the previous dated one is used.
  • The overview map of a region restarts from the zoom already published, instead of redoing the oversized extractions every time.

Parts that do not stop a region

Overview map

Before downloading, the size at each zoom is estimated from the build index (pmtiles extract --dry-run, a few seconds). Zooms clearly above the 10 MB ceiling are not downloaded: without the estimate Norway would download 112 and 43 MB only to discard them.

Each extraction has a limit of 3 minutes and two attempts. If build.protomaps.com does not respond, the region exits with the overview map already published, or without one. This way it does not lose the points of interest and road network already built.

Points of interest

  • Overpass is used only when the Geofabrik extracts are not available. If some of its requests fail and the region already has published points of interest, the region fails and the published ones stay, instead of a partial list.
  • The same applies to guides, when the published ones cannot be read.
  • An empty poi.db, or one with fewer than half of the published points, makes the region fail, and the published package stays. The published number is the poi.count field of the catalog; for older entries the points are counted on the published file.
  • The poi.extracts field of the catalog lists the extracts used. If one of the published ones is no longer chosen, the run reports it with a warning and in the summary, and publishing continues. Check whether other extracts cover the same area. Entries without the field give no warnings; with Overpass the published list stays.

House numbers

  • A cell that is already split into smaller cells in the published index passes straight to those, without being rebuilt on every round.
  • If a source (OpenStreetMap or Overture) fails on an already published cell, the cell stays as it was instead of exiting with the data of a single source.
  • The cells are on 24 releases, from address-cells-0 to address-cells-23, chosen with a hash of the id (ADDRESS_CELL_RELEASES). Together with the cells there are also the address search indexes (see Data and packages).

Road network

A BRouter tile that has no roads within the region's bounding box (sea, coast at the edge) is skipped, instead of making the region fail.

Embassies from Wikidata

If the Wikidata endpoint does not respond within 15 minutes, or the result is under 6,000 rows, the guides copy over the already published table, or exit without one with a warning. The guides never fail because of this.

City population and coordinates

city_population.py asks Wikidata for the two properties in a single round of requests.

  • The three shards reach the cities step almost together, and Wikimedia responds 429 to bursts. Each request respects the response's Retry-After.
  • Without Retry-After the request waits 10, 20, 40, 80 and 160 seconds, plus up to 5 random seconds, so that the shards do not retry at the same instant. A truncated response is retried too, and the wait between two attempts does not exceed the time left before the request's deadline.
  • With CITY_FACTS_CACHE the data of each city, even "no data", are valid for 60 days: only new or expired cities are requested.
  • The workflow keeps the file with actions/cache. Each shard restarts from its own most recent copy, or from another shard's if it is missing. Then it saves its copy and removes its older ones.
  • If Wikidata does not respond, the cities keep the data of the cache or of the file, without making the region fail.

Popularity and heritage status of points of interest

poi_wikidata.py asks Wikidata, for the points of interest with the wikidata tag, for the sitelinks and the protection status (UNESCO or other). It uses the same retries as city_population.py.

  • The script removes the tags that indicate a person or a populated place, for example a post office tagged with the item of its municipality.
  • It also removes the tags that indicate a place more than 20 km away. For national parks, nature reserves and mountain ranges the limit is 150 km: the Wikidata point of Fuji-Hakone-Izu is 88 km from the OpenStreetMap one.
  • The POI_WIKIDATA_CACHE cache is a file next to that of CITY_FACTS_CACHE, in the city-facts/ folder kept by the workflow, and is valid for 60 days.
  • Each region stops after 10 minutes and completes the remaining items in later runs.
  • Without a response the points of interest remain without the two columns.

UNESCO heritage also comes from the OpenStreetMap ref:whc tag, on the point of interest itself or on the site's perimeter. geofabrik_pois.py copies the perimeter's tag onto the protected or cultural points of interest with the point inside, like the Louvre in the site "Paris, rives de la Seine".

  • Artworks, plaques and shrines receive the tag only with a name. Gardens, towers and bridges only with the wikidata tag.
  • Points without a name or wikidata, Stolpersteine, commemorative plaques, boundary stones and milestones never receive the tag.
  • Points less than 10 m from the edge (the gates in the walls), relations that are members of a site (Hamburg) and protected areas with heritage=1 and the site number in ref (Bath) also count.
  • Regions (the Dolomites) and buffer zones do not count.
  • In the Overpass fallback the perimeters come from a separate query.

Public transport

A separate job publishes the timetables of the networks in tools/data-pipeline/transit-feeds.tsv: about 160 networks, only with an open license confirmed by a text of the agency or its portal. The region's guide declares the networks excluded because of the license. The networks excluded by hand (license, or timetables without a source to recheck) are in tools/data-pipeline/transit-missing.tsv.

How the app uses the timetables, real time and journeys is described in Public transport.

Download and conversion

  • The job downloads the GTFS feed from the Mobility Database copy. Where the copy is missing or stale, it downloads it from the agency's site or portal.
  • It converts the feed into a small database with 90 days of timetables (transit.db, compressed with xz) and writes the transit.json index next to the catalog.
  • A network is rebuilt only if the feed has changed or after 7 days. If the rebuild fails, the published network stays.
  • For networks with url_rt (the agency's GTFS-RT feed, with real-time delays) build-transit.sh keeps the GTFS trip_id and stop_id (--gtfs-ids of GenerateTransit). It also measures the size of a feed download (realtimeSizeBytes).

Download limits

  • Each feed download stops if it stays under 10 KB/s for 5 minutes.
  • No download goes beyond the job's time minus 20 minutes, left for the conversion of the last networks and for the publication.
  • A download has 30 seconds to connect. A host that does not respond to any attempt is not retried for the other networks of the same job, which keep the published entry. This also applies to a script: converter, such as that of the Istanbul IBB portal. Without this limit the five Ligurian networks on an unreachable server would lengthen the job by more than an hour.
  • A downloaded feed that is not a zip is reported with the beginning of the response, instead of the Java error "zip END header not found". BODS, for example, responds 200 with {"errors":["Invalid region name"]} to an area that no longer exists, such as national_coach. British coaches are in the feeds of the areas they cross.

Special feed URLs

Three forms of the feed URL cover the special cases:

  • {ultimo} takes the most recent file from the portal's index, for agencies that change URL with every version (column cerca_ultimo).
  • #percorso opens a zip inside the downloaded zip, as for Melbourne, which has one feed per vehicle type.
  • script: composes the feed with a converter. For Istanbul iett_gtfs.py reassembles the IBB portal's CSVs, fixes their separator, encoding and coordinates and estimates by distance the times between the control points.

Excluded lines

  • Lines that the agency marks in the feed as school bus, on-demand service or taxi (route_type 712, 715 and 1500-1599) are not included.
  • In the French regional aggregates (Oùra, Korrigo, Fluo Grand Est), lines that another network on the list already publishes, such as SNCF's TER, are not included (column agenzie_escluse).
  • In some networks school and on-demand lines have the type of a normal bus and can be recognized only by the short name: Marseille, Bastia, Abbeville, the lecar coaches of Bouches-du-Rhône, Transp'Or. A regular expression per network removes them (column linee_escluse).
  • If the expression no longer finds any line, the job leaves a warning, because it means the feed has changed the names.

Swapped coordinates

A stop with latitude and longitude swapped (one in Bastia, three in Berck) is corrected when, swapping them again, it falls within one degree of the others. Without the correction the network's bounding box would reach as far as Africa, and the app would offer the network as nearby in half of France.

Expired timetables

  • A network with expired timetables, that is without trips in the next 90 days, is not published.
  • The end date counts only the calendar services with at least one trip with times. Some agencies, such as Corsica Ferries, publish the calendar until the end of the year and the times only for the current season.
  • The job puts the expired network among the "Not included" networks of transit.json by itself, with the reason, and leaves a warning in the run.
  • When the agency publishes valid timetables the network is published again, with another warning.
  • As long as it remains expired, the network gives no further warnings and stays in the "Orari scaduti" (expired timetables) line of the summary.
  • If the downloaded file is the same as the previous time (same sha256, sourceSha256 in the "Not included" entry), the network is not converted again.

Network validation

  • The validation rejects a network with the license page outside https, because the app would discard the whole index.
  • It also rejects a realtimeUrl that is not https with a host and without credentials, or a network with realtimeUrl without the GTFS ids (gtfsIds).

Sweden

Sweden is a single network, the national GTFS Sverige 2 of Trafiklab: CC0, all 72 operators, 48,965 stops, 4.6 MB compressed. The six regional networks available cover only Stockholm, Gothenburg, Malmö and three national operators. GTFS Sweden 3 (694 MB) does not yet cover the whole country.

Overture house number sources

At every new Overture release the pipeline compares all the sources of the release with the list of those reviewed. New sources, or those with a changed license, would be left out silently: for these the pipeline opens an issue with the label overture-licenze and the table of the sources to review. The check does not block the publication.

After a change to the list, the cells affected can be regenerated immediately with the address_cells input, instead of waiting for their 30-day turn.

Guide translation

The step adds to the Italian guides the translated travel advice of the Government of Canada and the Wikivoyage sections translated from English (see Translation). It is enabled: it runs with the repository variable TRANSLATE_GUIDES equal to true.

  • The translations are made on the PC and are in the asset guide-translations.en-it.jsonl.xz of the guide-translations release.
  • The job downloads the asset and applies it to the travel.gc.ca sections that the English pass publishes (GUIDES_FINAL_COPY), so after the English guides. The English pass translates nothing.
  • The step is never blocking: if the asset cannot be downloaded, the step fails with the reason in the summary. The Italian guides keep the translated advice already published, and the Italian Wikivoyage sections return in place of the translated ones.
  • Paragraphs without a translation go into the artifact guide-translations-missing. They are the English paragraphs that are new or changed since the last round on the PC, and the translations discarded by the number check, which must be reread by hand.
  • A category with a paragraph without a translation does not use the new translation until the paragraph is translated on the PC and the asset is uploaded again: the already published translated advice stays (the first time the category stays out), or the Italian Wikivoyage section.

Model, checks and handling of new paragraphs are in Translation. The step also prepares MarianMT for the cities, but today it translates nothing (see Cities).

Versions

The project follows Semantic Versioning and keeps the CHANGELOG.md in the Keep a Changelog format. Every visible change goes in the "Unreleased" section ("Non rilasciato"), because at release the version's section becomes the release notes. publish-apk.yml and sync-release-notes.sh find the ## [X.Y.Z] heading with or without a date. The release steps are in the developer guide (Italian), section "Rilasciare una versione" (Releasing a version).

Licenses page

The licenses of software, models and data are on GitHub Pages, not in the repository. A file in the repository would require an automatic commit to main on every publication, which no workflow does. How the app's Licenses screen shows them is explained in App architecture.

  • The publish job of publish-regions.yml generates licenses.html and licenses-en.html with licenses_page.py, from the address-grid.json and transit.json just copied into the site. This way the house number sources and the public transport networks are always those published.
  • Software and models are tables in the script.
  • The data come from the definitions of the app's Licenses screen (app/aboutlibraries): name, site and license of the data entries, one row per name. The use in the app is written in DATA_USE.
  • A source without a use in DATA_USE, or an extra name, makes test_licenses_page.py fail.
  • If the script fails, the publication continues with a warning.

README and latest release

The README is not updated at every release. The links to download the app point to releases/latest, which GitHub points to the latest vX.Y.Z release because data releases are created with --latest=false.

The version badge reads the highest v* tag in semver order (github/v/tag of shields.io with filter=v*&sort=semver). The github/v/release badge with filter is not used: it reads the list of releases, where the roughly 100 tags of the data releases are not version numbers, and shows "invalid".

For the same reason the README asks to enable "Verify the 'latest' tag" in Obtainium. Without the option Obtainium picks the most recent release with an APK among the last 100, and with enough data releases the app release can fall out of that window.

Assistant models

The models are published by hand with tools/data-pipeline/scripts/upload_hf.py, never by the automatic pipeline. The repository on Hugging Face is created private and becomes public only with an explicit option. The script refuses to publish weights trained on texts with an unverified license.

Clone this wiki locally