Introducing a new way to review your PRs.

Read the announcement

maplibre / martin

Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server, tile generation, and mbtiles tooling.

View on GitHub

22 documents · Updated Nov 23, 2026

docs / operations-and-quality

Operations and quality

Martin combines live operational views with layered verification and gated delivery. These systems let an engineer observe request health while Martin runs, check behavior at its public interfaces, and stop an unverified build from reaching users. The server's runtime model is described in Martin server runtime.

Operational model

Martin exposes two complementary views of a running service. The terminal dashboard is for a person watching one process, while health and metrics endpoints support repeatable checks and external monitoring.

flowchart LR
    R[HTTP request] --> S[Martin server]
    S --> H[/health]
    S --> M[/metrics]
    S --> O[Dashboard observation]
    O --> D[Terminal view]

The views answer different questions:

ViewMain questionResult
Health endpointIs the service ready to answer?A simple success response
Metrics endpointWhat request activity and latency does the service report?Prometheus text
Terminal dashboardWhat is this process serving right now?Counters, source activity, map hits, and logs

Terminal dashboard

The terminal dashboard is a live operator view for an interactive Martin process. It replaces the normal log stream when a terminal is available, then combines server address, uptime, request counts, error counts, source activity, request rate, recent tile locations, and recent logs in one screen. The --no-tui mode keeps the normal log stream for non-interactive use. The browser-facing operational view is described in Martin web dashboard.

The dashboard observes completed requests. It counts client and server error responses, groups tile activity by source, and keeps recent tile locations for a short-lived map view. Logs remain available in the same screen, so an operator can relate a visible request problem to nearby server events.

The view is designed for quick inspection rather than long-term storage. Operators can clear counters, expand the log, scroll through older entries, and quit without changing the server's request behavior.

References: martin/…/mod.rs• L1-5 martin/…/mod.rs• L45-57 martin/…/mod.rs• L77-147 martin/…/data.rs• L66-85 martin/…/data.rs• L142-186 martin/…/render.rs• L37-58

HTTP health and metrics

The health endpoint provides a small readiness check, while the metrics endpoint provides a machine-readable view of request activity. Metrics cover route-level request families and distinguish tile cache hits, which makes them useful for service monitoring beyond the local terminal. The container image uses the health endpoint as its Docker health check, so container status follows the same readiness signal.

The same interfaces act as stable probes in automated checks. The integration suite sends real requests to them and verifies status, response shape, and metric output without relying on dashboard rendering. Cache tests show that a cache miss can still populate the rest of its prefetch block, while server responses remain equal to bulk-generated tiles with or without prefetch. Source failure tests also confirm that health can remain available when an archive cannot serve an uncached tile.

References: martin/…/pg_server_test.rs• L1061-1072 crates/…/metrics.rs• L1-101 crates/…/mbtiles.rs• L494-600 crates/…/engine_serve.rs• L9-72 crates/…/engine_serve.rs• L74-216 crates/…/pmtiles.rs• L838-861 .github/…/multi-platform.Dockerfile• L14-25 justfile• L317-326

Verification systems

Martin uses checks at several distances from the code. Unit and snapshot tests check local rules, integration tests exercise the running binary through HTTP and command-line interfaces, and feature-specific suites check external systems such as PostGIS, object storage, recorded upstream services, OGC conformance engines, and OpenStreetMap PBF inputs.

flowchart TB
    C[Code change] --> U[Unit and snapshot checks]
    C --> I[Binary and CLI integration checks]
    C --> X[External-system checks]
    U --> G[CI result]
    I --> G
    X --> G
    G --> P[Packaging and release gates]

Automated integration coverage

The integration suite starts Martin and mbtiles as real processes. It drives their public commands and HTTP routes with fixture data, then checks responses, headers, logs, saved configuration, generated tiles, and snapshots. This protects the behavior that a user or deployment sees rather than only the behavior of isolated functions. Automated integration coverage

Coverage is split by the capability or dependency under test. The suites cover source catalogs and tile routes, configuration and reload behavior, PostgreSQL, S3-compatible storage, COG, DuckDB, PMTiles, and OpenStreetMap PBF inputs, STAC discovery, style rendering, metrics, OGC API Tiles and Maps behavior, OGC conformance, MBTiles source changes and cache behavior, and command-line operations. Feature flags keep tests that need special services or native libraries separate from the common path.

The shared harness gives each test a controlled server lifecycle. It reports startup failures with the process exit status and log, assigns an available local port, waits for an HTTP response, and provides helpers for response and log assertions. It can run tests against a selected binary or container. Recorded upstream responses keep style and STAC checks repeatable, while temporary RustFS storage and a TEAM Engine let selected tests check S3 and formal OGC behavior without depending on live upstream state. The harness also runs one-shot martin cp and martin test commands, including interactive review in a fixed terminal and seeded database.

The source checks cover both normal serving and recovery. They verify remote range reads, source discovery, reload after an object or archive changes, and safe behavior while a source is unavailable. They also compare tile-cache prefetch behavior with direct serving, and check that health remains usable during a damaged archive. DuckDB checks compare catalog, TileJSON, tile, filter, reload, and MLT behavior. Image and response snapshots make changes to tile output, metadata, and logs visible during review.

The command-line checks protect offline tile generation and MBTiles file workflows. martin cp checks validate input rules, output schemas and metadata, source coverage, and parity between generated tiles and tiles served by Martin. Bulk mode checks also require deterministic output across worker settings, compare MBTiles and PMTiles tile sets, validate layer and metadata rules, enforce configured feature order, and reject unsupported options before creating output. OSM cases now cover PBF-backed layer selection, deterministic bulk output, invalid node order, and format rules. martin test checks generate and run a specification against OSM data, while its review flow protects accepted, rejected, gone, and undecided cases before writing a spec. PostGIS cases also check direct feature encoding and safe fallback for sources that cannot use that path. The mbtiles CLI checks pack and unpack round trips, coordinate schemes, compression choices, ordered source merges, metadata updates, cache schemas, and patch creation and application. Binary-diff checks compare both tile contents and patch payload rows, so a patch can be checked after compression changes.

Rendering checks protect the image-facing interfaces as well as vector output. Recorded style requests keep upstream tile and font data stable, while reference images and response checks verify style tiles, static images, pixel ratios, image formats, camera bounds, and concurrent requests. OGC API Maps checks extend this coverage to dataset and style maps, raster collection composition, content metadata, map tiles, links, conformance declarations, supported formats, and invalid request limits. These checks also cover the boundary between generated archives and serving: bulk output must remain readable by Martin, and unsupported format or grid combinations must fail before they create misleading output.

References: crates/…/Cargo.toml• L1-69 crates/…/lib.rs• L1-19 crates/…/lib.rs• L29-45 crates/…/martin.rs• L28-45 crates/…/martin.rs• L123-185 crates/…/martin.rs• L209-317 crates/…/martin.rs• L347-420 crates/…/martin.rs• L423-519 crates/…/martin_cp.rs• L1-12 crates/…/martin_cp.rs• L61-79 crates/…/martin_test.rs• L1-43 crates/…/martin_test_generate.rs• L16-29 crates/…/martin_test_generate.rs• L86-189 crates/…/cassette.rs• L24-37 crates/…/cassette.rs• L46-63 crates/…/rustfs.rs• L55-145 crates/…/team_engine.rs• L17-87 crates/…/cog.rs• L168-248 crates/…/cog_stac.rs• L1-62 crates/…/duckdb.rs• L31-128 crates/…/duckdb.rs• L1035-1157 crates/…/engine_serve.rs• L9-216 crates/…/martin_cp_bulk.rs• L12-163 crates/…/martin_cp_bulk.rs• L492-743 crates/…/martin_cp_bulk.rs• L854-1002 crates/…/martin_cp_bulk.rs• L1648-1837 crates/…/martin_cp_osm.rs• L1-164 crates/…/martin_test_generate.rs• L1-47 crates/…/martin_test_osm.rs• L1-47 crates/…/mbtiles_diff.rs• L236-428 crates/…/ogc_maps.rs• L19-81 crates/…/ogc_maps_conformance.rs• L11-73 crates/…/pmtiles.rs• L268-299 crates/…/pmtiles.rs• L606-644 crates/…/pmtiles.rs• L768-861 crates/…/rendering.rs• L61-95 crates/…/rendering.rs• L229-276 crates/…/rendering.rs• L320-383 crates/…/rendering.rs• L987-1086 tests/…/README.md• L1-28 tests/…/shortbread.spec.yml• L1-38 tests/…/shortbread_examples.py• L1-8 .github/…/rust.yml• L76-199

Contract and schema checks

Generated configuration and OpenAPI schemas are treated as service contracts. The schema checks validate the schema documents themselves and then validate real saved configurations, including the generated documentation example. This catches drift between accepted configuration, published API shape, and the material Martin writes for users.

The same quality layer checks source formatting, Rust lints, frontend types and tests, Markdown links, and documentation builds. The autofix workflow selects Rust and Python binding changes by path, regenerates the affected schemas or Python stub, and can commit safe formatting and generated-file updates, while the schema job validates the committed result. These checks do not replace runtime tests. They prevent a valid server change from being shipped with broken generated contracts or unusable supporting material.

References: justfile• L96-119 justfile• L120-184 justfile• L389-407 .github/…/autofix.yml• L15-47 .github/…/autofix.yml• L87-122 .github/…/schemas.yml• L14-34

Security and resilience checks

Martin's quality system checks more than expected output. Workflow definitions, Rust dependencies, pull-request dependency changes, and supported source code are scanned for unsafe or known-risk changes. Fuzz runs exercise tile geometry and encoding rules, while scheduled dependency expansion checks find dependencies used only through generated code. The security workflow combines workflow scanning, advisory checks, dependency review, license and source checks, and CodeQL analysis.

OpenSSF Scorecard adds a supply-chain view of the repository. It runs on the default branch and on a schedule, publishes its results, and uploads SARIF data to GitHub code scanning. This keeps workflow and repository practice risks visible alongside code and dependency findings.

These checks use separate paths because they protect different failure classes. A normal pull request receives the checks that its changed paths can affect, while scheduled jobs provide slower or wider coverage without delaying every change. The fast dependency scan runs in the normal Rust lane, while the full macro-expansion scan runs weekly or on demand because it compiles the whole workspace. CodeQL can analyze the action, TypeScript, and Rust surfaces selected for the change.

References: .github/…/security.yml• L1-43 .github/…/security.yml• L49-171 .github/…/fuzz.yml• L24-53 .github/…/shear-expand.yml• L1-38 .github/…/scorecard.yml• L1-64 .github/…/ci.yml• L111-158 .github/…/rust.yml• L235-247

Delivery workflows

GitHub Actions coordinates verification and release as one chain. The main CI workflow first selects suites from the changed paths, runs the affected quality jobs, and exposes one final result used by merge protection.

flowchart LR
    E[Push, pull request, release, or schedule] --> C[Change selection]
    C --> R[Rust and integration suites]
    C --> Q[UI, docs, schemas, and security suites]
    R --> F[Final CI result]
    Q --> F
    F -->|main or release event| B[Build and package artifacts]
    B --> A[Attest and publish]

Continuous integration

The CI workflow uses path-aware selection for pull requests, but it still keeps a single final status. Rust checks include linting, unit and documentation tests, feature checks, end-to-end tests, platform checks, external-service checks, package checks, and coverage. Other jobs cover frontend behavior, documentation, generated schemas, fuzz targets, dependency risk, and code scanning.

The breadth of the matrix reflects Martin's deployment surface. The workflow can test native binaries, Docker images, Debian packages, Windows and FreeBSD runs, several PostGIS versions, S3-compatible storage, COG, DuckDB, STAC sources, OpenStreetMap PBF workflows, and the OGC Tiles and Maps conformance suites. It also tests the packaged Docker images before publication and checks release binaries on their target systems. Heavy platform work can be deferred for lower stack pull requests without removing the required final gate.

The final CI Finished job treats skipped suites as passes when path selection shows that a pull request cannot affect them. It still fails when a selected suite or reusable workflow fails. This keeps fast feedback for small changes while preserving one stable merge-protection contract.

References: .github/…/ci.yml• L24-46 .github/…/ci.yml• L160-280 .github/…/rust.yml• L43-247 .github/…/rust.yml• L381-617 .github/…/rust.yml• L678-1043 .github/…/action.yml• L1-71

Frontend delivery

The frontend workflow checks the web interface as a product surface. It installs the locked UI dependencies, then runs style checks, unit tests, type checks, and a production build. This keeps the dashboard's browser contract aligned with the server before a change reaches the shared CI result.

References: .github/…/ui.yml• L1-32

Documentation delivery

The documentation workflow treats written guidance as a checked product. It validates Markdown style and links, builds the documentation site, and deploys the generated book from main.

References: .github/…/docs.yml• L1-49

Release delivery

Release delivery starts only after the required CI suites pass. The package job downloads every build-binary artifact when the heavy build path runs, creates an SPDX software bill of materials, packages the target files, and creates provenance data. It keeps packaged files for the main-branch release step. A Martin release publishes its binaries with build provenance when the release has no assets, while stable Martin releases also create a Homebrew update pull request.

On the main branch, release-plz uses a GitHub App token so its release tags, releases, and pull requests trigger the follow-on workflows. When it creates releases, the workflow attaches the packaged Martin and mbtiles binaries and their provenance. When it creates no release, it prepares the generated files and opens a pull request for the next version. The Python delivery path remains separate for cog-tiles: it builds wheels and a source distribution across supported Python and platform lanes, runs import checks, records provenance, and publishes to PyPI through trusted publishing after a python-cog-tiles-v* release event. Delivery workflows

The release workflow also handles Docker delivery through the Rust workflow. Before publication, base and full images are built and tested against the end-to-end suite. Release and scheduled image pushes include multi-platform images with software bills of materials and provenance, while a legacy-CPU image serves older x86_64 hardware. The image declares /health as its container health check, so the published container keeps the service readiness contract.

References: .github/…/build-binary.yml• L1-37 .github/…/build-binary.yml• L116-142 .github/…/release.yml• L34-86 .github/…/release.yml• L104-132 .github/…/release.yml• L134-251 .github/…/rust.yml• L304-379 .github/…/rust.yml• L381-613 .github/…/python-release.yml• L25-106 .github/…/multi-platform.Dockerfile• L1-25

Pull-request and maintenance workflows

Small workflows protect the delivery process itself. Pull-request titles follow the Conventional Commits format, forked pull requests can receive safe label handling without running their code, and formatting or generated-file drift can be fixed through a controlled automation path. Manual benchmarks, demo builds, and scheduled security checks add focused signals without becoming part of every pull request.

These workflows use narrow permissions and separate event paths for untrusted pull requests. The title workflow validates metadata without checking out contributor code. The autofix workflow selects affected Rust or Python binding changes, regenerates only the related contracts, and uses a labeled path for approved snapshot updates. The hotpath relay publishes benchmark reports from a completed benchmark workflow without checking out fork code. That separation keeps review metadata and repository automation from becoming a way to execute contributor-controlled code with write access.

References: .github/…/autofix.yml• L1-20 .github/…/autofix.yml• L15-47 .github/…/autofix.yml• L87-170 .github/…/bench.yml• L16-38 .github/…/demo.yml• L14-28 .github/…/hotpath-relay.yml• L1-35 .github/…/pr-relabeling.yml• L3-30 .github/…/pr-title.yml• L1-36

Change checklist

When these files or sections are changed, remember to consider these:

  • Change the request shape or route labels together with the metrics snapshots and dashboard request observation, because monitoring can silently report a different route or source.
  • Change configuration or OpenAPI behavior together with generated schemas, the saved-configuration fixtures, and the TypeScript types derived from the OpenAPI document.
  • Change a source backend or feature flag together with the matching integration suite and its CI feature selection, especially for PostGIS, S3, COG, DuckDB, rendering, STAC, OSM, and OGC tests.
  • Change recorded upstream behavior together with the cassette fixtures and miss checks, because CI must fail instead of silently fetching a new response.
  • Change bulk copy rules, tile formats, metadata rules, or configured feature ordering together with the martin cp output checks, server round-trip checks, ordering snapshots, and the feature flags that make PostGIS and MLT cases run.
  • Change OSM PBF parsing, layer rules, or generated test specs together with the checked-in PBF fixtures, Shortbread examples, deterministic bulk checks, and martin test generate/run coverage.
  • Change DuckDB source discovery, filters, reload, remote access, or MLT negotiation together with catalog, TileJSON, tile, saved-config, log, and recovery checks.
  • Change PMTiles source discovery, remote range reads, reload, route prefixes, or cache bounds together with local, HTTP, S3, watched-path, and health checks.
  • Change MBTiles discovery, reload, cache bounds, or index rules together with catalog responses, tile responses, logs, and cache metric assertions.
  • Change MBTiles pack or unpack schemes, compression, merge rules, metadata updates, or patch formats together with the matching round-trip, patch-payload, and early-rejection checks.
  • Change bulk rendering limits, layer expressions, source selection, or output format rules together with MBTiles validation, PMTiles parity, server round trips, and rejected-option checks.
  • Change interactive martin test generate behavior together with its pseudo-terminal screen assumptions, seeded database, review keys, and timeout checks.
  • Change a release artifact name, target, or feature set together with artifact download, packaging, Docker, Debian, Homebrew, and binary test steps.
  • Change release workflow triggers, permissions, or artifact conditions together with the provenance, SBOM, release-plz, and publish-event paths.
  • Change workflow paths or job names together with the done job and merge protection, because skipped or renamed jobs can change the final gate.
  • Change security workflow inputs, CodeQL language selection, or SARIF destinations together with the permissions and code-scanning results that consume them.
  • Change Python compatibility or release tags together with the wheel matrix, import smoke checks, provenance, and PyPI publish condition.

Important failure modes

TriggerConsequenceGuard
A request route changes without its metrics or dashboard mappingOperators see incomplete or misleading request dataMetrics snapshots, dashboard observer tests, and route integration tests
A recorded upstream response is missing from a cassetteRendering or STAC tests return a 404 instead of checking the intended behaviorCassette miss assertions and CI-only replay mode
A required external service is not ready or uses the wrong connection settingsIntegration tests fail before they exercise MartinControlled PostGIS, RustFS, and TEAM Engine setup with readiness checks
A source reload fails during a remote object outageA source can disappear or serve a bad replacement instead of keeping the last good stateCOG reload and recovery integration checks
A DuckDB filter or source reload changes the published schema or tile contentClients receive stale catalog data or a source serves the wrong rows after a file changeDuckDB catalog, TileJSON, tile, filter, reload, and saved-config checks
A PMTiles archive changes while a request is reading itCached tiles can remain valid while uncached requests fail, or the process can stop serving health checksPMTiles replacement, corruption, reload, and health checks
A watched MBTiles file is added, changed, or removed without a matching catalog updateThe catalog and tile routes expose stale or missing source stateWatched-directory integration checks for source lifecycle and logs
A cache bound does not apply at the expected source levelLow-zoom requests produce cache activity that violates the configured boundMBTiles and PMTiles cache metric checks for global, kind-level, and source-level settings
An MBTiles file has no required unique tile indexMartin can serve it with a warning, while a copy destination can be unsafeServer warning checks, summary checks, and copy validation
Interactive generated-case review does not settle or exitAutomation cannot confirm the reviewed resultFixed pseudo-terminal, seeded database, and timeout checks
Bulk mode accepts an option or source shape it cannot honorIt can create incomplete output or fail after creating a misleading destinationBulk-mode rejection checks, output absence assertions, validation, and MBTiles/PMTiles parity
Bulk ordering rules change without coverage for negative or null IDsGenerated tile feature order can change without a clear compatibility signalAscending and descending order_by integration snapshots
An OSM PBF has unsupported order or mixed source selectionBulk generation can fail late or produce output that does not match its source contractOSM fixture cases, node-order rejection, and source-selection checks
Metadata is both set and deleted in one copy or updateThe command could write an ambiguous result or modify a file before failingConflict checks and assertions that no output or source change occurs
A tile tree uses the wrong coordinate scheme or mixed formatsPack and unpack produce misplaced or unreadable tilesScheme round trips, format checks, and compression assertions
A binary-diff patch changes compressed bytes while preserving tile contentA byte-level comparison can reject a valid applied tileset or hide a bad patchPlain-tile comparison, per-tile hashes, patch-row comparison, and metadata hash checks
Generated schemas do not match configuration or API behaviorClients and config tools accept stale contractsjust test-schemas and the schemas CI job
A release artifact is missing or has the wrong target namePackaging or downstream installation cannot find the binaryBuild artifact naming, package assembly, and release-binary tests
A release event has assets when the package job expects noneThe workflow can skip binary upload or provenance attachmentRelease asset lookup, unmatched-glob failure, and release publish conditions
A workflow change bypasses a required suiteA broken change can appear mergeableChange selection plus the always-run CI Finished job
A Scorecard run lacks its code-scanning or identity permissionSupply-chain results are not published or visible in the expected dashboardNarrow workflow permissions and SARIF upload checks
A Python release tag does not match the publish conditionBuilt wheels are not published to PyPIRelease tag filter, wheel smoke check, and trusted-publisher job

Key files

FileWhy to read it
martin/…/mod.rsDashboard lifecycle, controls, and terminal behavior
martin/…/data.rsOperational data shown to an operator
crates/…/Cargo.tomlIntegration feature boundaries and test dependencies
crates/…/lib.rsShared process harness, fixture handling, and external test helpers
crates/…/martin.rsMartin lifecycle, HTTP probes, response decoding, and log checks
crates/…/martin_cp.rsOne-shot command interface for copy verification
crates/…/martin_test.rsOne-shot command interface for generated-case verification
crates/…/martin_test_generate.rsInteractive review, seeded database, terminal settling, and timeout checks
crates/…/engine_serve.rsVerification of tile prefetch cache behavior, metrics, and bulk parity
crates/…/martin_cp.rsVerification of copy validation, output formats, metadata, PostGIS sources, and MLT behavior
crates/…/martin_cp_bulk.rsVerification of whole-table generation, deterministic output, layer rules, output formats, ordering, and bulk-mode limits
crates/…/martin_cp_osm.rsVerification of OSM PBF bulk generation and source rules
crates/…/martin_test_generate.rsVerification of interactive generated-case review
crates/…/martin_test_osm.rsVerification of OSM specification generation and execution
crates/…/mbtiles_diff.rsVerification of MBTiles copy, cache, diff, and binary-diff patch behavior
crates/…/duckdb.rsVerification of DuckDB and GeoParquet discovery, filtering, reload, remote access, and tile formats
crates/…/pmtiles.rsVerification of local and remote PMTiles serving, source lifecycle, cache behavior, and health
crates/…/rendering.rsVerification of style rendering, image output, upstream replay, and image references
crates/…/ogc_maps.rsVerification of OGC API Maps output, map composition, links, formats, and request limits
crates/…/mbtiles.rsVerification of MBTiles serving, watched-source lifecycle, cache bounds, and index warnings
crates/…/mbtiles_cli.rsVerification of MBTiles pack, unpack, copy, metadata, and failure behavior
tests/…/README.mdPurpose and source of the OSM verification fixtures
tests/…/shortbread.spec.ymlExpected behavior for representative OSM objects
tests/…/shortbread_examples.pyGeneration of deterministic OSM example data
martin/…/cp.rsPublic copy modes and the copy operation's user-facing rules
crates/…/cassette.rsRepeatable replay of upstream HTTP behavior
crates/…/rustfs.rsTemporary S3-compatible test service
crates/…/team_engine.rsOGC conformance test service interface
justfileLocal test, schema, coverage, packaging, and release commands
.github/…/action.ymlShared Rust tool, cache, rendering, and coverage setup
.github/…/ci.ymlTop-level suite selection, release handoff, and merge gate
.github/…/rust.ymlRust, integration, platform, container, conformance, packaging, and coverage jobs
.github/…/build-binary.ymlReusable target build and artifact contract
.github/…/ui.ymlFrontend lint, unit, type, and build checks
.github/…/docs.ymlMarkdown checks, documentation build, and main-branch documentation deployment
.github/…/security.ymlWorkflow, dependency, source, and CodeQL security checks
.github/…/scorecard.ymlOpenSSF supply-chain analysis and code-scanning publication
.github/…/shear-expand.ymlScheduled full dependency-use analysis through macro expansion
.github/…/autofix.ymlFormatting, generated contract updates, and approved snapshot updates
.github/…/schemas.ymlValidation of committed configuration and OpenAPI contracts
.github/…/hotpath-relay.ymlSafe relay of benchmark reports from completed benchmark runs
.github/…/pr-title.ymlPull-request title validation without running contributor code
.github/…/release.ymlArtifact packaging, SBOM generation, provenance, and publication
.github/files/multi-platform.DockerfileContainer health contract and runtime image shape
.github/…/python-release.ymlPython wheel checks and PyPI publication