Tasks: OpenFreeMap Production Map Tiles
Input: Design documents from docs/specs/20261127-143403-openfreemap-production-tiles/
Prerequisites: plan.md, spec.md, research.md, data-model.md, contracts/map-basemap-config.md, quickstart.md
Tests: Included per Constitution Principle V (test-first workflow: write/update failing tests before implementing each behavior).
Organization: Tasks are grouped by user story (US1–US4) so each increment can be implemented and independently verified.
Format: [ID] [P?] [Story] Description
- [P]: Can run in parallel (different files, no dependencies on incomplete tasks)
- [Story]: User story label (
US1,US2,US3,US4) — omitted for Setup, Foundational, and Polish phases - Exact repository file paths are included in every task description
Phase 1: Setup (Baseline Confirmation)
Purpose: Verify clean baseline test state before editing source or test files.
- [x] T001 Run existing map unit/component tests and packaging tests to confirm clean baseline (
pnpm exec vitest run src/frontend/lib/maps.test.ts src/frontend/components/MapComponent.test.tsx && uv run --all-extras -- pytest tests/test_frontend_build.py tests/test_compose.py -q)
Phase 2: Foundational (Types & Build-Arg Plumbing)
Purpose: Expose VITE_MAP_STYLE_URL to TypeScript, Hatchling packaging manifests, Docker image builds, and root Docker Compose so all user stories share consistent build-time plumbing.
⚠️ CRITICAL: Complete before User Story implementation begins.
- [x] T002 [P] Add
readonly VITE_MAP_STYLE_URL?: string;toImportMetaEnvinsrc/frontend/vite-env.d.ts - [x] T003 [P] Add
"VITE_MAP_STYLE_URL"toPUBLIC_SETTINGSinsrc/hatchling/plugin.pyso Python wheel/sdist builds forward it to Vite and include it inbuild/frontend-manifest.jsoninput digests - [x] T004 [P] Add
ARG VITE_MAP_STYLE_URLandVITE_MAP_STYLE_URL=$VITE_MAP_STYLE_URLto theapplication-buildstage inDockerfile - [x] T005 [P] Forward
VITE_MAP_STYLE_URL: ${VITE_MAP_STYLE_URL:-}underx-camply.build.argsindocker-compose.yaml - [x] T006 [P] Extend
test_manifest_records_only_supported_public_settingsintests/test_frontend_build.pyto assertVITE_MAP_STYLE_URLis captured inmanifest["settings"]while unrelatedVITE_*variables remain excluded - [x] T007 [P] Add assertion in
tests/test_compose.pyverifying rootdocker-compose.yamlforwardsVITE_MAP_STYLE_URLalongsideVITE_MAP_TILE_URL,VITE_MAP_ATTRIBUTION_TEXT,VITE_MAP_ATTRIBUTION_URL, andVITE_MAP_MAX_NATIVE_ZOOMinbuild.args
Checkpoint: Foundation ready — uv run --all-extras -- pytest tests/test_frontend_build.py tests/test_compose.py -q passes and ImportMetaEnv includes VITE_MAP_STYLE_URL.
Phase 3: User Story 1 - Production-Ready Default Maps via OpenFreeMap Without Extra Infrastructure (Priority: P1) 🎯 MVP
Goal: Make all interactive maps (Explore, Campground detail, Recreation Area detail) default to OpenFreeMap's liberty vector style (https://tiles.openfreemap.org/styles/liberty) with zero API keys, zero requests to tile.openstreetmap.org, preserved transformRequest isolation, and MapLibre automatic attribution.
Independent Test: Run pnpm exec vitest run src/frontend/lib/maps.test.ts src/frontend/components/MapComponent.test.tsx and confirm empty env resolves to { kind: "style", styleUrl: "https://tiles.openfreemap.org/styles/liberty" } and MapComponent passes that style URL string directly to new LibreMap(...) with AttributionControl({ compact: false }) and transformRequest (credentials: "same-origin", referrerPolicy: "strict-origin").
Tests for User Story 1 (Write First — Must Fail Before Implementation)
- [x] T008 [P] [US1] Update default basemap test in
src/frontend/lib/maps.test.tsto expectbasemapConfig({})(andbasemapConfig({ VITE_MAP_MAX_NATIVE_ZOOM: "19" })as passed by Docker builds) to return{ kind: "style", styleUrl: "https://tiles.openfreemap.org/styles/liberty" }with zero references totile.openstreetmap.org - [x] T009 [P] [US1] Update default rendering test in
src/frontend/components/MapComponent.test.tsxto assertnew LibreMap(...)receivesstyle: "https://tiles.openfreemap.org/styles/liberty",attributionControl: false,AttributionControl({ compact: false }), andtransformRequestreturning{ url, credentials: "same-origin", referrerPolicy: "strict-origin" }without acacheoverride
Implementation for User Story 1
- [x] T010 [US1] Export
DEFAULT_MAP_STYLE_URL = "https://tiles.openfreemap.org/styles/liberty",VectorStyleBasemapConfig,RasterTileBasemapConfig, and discriminated unionBasemapConfiginsrc/frontend/lib/maps.ts, updatingbasemapConfig()to return{ kind: "style", styleUrl: DEFAULT_MAP_STYLE_URL }by default whenVITE_MAP_TILE_URLandVITE_MAP_STYLE_URLare unset or empty (depends on T002, T008) - [x] T011 [US1] Update
src/frontend/components/MapComponent.tsxto acceptBasemapConfigand passconfig.styleUrldirectly asstyletonew LibreMap(...)whenconfig.kind === "style", relying on MapLibre'sAttributionControl({ compact: false })for automatic style/TileJSON attribution (depends on T009, T010)
Checkpoint: User Story 1 (MVP) delivers production-safe OpenFreeMap defaults with zero infrastructure and passing unit/component tests.
Phase 4: User Story 2 - Custom Vector Style and Backwards-Compatible Raster Tile Overrides (Priority: P1)
Goal: Support custom VITE_MAP_STYLE_URL overrides (HTTPS or same-origin root-relative paths), preserve full backwards compatibility for VITE_MAP_TILE_URL + VITE_MAP_ATTRIBUTION_* + VITE_MAP_MAX_NATIVE_ZOOM with raster taking explicit precedence, and strictly reject unsafe/malformed configurations locally.
Independent Test: Run pnpm exec vitest run src/frontend/lib/maps.test.ts src/frontend/components/MapComponent.test.tsx covering every row of the precedence matrix and every invalid URL/attribution/zoom rejection case in data-model.md and contracts/map-basemap-config.md.
Tests for User Story 2 (Write First — Must Fail Before Implementation)
- [x] T012 [P] [US2] Add unit tests in
src/frontend/lib/maps.test.tscovering: custom HTTPSVITE_MAP_STYLE_URL(e.g.https://tiles.openfreemap.org/styles/bright), same-origin root-relativeVITE_MAP_STYLE_URL(/styles/liberty.json), whitespace trimming / empty-string fallback to default, explicit precedence ofVITE_MAP_TILE_URLover both default andVITE_MAP_STYLE_URL, rejection of invalidVITE_MAP_STYLE_URL(http://..., protocol-relative//example.com/style.json,javascript:alert(1),data:..., relative path without leading/, whitespace inside URL, embedded credentialshttps://user:pass@tiles.example/style.json), and full backwards-compatible raster validation (required non-empty trimmedVITE_MAP_ATTRIBUTION_TEXT, validhttps://VITE_MAP_ATTRIBUTION_URLwithout credentials,{z}/{x}/{y}tokens, integerVITE_MAP_MAX_NATIVE_ZOOM0–19) - [x] T013 [P] [US2] Add component tests in
src/frontend/components/MapComponent.test.tsxcovering: customVITE_MAP_STYLE_URLpassed toLibreMap, customVITE_MAP_TILE_URLoverride rendering the inlineversion: 8rasterStyleSpecificationwithtiles: [url],maxzoom, and safe DOM attribution anchor (target="_blank",rel="noopener noreferrer"), and invalidVITE_MAP_STYLE_URL(e.g.http://insecure.example/style.jsonorhttps://u:p@example.com/style.json) showing a localrole="alert"without instantiatingLibreMap
Implementation for User Story 2
- [x] T014 [US2] Implement complete precedence and strict validation in
basemapConfig()insrc/frontend/lib/maps.ts: trim inputs; when trimmedVITE_MAP_TILE_URLis non-empty selectkind: "raster"(requiring non-empty trimmedVITE_MAP_ATTRIBUTION_TEXT,https://VITE_MAP_ATTRIBUTION_URLwith emptyusername/password,https://or single-leading-/tile URL containing{z},{x},{y}withprotocol === "https:"and emptyusername/password, and integerVITE_MAP_MAX_NATIVE_ZOOM0–19defaulting to19); otherwise resolve trimmedVITE_MAP_STYLE_URLorDEFAULT_MAP_STYLE_URLaskind: "style"(requiringhttps://or single-leading-/path without//, no ASCII whitespace/control characters, validnew URL(styleUrl, "https://camply.invalid")withprotocol === "https:"and emptyusername/password) (depends on T010, T012) - [x] T015 [US2] Ensure
src/frontend/components/MapComponent.tsxcleanly dispatchesconfig.kind === "raster"to the inlineStyleSpecificationwith safe DOMdocument.createElement("a")attribution andconfig.kind === "style"toconfig.styleUrl, catching allbasemapConfig()errors into localerrorstate (depends on T011, T013, T014)
Checkpoint: User Stories 1 and 2 pass all Vitest unit and component checks for default vector style, custom vector style, custom raster overrides, precedence, and strict URL safety.
Phase 5: User Story 3 - Resilient Basemap Failure Recovery and Legible Attribution Across Viewports & Themes (Priority: P2)
Goal: Handle transient tile errors from any vector or raster source identifier (e.g. "openmaptiles", "basemap", custom style source IDs) via non-blocking Retry tiles, handle remote style-load errors via local Retry map, and ensure multi-link OpenFreeMap attribution stays legible with zero horizontal overflow at 375 px mobile and 1440 px desktop in light and dark themes.
Independent Test: Run pnpm exec vitest run src/frontend/components/MapComponent.test.tsx to verify both "openmaptiles" and "basemap" tile retries plus style-fetch error recovery, and inspect attribution layout/contrast in light and dark themes at 375 px and 1440 px.
Tests for User Story 3 (Write First — Must Fail Before Implementation)
- [x] T016 [P] [US3] Expand error-recovery tests in
src/frontend/components/MapComponent.test.tsxto verify: (a) MapLibre"error"withsourceId: "openmaptiles"(vector source) shows non-blockingBasemap tiles could not loadstatus and clicking Retry tiles callsmap.refreshTiles("openmaptiles"), (b) MapLibre"error"withsourceId: "basemap"(custom raster source) still callsmap.refreshTiles("basemap"), (c) multiple failing source IDs are all refreshed and cleared on retry, and (d) MapLibre"error"withoutsourceId(remote style JSON fetch failure) hidesLoading map…, showsrole="alert"with Retry map, and remountsLibreMapwhen clicked
Implementation for User Story 3
- [x] T017 [US3] Generalize tile vs style error handling in
src/frontend/components/MapComponent.tsx: add afailedSources = useRef<Set<string>>(new Set())ref; route any"error"event with non-empty stringevent.sourceIdintofailedSources.current.add(event.sourceId)andsetTileError(true); route"error"events without a non-emptysourceIdintosetError(event.error?.message || "Map could not load."); update Retry tiles to cleartileError, callmap?.refreshTiles(id)for every tracked source ID, and clearfailedSources.current; clearfailedSources.currenton map remount/cleanup (depends on T015, T016) - [x] T018 [US3] Review
.camply-map .maplibregl-ctrl-attribrules insrc/frontend/index.cssfor multi-link OpenFreeMap attribution readability, contrast, and wrapping on 375 px mobile in light and dark themes; apply minimal CSS adjustments only if needed to prevent clipping or horizontal overflow (depends on T017)
Checkpoint: User Story 3 passes component error-recovery tests for vector/raster sources and style-load failures, with legible attribution styling.
Phase 6: User Story 4 - Deterministic, Offline-Safe Automated Map Verification (Priority: P2)
Goal: Keep Playwright visual snapshots (run-snapshots.ts) and real browser map verification (verify-maps.ts) 100% offline and deterministic by intercepting https://tiles.openfreemap.org/** with local fixtures, asserting zero tile.openstreetmap.org traffic, verifying both source-tile retry and style-fetch retry, and refreshing any affected map-* visual baselines.
Independent Test: Run task maps:verify and task snapshot:check -- --filter map- and confirm zero live external map requests, zero tile.openstreetmap.org requests, zero horizontal overflow at 375 px / 1440 px light & dark, and passing visual comparisons.
Implementation for User Story 4
- [x] T019 [P] [US4] Update
src/frontend/tooling/run-snapshots.tsto intercepthttps://tiles.openfreemap.org/styles/**(returning a minimal deterministic MapLibre v8 JSON style with"openmaptiles"source pointing tohttps://tiles.openfreemap.org/fixture-tiles/{z}/{x}/{y}.pngand OpenFreeMap/OpenMapTiles/OpenStreetMap attribution links) andhttps://tiles.openfreemap.org/fixture-tiles/**(returning the deterministic 256×256rgb(225, 235, 219)PNG withAccess-Control-Allow-Origin: *), replacinghttps://tile.openstreetmap.org/**interception and aborting/failing if any unexpectedtile.openstreetmap.orgrequest occurs - [x] T020 [P] [US4] Update
src/frontend/tooling/verify-maps.tsto: (a) intercepthttps://tiles.openfreemap.org/styles/**andhttps://tiles.openfreemap.org/fixture-tiles/**on all default pages (main, touch, WebGL-recovery), verifying zeroauthorization/x-csrf-tokenheaders and origin-onlyrefererpathname/, (b) assert zero requests tohttps://tile.openstreetmap.org/**, (c) verify visible OpenFreeMap/OpenStreetMap attribution links instead of legacy OSM-only attribution, (d) test both tile failure (fixture-tiles/**→ Retry tiles on"openmaptiles") and style JSON fetch failure (styles/**→ Retry map), (e) preserve the static subpath custom rasterVITE_MAP_TILE_URLbuild check, and (f) verify invalidVITE_MAP_STYLE_URLlocal error recovery alongside invalidVITE_MAP_MAX_NATIVE_ZOOM - [x] T021 [P] [US4] Update the doc comment in
src/frontend/tooling/snapshot-navigation.ts(line 3) from "raster tiles" to "basemap tiles" to match vector and raster basemaps - [x] T022 [US4] Execute
task maps:verifyand confirmtmp/maps-browser.jsonreports zeroconsole_errors, zero OSM requests, passing attribution/header/retry/override checks, and zero overflow at 375 px and 1440 px light/dark (depends on T017, T018, T020) — Verified green in CI (maps - browser verification) - [x] T023 [US4] Run
task snapshot:check -- --filter map-(ortask snapshot:docker -- --update --filter map-if the updated OpenFreeMap attribution bar changesmap-*pixels) and refresh/verify affectedmap-*baselines intests/frontend/snapshots/baselines/with zero horizontal overflow (depends on T017, T018, T019, T021) — Refreshed 24 map-bearing baselines from CI Playwright Docker captures with OpenFreeMap attribution
Checkpoint: User Story 4 is complete — all Playwright browser and visual snapshot suites run 100% offline with zero live OpenFreeMap/OSM traffic.
Phase 7: Polish, Documentation & Final Verification
Purpose: Update operator configuration, architecture, example env, spec index, roadmap, and feature checklist docs, then run full monorepo quality gates.
- [x] T024 [P] Update the Maps (Public Frontend Build Settings) section in
docs/operations/CONFIGURATION.mdto documentVITE_MAP_STYLE_URL(defaulthttps://tiles.openfreemap.org/styles/liberty), customVITE_MAP_TILE_URLraster precedence, build-time-only scope (no runtime endpoint), OpenFreeMap attribution/license/no-SLA/privacy notes, self-hosting alternatives, and CSP directives (connect-src,img-src,worker-src) - [x] T025 [P] Update the commented map settings block in
docs/examples/.env.exampleto include# VITE_MAP_STYLE_URL=https://tiles.openfreemap.org/styles/libertyalongside the custom raster override variables - [x] T026 [P] Update
docs/architecture/DESIGN_FRONTEND.md(line 27) to referenceVITE_MAP_STYLE_URL(OpenFreeMap vector default) alongside custom raster overrides (VITE_MAP_TILE_URL,VITE_MAP_ATTRIBUTION_*) - [x] T027 [P] Update
docs/specs/20261014-223122-open-source-explore-maps/TODO.mdto note that production tile hosting (T3.3.6) is resolved via OpenFreeMap vector styles indocs/specs/20261127-143403-openfreemap-production-tiles/ - [x] T028 [P] Add feature
036: OpenFreeMap Production Map Tileswith links tospec.md,plan.md,tasks.md,data-model.md,research.md,contracts/map-basemap-config.md,quickstart.md, andchecklists/requirements.mdindocs/specs/index.md - [x] T029 [P] Update
T3.3.6indocs/CHECKLIST.mdto[x]with links tospecs/20261127-143403-openfreemap-production-tiles/spec.mdandspecs/20261127-143403-openfreemap-production-tiles/plan.md, and update the Map-Based Discovery note indocs/PLAN.mdto reflect the OpenFreeMap default - [x] T030 Run full verification gates per quickstart.md:
task fix,task check,task test,uv run --all-extras -- pytest tests/docs/test_docs.py -q, andtask docs:check(depends on T022, T023, T024, T025, T026, T027, T028, T029; all locally executable gates passed, browser checks T022/T023 pending CI)
Dependencies & Execution Order
Phase Dependencies
- Phase 1 (Setup): Starts immediately (
T001). - Phase 2 (Foundational): Depends on
T001.T002–T007touch distinct files and run in parallel. Blocks Phase 3+. - Phase 3 (US1 - MVP): Depends on Phase 2 (
T002).T008andT009run in parallel (tests first), followed byT010→T011. - Phase 4 (US2): Depends on Phase 3 (
T010,T011).T012andT013run in parallel (tests first), followed byT014→T015. - Phase 5 (US3): Depends on Phase 4 (
T015).T016(tests first) →T017→T018. - Phase 6 (US4):
T019,T020,T021can be authored in parallel;T022andT023execute onceT017–T021are complete. - Phase 7 (Polish & Docs):
T024–T029all touch distinct documentation files and run in parallel;T030runs final verification gates after everything is complete.
Parallel Opportunities
# Phase 2 parallel batch (distinct files):
T002: src/frontend/vite-env.d.ts
T003: src/hatchling/plugin.py
T004: Dockerfile
T005: docker-compose.yaml
T006: tests/test_frontend_build.py
T007: tests/test_compose.py
# Phase 6 Playwright tooling parallel batch:
T019: src/frontend/tooling/run-snapshots.ts
T020: src/frontend/tooling/verify-maps.ts
T021: src/frontend/tooling/snapshot-navigation.ts
# Phase 7 documentation parallel batch:
T024: docs/operations/CONFIGURATION.md
T025: docs/examples/.env.example
T026: docs/architecture/DESIGN_FRONTEND.md
T027: docs/specs/20261014-223122-open-source-explore-maps/TODO.md
T028: docs/specs/index.md
T029: docs/CHECKLIST.md & docs/PLAN.mdImplementation Strategy
MVP First (User Story 1 + User Story 2)
- Complete Phase 1 (
T001) and Phase 2 (T002–T007) for types and build-arg plumbing. - Complete Phase 3 (
T008–T011) and Phase 4 (T012–T015) to switch default maps to OpenFreeMap while keeping custom style and raster overrides 100% validated and backwards-compatible. - Validate with
pnpm exec vitest run src/frontend/lib/maps.test.ts src/frontend/components/MapComponent.test.tsx.
Full Production Hardening (User Story 3 + User Story 4 + Docs)
- Complete Phase 5 (
T016–T018) for multi-source tile retry, style-fetch retry, and mobile/dark attribution checks. - Complete Phase 6 (
T019–T023) for offline Playwright verification (task maps:verify) and visual baselines (task snapshot:check). - Complete Phase 7 (
T024–T030) for documentation updates and full CI-equivalent quality gates.
Notes
- Total tasks: 30 (
T001–T030). - Zero backend runtime code, zero database migrations, and zero new infrastructure services are introduced.
- Visual baseline refresh (
T023) should usetask snapshot:dockerwhen Docker is available so generated PNGs match CI pixel-for-pixel.