Skip to content

Mount the OSA worker on edge.osc.earth - #622

Merged
neuromechanist merged 3 commits into
developfrom
feature/edge-osc-earth
Oct 27, 2026
Merged

neuromechanist merged 3 commits into
developfrom
feature/edge-osc-earth

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Closes #621

Adopts the <role>.<domain>/<project> convention for the browser-facing worker: production at edge.osc.earth/osa, dev at edge.osc.earth/osa-dev. api.osc.earth/osa stays the backend for key-authenticated clients.

Changes

  • wrangler.toml: the An OSA address without its trailing slash fails: widget.osc.earth/osa is 522 #500 route pair on edge.osc.earth for both environments (/osa/* and /osa*; dev /osa-dev/* and /osa-dev*), with the convention documented beside the routes. The DNS record edge.osc.earth AAAA 100:: (proxied) already exists.
  • index.js: mountPrefixFor(hostname, env) returns the mount prefix per host. The dev worker is mounted at /osa-dev on the shared edge host; everything else stays at /osa. The bare-path redirect, the outside-mount 404 and the strip all use it. If the dev routes are ever missing, production answers /osa-dev/... with 404 instead of serving it.
  • widget.osc.earth/osa and develop-widget.osc.earth/osa stay as aliases, and the widget's default endpoint is unchanged, because other sites allowlist that host.
  • widget-route-health.yml probes the edge host. The job name and the "likely causes" list cover it, including detached dev edge routes (production answers /osa-dev/health with 404). Scheduled runs use main, so the probes go live in the same release that deploys the production edge routes.

Rollout

  • Merging to develop deploys the dev worker with its /osa-dev routes.
  • The production edge routes ship with the next release.
  • Cloudflare picks the more specific /osa-dev* route over production's /osa*.

Testing

  • bun workers/osa-worker/test-routing.js: 158 passed (new: edge host in both environments, bare-path redirect with query, outside-mount 404, forwarded path for /osa-dev/hed/chat)
  • bun workers/osa-worker/test-mounted-hosts.js: 37 passed. It checks each route's prefix against its own wrangler environment and requires the edge host in both environments by name.
  • Mutation checks on test-mounted-hosts.js: deleting the dev edge routes fails 2 assertions (it passed before the review fix); a dev edge route pointed at /osa/* fails 2.
  • bun frontend/test-endpoint-resolution.js: passed
  • wrangler.toml parses as TOML; workflow parses as YAML
  • Sonnet review: no blockers; all findings addressed

This touches wrangler.toml and widget-route-health.yml, as does #620; the two branches merge cleanly (git merge-tree).

Adds the edge.<domain>/<project> routes for both environments, keeping the
#500 route pair, and strips /osa-dev for the dev worker on the shared edge
host (mountPrefixFor). widget.osc.earth stays as an alias (#621).
test-routing.js: 158 passed; test-mounted-hosts.js: 33 passed and catches a
dev edge route mounted at the wrong prefix.
The schedule runs from main, so the probes go live with the release that
deploys the production edge routes (#621). YAML parses.
@neuromechanist neuromechanist added the operations Operations, monitoring, and observability label Oct 27, 2026
Review fixes (#621): test-mounted-hosts.js asserts edge.osc.earth is routed
in production and dev by name, so deleting the dev edge routes now fails
(verified: 2 failures; it passed before). The health job name and likely
causes cover the edge host. Tests: mounted-hosts 37, routing 158 passed.
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Worker Deployment Required

Worker changes detected. After merging to main or develop, the workflow will automatically deploy the worker.

Manual deployment (if needed):

cd workers/osa-worker
wrangler deploy --env dev  # for develop branch
wrangler deploy            # for main branch

@neuromechanist
neuromechanist merged commit c4e1010 into develop Oct 27, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the feature/edge-osc-earth branch October 27, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

operations Operations, monitoring, and observability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant