feat(gis): add dual-mode tile URL resolver helper for CDN and local routes #110

Merged
yuris merged 1 commit from feat/dual-mode-tile-url-resolver into main 2026-10-15 02:55:49 +00:00
Owner

Summary

Implement dual-mode tile URL resolver helper in src/lib/gis/tile-url.ts to seamlessly route PMTiles requests to the Cloudflare R2 Anycast CDN edge in production or to the local /tiles/[file] proxy in offline development. Executed playbook: skill://poteto-mode/playbooks/feature.md.

Closes #46

Principles applied

  • principle-model-the-domain: Defined clean options shape and dual resolution paths matching physical environment tiers.
  • principle-boundary-discipline: Isolated environment inspection and URL prefixing logic inside the GIS boundary helper.
  • principle-migrate-callers-then-delete-legacy-apis: Migrated khg-layer.tsx, peat-soil-layer.tsx, and map.ts to use resolveTileUrl.
  • principle-prove-it-works: Verified local and CDN edge URL resolutions with isolated unit tests.
  • principle-test-behavior-not-implementation: Tested observable URL output strings directly with literal value assertions.

Impact

  • For the consumer: Fast, reliable tile loading using global Anycast CDN edge in production with automatic offline fallback during local testing.
  • For the maintainer: Single authoritative source of truth for tile archive URLs across all map layers, eliminating scattered string templates.

Anti-Overengineering Audit (ponytail-review)

  • No bespoke tools or in-house crates added when standard upstream libraries exist.
  • No cosmetic compliance (e.g. importing a library just to call an unused helper or info command).
  • Code subtraction evaluated: unnecessary wrappers or files were deleted rather than preserved.

Verification proof

  • pnpm exec vp check: Passed (0 errors, 0 warnings across 251 files).
  • pnpm test: All 18 test files and 129 unit tests passed.
  • pnpm build: Passed cleanly, standalone Next.js production build compiled in 18s.
## Summary Implement dual-mode tile URL resolver helper in `src/lib/gis/tile-url.ts` to seamlessly route PMTiles requests to the Cloudflare R2 Anycast CDN edge in production or to the local `/tiles/[file]` proxy in offline development. Executed playbook: `skill://poteto-mode/playbooks/feature.md`. Closes #46 ### Principles applied - `principle-model-the-domain`: Defined clean options shape and dual resolution paths matching physical environment tiers. - `principle-boundary-discipline`: Isolated environment inspection and URL prefixing logic inside the GIS boundary helper. - `principle-migrate-callers-then-delete-legacy-apis`: Migrated `khg-layer.tsx`, `peat-soil-layer.tsx`, and `map.ts` to use `resolveTileUrl`. - `principle-prove-it-works`: Verified local and CDN edge URL resolutions with isolated unit tests. - `principle-test-behavior-not-implementation`: Tested observable URL output strings directly with literal value assertions. ### Impact - **For the consumer:** Fast, reliable tile loading using global Anycast CDN edge in production with automatic offline fallback during local testing. - **For the maintainer:** Single authoritative source of truth for tile archive URLs across all map layers, eliminating scattered string templates. ### Anti-Overengineering Audit (ponytail-review) - [x] No bespoke tools or in-house crates added when standard upstream libraries exist. - [x] No cosmetic compliance (e.g. importing a library just to call an unused helper or info command). - [x] Code subtraction evaluated: unnecessary wrappers or files were deleted rather than preserved. ### Verification proof - `pnpm exec vp check`: Passed (0 errors, 0 warnings across 251 files). - `pnpm test`: All 18 test files and 129 unit tests passed. - `pnpm build`: Passed cleanly, standalone Next.js production build compiled in 18s.
feat(gis): add dual-mode tile URL resolver helper for CDN and local routes
All checks were successful
CI / Verify Quality & Build (pull_request) Successful in 1m28s
e7484f75bb
yuris force-pushed feat/dual-mode-tile-url-resolver from e7484f75bb
All checks were successful
CI / Verify Quality & Build (pull_request) Successful in 1m28s
to 3157171f91
All checks were successful
CI / Verify Quality & Build (pull_request) Successful in 1m20s
2026-10-15 02:54:20 +00:00
Compare
yuris-bot approved these changes 2026-10-15 02:54:52 +00:00
yuris-bot left a comment

Code Review & Ponytail Audit Summary: Dual-Mode Tile URL Resolver Helper

1. Mechanical Verification Gate (scripts/verify-pr.mjs)

  • Passed all architectural rules, title conventional commit format, mandatory principles citations, and impact framing.

2. Ponytail Audit (Zero Bespoke Bloat)

  • Helper Design: Lean 37-line functional resolver in src/lib/gis/tile-url.ts managing CDN vs. local proxy routing.
  • Caller Modernization: Migrated khg-layer.tsx, peat-soil-layer.tsx, and map.ts to use the single source of truth resolveTileUrl.
  • Audit verdict: Lean already. Ship.

3. Subsystem Boundary & Discipline

  • Confined to frontend domain (src/lib/gis/tile-url.ts, layers, and tests). Zero backend pipeline or script leakage.

4. Verification & Test Proofs

  • vp check: Passed 100% (260 files formatted, 0 warnings/lint errors in 100 files).
  • pnpm test: All 149 tests passed across 21 test suites, including full coverage of CDN edge resolution, fallback local paths, trailing slashes, and protocol prefixing.
  • next build: Next.js Turbopack build succeeded with all static and dynamic endpoints generated.

5. Acceptance Criteria

  • Verified and checked off all acceptance criteria checkboxes on linked Issue #46.

Decision: APPROVED for squash merge into main.

### Code Review & Ponytail Audit Summary: Dual-Mode Tile URL Resolver Helper #### 1. Mechanical Verification Gate (`scripts/verify-pr.mjs`) - Passed all architectural rules, title conventional commit format, mandatory principles citations, and impact framing. #### 2. Ponytail Audit (Zero Bespoke Bloat) - **Helper Design**: Lean 37-line functional resolver in `src/lib/gis/tile-url.ts` managing CDN vs. local proxy routing. - **Caller Modernization**: Migrated `khg-layer.tsx`, `peat-soil-layer.tsx`, and `map.ts` to use the single source of truth `resolveTileUrl`. - **Audit verdict**: `Lean already. Ship.` #### 3. Subsystem Boundary & Discipline - Confined to frontend domain (`src/lib/gis/tile-url.ts`, layers, and tests). Zero backend pipeline or script leakage. #### 4. Verification & Test Proofs - `vp check`: Passed 100% (260 files formatted, 0 warnings/lint errors in 100 files). - `pnpm test`: All 149 tests passed across 21 test suites, including full coverage of CDN edge resolution, fallback local paths, trailing slashes, and protocol prefixing. - `next build`: Next.js Turbopack build succeeded with all static and dynamic endpoints generated. #### 5. Acceptance Criteria - Verified and checked off all acceptance criteria checkboxes on linked Issue #46. **Decision**: APPROVED for squash merge into `main`.
yuris merged commit 52293531c3 into main 2026-10-15 02:55:49 +00:00
yuris deleted branch feat/dual-mode-tile-url-resolver 2026-10-15 02:55:49 +00:00
Sign in to join this conversation.
No reviewers
No labels
backend
frontend
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/titik-gambut-next!110
No description provided.