Skip to content

fix: authenticate the CARTO basemaps with the suite key - #22

Merged
tgilbert14 merged 2 commits into
mainfrom
claude/carto-basemap-key
Aug 29, 2026
Merged

fix: authenticate the CARTO basemaps with the suite key#22
tgilbert14 merged 2 commits into
mainfrom
claude/carto-basemap-key

Conversation

@tgilbert14

Copy link
Copy Markdown
Owner

What

Canary PR — first of nine. CARTO began watermarking unauthenticated basemaps.cartocdn.com raster tiles with "API KEY REQUIRED" on 2026-08-26, so both maps here — the national site-picker and the theme-aware Biogeography map — render defaced. The request still returns HTTP 200 with a valid PNG, so nothing errored or logged. Full suite diagnosis: docs/SUITE-BASEMAP-INCIDENT-2026-08.md in NEON-Driver-Cascade and tgilbert14/NEON-Driver-Cascade#70.

How

Adds add_suite_basemap() to global.R and routes both call sites through it (R/map_picker.R:57, server.R:1633-1634):

  • With CARTO_BASEMAP_KEY set (Connect Cloud content variable, already issued by CARTO and verified against live tiles): the exact same Positron / Dark Matter tiles as before, keyed. addProviderTiles() cannot carry the key — the bundled CartoDB template has no {apikey} placeholder — so it is a raw addTiles() with explicit OpenStreetMap + CARTO attribution.
  • Without the key: falls back to Esri's keyless grey canvas (light and dark variants) so the map degrades to a clean basemap, never a defaced one. Capped at maxNativeZoom = 16 because that canvas has no content past z16 at rural NEON sites.
  • The dark-mode toggle keeps working unchanged: is_dark() now selects dark_all through the same helper.

The key is a public, rate-limited identifier, not a credential — it rides in the client-side tile URL by design (CARTO's terms ban server-side proxying). The env var keeps it out of git and makes rotation a Connect setting rather than a release.

Manifest

manifest.json is intentionally untouched in the first commit — AGENTS.md rule 2 says never edit it by hand, and this repo has no regenerate-manifest.yml dispatch workflow. The first CI run regenerates it in the pinned validator and uploads the validated manifest candidate artifact; the follow-up commit lands exactly those bytes. Expect the first run red at "Require committed generated bytes to match" — that is the plan working, not a failure of the patch.

Before merging (owner)

  1. Connect Cloud → this app's content settings → Variables → add CARTO_BASEMAP_KEY with the key CARTO emailed (starts cb1_…). Until it is set, the deployed app shows the clean Esri fallback rather than CARTO.
  2. Merge (a human-reviewed merge is the production decision), then check the live map: picker shows Positron, dark mode shows Dark Matter, no watermark, attribution visible.

Verified

  • The key returns clean tiles where unkeyed requests are watermarked — proven at CDN origin misses for light_all and dark_all, and on the previously-cached watermarked picker zooms (the CDN caches keyed responses separately).
  • grep -E 'CartoDB[."$]|cartocdn' across the repo: no unkeyed CARTO reference remains.
  • git diff --check clean; helper parens/braces balanced. No R interpreter was available in the patch environment, so CI's offline-source step is the syntax gate.

🤖 Generated with Claude Code

https://claude.ai/code/session_01738HeGPEU9NEoczL8RXnu1


Generated by Claude Code

Claude added 2 commits August 28, 2026 23:07
CARTO began watermarking unauthenticated basemaps.cartocdn.com raster
tiles with "API KEY REQUIRED" on 2026-08-26, so both maps here — the
national site-picker and the theme-aware Biogeography map — render
defaced. The tile request still returns HTTP 200 with a valid PNG, so
nothing errors or logs; full suite diagnosis lives in NEON-Driver-Cascade
docs/SUITE-BASEMAP-INCIDENT-2026-08.md.

Adds an add_suite_basemap() helper to global.R and routes both call
sites through it. With CARTO_BASEMAP_KEY set (a Connect Cloud content
variable), it serves the exact same Positron and Dark Matter tiles as
before, keyed, via addTiles() — addProviderTiles() cannot carry the key
because the bundled CartoDB template has no {apikey} placeholder. The
key is a public rate-limited identifier, not a credential: it rides in
the client-side tile URL by design, and the env var exists to keep it
out of git and make rotation a Connect setting rather than a release.

Without the key the helper falls back to Esri's keyless grey canvas
(light and dark variants) so the map degrades to a clean basemap rather
than a defaced one; the fallback is capped at its real maxNativeZoom of
16 because the canvas has no content past that at rural NEON sites.

The theme toggle keeps working unchanged: dark mode now selects the
dark_all variant through the same helper.

manifest.json is intentionally not touched in this commit — it is
regenerated in the pinned CI validator per AGENTS.md rule 2, and the
validated candidate artifact from that run lands in the follow-up
commit.
Exact bytes of the "ground-beetle-manifest-be9fde1e" validated candidate
artifact from CI run 33219364063: regenerated by write_manifest.R in the
pinned validator, passed verify_bundle.R and the offline app source, and
uploaded before the byte gate stopped the run. Carries the new checksums
for global.R, R/map_picker.R and server.R, plus the runner's current
package Built timestamps. Generated in the pinned validator per
AGENTS.md rule 2 — not edited by hand.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant