Skip to content

Decouple OSA from the personal Cloudflare account - #620

Merged
neuromechanist merged 7 commits into
developfrom
feature/cf-decouple-account
Oct 27, 2026
Merged

neuromechanist merged 7 commits into
developfrom
feature/cf-decouple-account

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Closes #619

Prepares the move of OSA's Cloudflare resources to the SCCN account. After this, the account is no longer pinned in code. A move still has per-account steps, now listed under "Moving to Another Cloudflare Account" in .context/deployment-checklist.md:

  • the account secrets
  • the RATE_LIMITER_KV namespace ids in wrangler.toml
  • the worker secrets, from Infisical project osc, /osa/edge
  • the Pages name variables
  • the dashboard's CORS origin
  • LEGACY_WORKERS_DEV_HOST

Changes

  • wrangler.toml no longer pins account_id; both worker deploy steps pass CLOUDFLARE_ACCOUNT_ID (org secret; confirmed populated, it is masked in the Pages deploy log).
  • The Pages CNAME targets and the dashboard preview link read the projects' pages.dev names from repository variables PAGES_DEMO_HOST, PAGES_NOTEBOOK_HOST, PAGES_DASH_HOST, defaulting to today's names. In another account a project whose name is taken gets <name>-<suffix>.pages.dev.
  • The demo redirect, the widget's endpoint resolution, and the dashboard's API base accept the suffixed pages.dev names and their branch previews.
  • The dashboard's new origin also needs backend CORS. That goes through CORS_ORIGINS at move time, never a wider osa-dash-*.pages.dev wildcard, which any Cloudflare user could claim. This is documented beside PAGES_DASH_HOST, in the dashboard, and in the checklist.
  • test-routing.js uses a placeholder workers.dev host; widget-route-health.yml reads the legacy host from LEGACY_WORKERS_DEV_HOST.

Deliberate deviation

The legacy workers.dev probe is kept, not removed: nemarOrg/website#343 is still open, so cached, SRI-pinned widget builds may still call that host. At move time, set LEGACY_WORKERS_DEV_HOST to the new name, or to none once #343 closes.

Not changed

The legacy osa-demo.pages.dev entries in the backend and worker CORS allowlists and the notebook frame-ancestors stay; those hosts redirect to the custom domains.

Testing

  • bun frontend/test-endpoint-resolution.js: 17 passed (new cases for suffixed names and look-alikes)
  • bun workers/osa-worker/test-routing.js: 147 passed
  • bun workers/osa-worker/test-mounted-hosts.js: 18 passed
  • bun frontend/test-streaming.js: 135 passed
  • wrangler.toml parses as TOML; edited workflows parse as YAML (actionlint not available locally)
  • Sonnet review: no blockers; all findings addressed (CORS origin documentation, wording, checklist)

Merging to develop triggers a dev worker deploy (wrangler.toml changed); it should be a no-op apart from the account now coming from the secret.

Drop the hard-coded account_id from wrangler.toml and pass the org secret
to both worker deploy steps, so moving accounts is a secret change (#619).
Verified the secret is populated in CI (masked in the Pages deploy log).
PAGES_DEMO_HOST, PAGES_NOTEBOOK_HOST and PAGES_DASH_HOST default to today's
names; a project created in another account gets a suffixed name (#619).
YAML parses; behaviour unchanged while the variables are unset.
The demo redirect, widget endpoint and dashboard API base accept
osa-demo-<suffix>.pages.dev / osa-dash-<suffix>.pages.dev and their branch
previews (#619). test-endpoint-resolution.js: 17 passed.
test-routing.js uses a placeholder host; the health probe reads the legacy
host from LEGACY_WORKERS_DEV_HOST ("none" disables it once
nemarOrg/website#343 closes) (#619). test-routing.js: 147 passed.
@neuromechanist neuromechanist added the operations Operations, monitoring, and observability label Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Dashboard Preview

Name Link
Preview URL https://feature-cf-decouple-account.osa-dash.pages.dev
Branch feature/cf-decouple-account
Commit 7158c84

This preview will be updated automatically when you push new commits.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://feature-cf-decouple-account-demo.osc.earth
Branch feature/cf-decouple-account
Commit 7158c84

This preview will be updated automatically when you push new commits.

Review fixes (#619): the account is no longer pinned in code, but the
RATE_LIMITER_KV ids, the worker secrets (Infisical osc /osa/edge), the
dashboard's CORS origin (CORS_ORIGINS, not a wider wildcard) and
LEGACY_WORKERS_DEV_HOST are per-account steps, now in the deployment
checklist. Tests: endpoint 17, routing 147, mounted-hosts 18 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

The step now reads PAGES_NOTEBOOK_HOST from its env block, which the test
ran without under set -u. Resolve each vars.X || 'default' to its default,
as GitHub does with the variable unset, and check pages_target too.
Tested: tests/test_scripts/test_build_notebook_site.py, 58 passed.

Refs #619
@neuromechanist
neuromechanist merged commit 4d0cd62 into develop Oct 27, 2026
10 checks passed
@neuromechanist
neuromechanist deleted the feature/cf-decouple-account branch October 27, 2026 01:19
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