SPB Git

Repository Public BSD-3-Clause

CONVENTIONS.md 4.0 KB

# ORIX Maps — engineering conventions

Read this before touching the repository. It applies to people and to coding agents.

# Layout

  • Apps/ORIXMaps/ — the iOS / iPadOS application (XcodeGen, SwiftUI).
  • Packages/<Module>/ — one SwiftPM package per module (Package.swift, Sources/<Module>/, Tests/<Module>Tests/). Modules depend on each other with .package(path: "../<Other>"). ORIXGeoCore has no dependency and is the base of everything.
  • Infrastructure/ — build-time tools that run on macOS only (never linked into the app): OSM ingestion, tile, geocoder, routing and package builders, distribution.
  • data/ — local geodata, git-ignored. Never commit .osm.pbf, .pmtiles, .orixmap, .orixgraph, databases or keys.
  • docs/ — architecture, format specifications, ADRs (docs/adr/NNNN-title.md).

# Swift

  • swift-tools-version: 6.0, swiftLanguageModes: [.v6], platforms .iOS(.v18), .macOS(.v15) for app modules, .macOS(.v15) only for build tools. Every app module must compile and pass its tests on macOS with swift test (UIKit / CoreLocation specifics behind #if canImport).
  • Tests use Swift Testing (import Testing), not XCTest.
  • No third-party dependency without an ADR (licence, maturity, memory cost, iOS compatibility). System frameworks are fine: Foundation, SQLite3, CryptoKit, Compression, os.
  • Concurrency: Swift Concurrency; actor for caches and stores that are shared; value types Sendable. No global singleton, no static var shared. Dependencies are passed in initializers behind protocols.
  • Errors are typed (enum …Error: Error) and carry what the user or the caller needs; never fatalError on input data. Every parser of external bytes (files, downloads, imports) is bounds-checked and has a test with corrupted input.
  • On-disk binary formats: little-endian, versioned magic header, explicit sizes and limits, documented in docs/.
  • Coordinates are ORIXGeoCore.Coordinate (WGS 84 degrees); integer storage is E7 (Int32, 1e-7 degree).
  • Code, comments, identifiers and documentation are in English. User-facing strings are localized in English and French (fr-CA) by the app; packages return typed values or keys, not hard-coded sentences, unless the module's job is text (for example instruction generation, which must then support en and fr).
  • Do not write file headers by hand: the repository header tool is applied once at the end.
  • Privacy: no network call outside ORIXMapPackage (catalog and package download). No logging of precise coordinates, search text or identifiers. No analytics.
  • Honesty: never fabricate data (addresses, speeds, elevations). When data is missing, return an explicit "unknown" value. Never claim a result that was not measured; write the command and the numbers in the module README.

# Data and licences

  • OpenStreetMap data © OpenStreetMap contributors, ODbL 1.0. Everything derived from it (tiles, search index, routing graph) is a derivative database: keep the attribution and the data date in every artefact's metadata.
  • Local extracts available for development (git-ignored): data/quebec-latest.osm.pbf (province of Québec, 1.17 GB, 139 M nodes, 9.9 M ways, 195 k relations, data timestamp 2026-11-24), data/montreal.osm.pbf (Greater Montréal, bbox -74.35,45.15,-73.15,45.95, 97 MB), data/quebec-city.osm.pbf (bbox -71.75,46.60,-70.85,47.10, 22 MB).
  • Infrastructure/ingestion/ORIXOSM reads PBF files (OSMPBFReader): blocks decoded in parallel, delivered serially in file order (nodes, then ways, then relations). Use it; do not write another PBF parser.

# Working rules

  • Stay inside the directories you own. Do not edit another module; if its API is missing something, say so in your report.
  • Do not run git commit, git add, git stash or any command that rewrites the work tree: the lead integrates.
  • Each module has a README.md: purpose, public API overview, formats, measured numbers with the exact commands, known limits.
  • A feature is done when it is implemented, compiled, tested and measured. Anything else is listed under "Not done".
Files main
Menu

Theme