Skip to content

cockpit-server: bucket-read multi-region OSM catalogue + /api/osm/regions - #142

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/q2-osm-chains-books-lancedb
Aug 18, 2026
Merged

cockpit-server: bucket-read multi-region OSM catalogue + /api/osm/regions#142
AdaWorldAPI merged 1 commit into
mainfrom
claude/q2-osm-chains-books-lancedb

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Summary

Closes the "adding/selecting a region needs an env-var change + redeploy" friction: OSM_BAKE_REGION previously selected the single servable region, and switching regions meant a Railway env-var edit (which triggers a redeploy) even though the bake itself already lives in S3 (q2/bakes/<region>-v1) with no code change needed.

  • New osm_region_catalogue.rs: reads .config/q2/config.yaml from the bucket via lance_graph::soa_config's shared schema/parser — the same boot-config pattern every other AdaWorldAPI deployment reads its own bake catalogue from — and projects it onto (name, hydrate). table/classid are validated but unused here: this deployment's OSM bakes are still raw .soa/.books/.chains file triplets, not Lance tables; reusing the shared, already-hardened parser (unknown-key rejection, duplicate-name rejection, deny_unknown_fields) beats hand-rolling a near-identical one.
  • osm_slab_hydrate::ensure_slab_local now: loads the catalogue (falling back to a single synthetic entry from OSM_BAKE_REGION/DEFAULT_REGION when no config.yaml exists — zero behavior change for deploys that never opt in), hydrates every hydrate: true entry (hydrate: false stays declared-but-not-pulled, never fetched), and publishes the resolved catalogue for the new endpoint. OSM_BAKE_REGION, when set, still wins outright as the active region even if absent from the catalogue or declared hydrate: false there — the pre-existing escape hatch is unchanged, including bake_region()'s validate-or-fall-back-to-default behavior on an invalid value.
  • Region-name validation ([a-z0-9-], ≤64 bytes — guards the S3 key/path join against traversal) now applies to every catalogue-sourced name too, not only the env-var path.
  • New GET /api/osm/regions: the map-menu data source (name, hydrated, active per region). Read-only discovery — this deployment still serves exactly one active region at a time (open_slab()'s mmap is process-global); switching which one is active still needs the operator to flip hydrate: true (or set OSM_BAKE_REGION) and restart. That is a narrower claim than "hot-swap without restart," which this change does not attempt.

Test plan

  • 12 new unit tests in osm_region_catalogue.rs (TDD): parse_catalogue_yaml projects name/hydrate correctly, keeps hydrate: false entries (does not drop or promote them), rejects malformed YAML, propagates the shared parser's own duplicate-name validation; pick_active prefers the env override even when absent from the catalogue or over a hydrate: true entry, falls back to the first hydrate: true entry, returns None on an all-false catalogue with no override (paired negative case); the publish/snapshot OnceLock round-trips and a second publish is a silent no-op rather than a panic.
  • cargo check -p cockpit-server --bin q2-cockpit --tests: clean, 0 errors, 0 new warnings (34 pre-existing baseline warnings unchanged).
  • cargo test/nextest for this crate could not be run to completion in this session: the q2-cockpit test binary transitively links nearly the entire q2 workspace (lance/arrow/datafusion/geo/aws-sdk/opendal/tree-sitter/wasmtime/mlua/…), and the final link step exceeded this container's disk allowance on repeated attempts (ENOSPC, then a linker SIGBUS), even immediately after a full target/ clean. This is the same environment limitation documented on q2#141 for the same binary, unrelated to this change. Reported honestly: type/borrow-check-verified, not executed-test-verified.

🤖 Generated with Claude Code


Generated by Claude Code

…ions

Closes the "adding/selecting a region needs an env-var change + redeploy"
friction: OSM_BAKE_REGION previously selected the single servable region,
and switching regions meant a Railway env-var edit (which triggers a
redeploy) even though the bake itself already lives in S3 with no code
change needed.

- New osm_region_catalogue.rs: reads .config/q2/config.yaml from the
  bucket via lance_graph::soa_config's shared schema/parser (the same
  boot-config pattern every other AdaWorldAPI deployment uses for its own
  bake catalogue) and projects it onto (name, hydrate). table/classid are
  validated but unused here — this deployment's OSM bakes are still raw
  .soa/.books/.chains file triplets, not Lance tables; reusing the shared,
  already-hardened parser (unknown-key rejection, duplicate-name
  rejection) beats hand-rolling a near-identical one.
- osm_slab_hydrate::ensure_slab_local now: loads the catalogue (falling
  back to a single synthetic entry from OSM_BAKE_REGION/DEFAULT_REGION
  when no config.yaml exists — zero behavior change for deploys that
  never opt in), hydrates every hydrate:true entry (hydrate:false stays
  declared-but-not-pulled, never fetched), and publishes the resolved
  catalogue for the new endpoint. OSM_BAKE_REGION, when set, still wins
  outright as the active region even if absent from the catalogue or
  declared hydrate:false there — the pre-existing escape hatch is
  unchanged, including bake_region()'s validate-or-fall-back-to-default
  behavior on an invalid value.
- Region-name validation ([a-z0-9-], <=64 bytes — guards the S3 key/path
  join against traversal) now applies to every catalogue-sourced name too,
  not only the env-var path.
- New GET /api/osm/regions: the map-menu data source (name, hydrated,
  active per region). Read-only discovery — this deployment still serves
  exactly one active region at a time (open_slab()'s mmap is
  process-global); switching which one is active still needs the operator
  to flip hydrate:true (or set OSM_BAKE_REGION) and restart. That is a
  narrower claim than "hot-swap without restart," which this change does
  not attempt.

Test plan:
- 12 new unit tests in osm_region_catalogue.rs (TDD): parse_catalogue_yaml
  projects name/hydrate correctly, keeps hydrate:false entries (does not
  drop or promote them), rejects malformed YAML, propagates the shared
  parser's own duplicate-name validation; pick_active prefers the env
  override even when absent from the catalogue or over a hydrate:true
  entry, falls back to the first hydrate:true entry, returns None on an
  all-false catalogue with no override (paired negative case); the
  publish/snapshot OnceLock round-trips and a second publish is a silent
  no-op rather than a panic.
- cargo check -p cockpit-server --bin q2-cockpit --tests: clean, 0 errors,
  0 new warnings (34 pre-existing baseline warnings unchanged).
- cargo test/nextest for this crate could not be run to completion in
  this session: the q2-cockpit test binary transitively links nearly the
  entire q2 workspace (lance/arrow/datafusion/geo/aws-sdk/opendal/
  tree-sitter/wasmtime/mlua/...), and the final link step exceeded this
  container's disk allowance on repeated attempts (ENOSPC, then a linker
  SIGBUS), even immediately after a full target/ clean. This is the same
  environment limitation documented on q2#141 for the same binary,
  unrelated to this change. Reported honestly: type/borrow-check-verified,
  not executed-test-verified.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMeiLmtDKhomJNSo2ecbJw
@cursor

cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_0a0f2d0a-3ee9-4233-860c-8841fff1b287)

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b0156b20-0c76-44c9-8aad-ead46732c579


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review August 18, 2026 06:46
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@AdaWorldAPI
AdaWorldAPI merged commit bfe4cf2 into main Aug 18, 2026
5 checks passed
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.

2 participants