Skip to content

Claude/cloudflare deployment plan lumow6 - #33

Merged
AlexKempen merged 16 commits into
certfrom
claude/cloudflare-deployment-plan-lumow6
Jul 24, 2026
Merged

Claude/cloudflare deployment plan lumow6#33
AlexKempen merged 16 commits into
certfrom
claude/cloudflare-deployment-plan-lumow6

Conversation

@AlexKempen

Copy link
Copy Markdown
Collaborator

Fix deployment issues

claude and others added 16 commits July 23, 2026 15:05
Introduce named Wrangler environments and a CI-gated deploy workflow so
pushes to `cert` deploy the cert Worker and (in the future) pushes to
`main` deploy a separate production Worker.

- wrangler.jsonc: top-level config is now the local "dev" environment
  (drops the unused `database_id`, since local dev runs with `--local`).
  Add `env.cert` (Worker `frc-design-app-cert`, reuses the existing remote
  D1/KV/R2) and `env.production` (Worker `frc-design-app-production`, with
  placeholder resource IDs to be filled in once prod resources exist).
- onshape-api.ts: hardcode the Onshape API base path and version as
  constants (identical across environments) instead of repeating them as
  per-environment vars. Only `ADMIN_TEAM` remains a var.
- deploy.yml: new workflow. Runs tsc/lint/test, then deploys the matching
  environment via cloudflare/wrangler-action. The Vite plugin selects the
  target env at build time via CLOUDFLARE_ENV; migrations run with `--env`.
  Production runs in a protected GitHub Environment and is dormant until a
  `main` branch exists.
- ci.yml: drop the redundant push-to-cert trigger (now covered by deploy).
- vite.config.ts: only enable the HTTPS dev server when the mkcert files
  exist, so `vite build` works in CI where they are absent.
- package.json: replace `deploy` with `deploy:cert` / `deploy:production`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EdsRyJRctf2K3v73QdtgGo
Onshape access tokens are company-scoped, but the app previously ignored the
`sessionCompanyId` the Onshape iframe passes on `/init`, so a user who
authorized in one context could end up with a token scoped to the wrong
company (or personal) when opening another company's document.

- isAuthenticated now fetches session info (which also serves as the auth
  ping) and compares the token's company (`sessioninfo.company.id`, null =
  personal "cad") against the request's `sessionCompanyId`. On a mismatch it
  returns false, so `/init` restarts the sign-in flow.
- Every token request now passes `company_id` to the OAuth token endpoint via
  a `companyTokenEndpoint` helper — for both the authorization-code exchange
  in doCallback and refreshes in getOnshapeApiForSessionId — so the minted
  token is company-scoped.
- The requested company is captured at sign-in (from the request or the
  `/init` redirectUrl) into the login session, and persisted onto the stored
  tokens so refreshes keep the scope.
- Type getSessionInfo with a SessionInfo interface exposing `company.id`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EdsRyJRctf2K3v73QdtgGo
@AlexKempen
AlexKempen merged commit b5e9717 into cert Jul 24, 2026
1 check 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