Skip to content

CHORE: Prepare hosted operations and remote development - #39

Open
bmdavis419 wants to merge 9 commits into
review/hosted-09-billingfrom
review/hosted-10-ops
Open

CHORE: Prepare hosted operations and remote development#39
bmdavis419 wants to merge 9 commits into
review/hosted-09-billingfrom
review/hosted-10-ops

Conversation

@bmdavis419

@bmdavis419 bmdavis419 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Fix authentication on remote HTTP development origins and align operations with the hosted stack. Cookies use origin-appropriate names and deletion options, device approval survives sign-in, and Vite accepts only explicitly allowed development hosts. Uploads and notifications use secure random ephemeral IDs available on HTTP origins.

Launch, restore, observability, and deployment skills now describe the hosted services. Recovering historical site publications requires a matching earlier database snapshot and retained object bytes; synthetic version markers cannot reconstruct historical paths.

Validation:

  • Initial full root suites passed, including 204 route/Postgres cases; 11 focused cookie/device cases passed after fixes.
  • Installed SvelteKit serialization covers HTTP/HTTPS state, session, refresh, CSRF, device continuation, and deletion.
  • Native Chromium on a remote HTTP origin verified sign-in, sign-out, uploads, and notifications without runtime errors. An untrusted Vite host returned 403. These checks used local development providers.
  • TypeScript, Effect, Svelte, formatting, deployment-skill validation, Worker build, and focused upload/toast tests passed.
  • Independent operations/auth reviews completed; second broad Codex review and targeted follow-up reviews were clean.

Stack layer 10/11: depends on #38; followed by #40. Live WorkOS, DNS/TLS, provider alerts, paid sandbox flows, and restore drills remain launch checks. No merge or deployment.

Note

Make WorkOS session cookies origin-aware and prepare hosted operations docs

  • Replaces hardcoded HTTPS session and state cookie names with origin-derived values from DASHBOARD_ORIGIN across sign-in, callback, sign-out, session refresh, and request auth in hooks.server.ts, request-auth.ts, and the auth routes
  • Adds createClientId in client-id.ts using crypto.getRandomValues so toast and upload managers work in HTTP contexts where randomUUID is unavailable; updates toast.svelte.ts and uploads.svelte.ts
  • Rewrites deployment and verification skills (deploy-fresh-instance, verify-deployment) and operational docs (backup-restore, launch-checklist, observability, release) for hosted multi-tenant Postgres/Hyperdrive/R2/WorkOS
  • Updates README.md and .dev.vars.example to document Postgres via Hyperdrive, local DATABASE_URL overrides, and HTTP-vs-HTTPS cookie behavior
  • Adds comprehensive auth-cookie test coverage in auth-cookies.test.ts with HTTP/HTTPS parameterization, and aligns shared test helpers in helpers.ts to use origin-specific cookie names
  • Behavioral Change: all auth cookie names and Secure attributes are now derived from DASHBOARD_ORIGIN; local HTTP development uses non-secure cookie variants while HTTPS origins use secure ones. Reviewers should verify that every environment's DASHBOARD_ORIGIN is set correctly, since a misconfigured origin will cause cookie name mismatches and lost sessions.

Macroscope summarized 5746003.

RetriggerConfidence Score: 5/5

Safe to merge.

Summary

  • Makes WorkOS cookie names and security attributes appropriate for the configured HTTP or HTTPS dashboard origin.
  • Preserves device authorization through sign-in and adds focused cookie coverage.
  • Replaces secure-context-only UI identifiers so uploads and notifications work over remote HTTP development.
  • Updates hosted deployment, verification, backup, restore, release, and observability guidance.
  • Adds migration serialization and safeguards destructive route tests by restricting them to reserved test databases.
  • Uses stored owner details for billing-customer creation and safely retries deferred provider setup.
  • Reduces dead-letter queue batch sizes to retain request-envelope headroom.

Reviews (2) · Last reviewed commit: "Document the recoverable history of site..."

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

On-demand reviews are free for the next 9 days. After that, they cost $0.25 per reviewed file.

Or wait 33 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 6 included reviews currently available. Your 49 included PR review attempts over the past 7 days set your current allowance at 6 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 36dbb3a1-4c94-4949-8f37-3a1e1253a586

📥 Commits

Reviewing files that changed from the base of the PR and between 9df460d and 5746003.

📒 Files selected for processing (26)
  • .agents/skills/deploy-fresh-instance/SKILL.md
  • .agents/skills/verify-deployment/SKILL.md
  • README.md
  • apps/web/.dev.vars.example
  • apps/web/src/hooks.server.ts
  • apps/web/src/lib/dashboard/client-id.ts
  • apps/web/src/lib/dashboard/toast.svelte.test.ts
  • apps/web/src/lib/dashboard/toast.svelte.ts
  • apps/web/src/lib/dashboard/uploads.svelte.test.ts
  • apps/web/src/lib/dashboard/uploads.svelte.ts
  • apps/web/src/lib/server/auth-policy.ts
  • apps/web/src/lib/server/request-auth.ts
  • apps/web/src/lib/server/routes/abuse.test.ts
  • apps/web/src/lib/server/routes/auth-cookies.test.ts
  • apps/web/src/lib/server/routes/device-sign-in.test.ts
  • apps/web/src/lib/server/routes/routes.test.ts
  • apps/web/src/lib/server/test/helpers.ts
  • apps/web/src/routes/auth/callback/+server.ts
  • apps/web/src/routes/auth/sign-in/+server.ts
  • apps/web/src/routes/auth/sign-out/+server.ts
  • docs/backup-restore.md
  • docs/launch-checklist.md
  • docs/observability.md
  • docs/plans/hosted-product-status.md
  • docs/release.md
  • scripts/backup/install-backup-host.sh

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

@bmdavis419
bmdavis419 added this pull request to stack #41 September 11, 2026 04:32
Comment thread docs/launch-checklist.md Outdated
Comment thread docs/launch-checklist.md Outdated
- Hotlink protection off (public file links are the product).
- Universal SSL with the wildcard, so `*.<content domain>` is covered
when per-tenant hostnames land.
- Notifications: the two alerts in `docs/observability.md` (DLQ depth,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium docs/launch-checklist.md:33

The launch gate cannot configure or verify the required DLQ-depth and 5xx-rate alerts because it points operators to docs/observability.md, which is absent from the repository. Add that document with the alert thresholds and destinations, or update the checklist to reference the document that contains them.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @docs/launch-checklist.md around line 33:

The launch gate cannot configure or verify the required DLQ-depth and 5xx-rate alerts because it points operators to `docs/observability.md`, which is absent from the repository. Add that document with the alert thresholds and destinations, or update the checklist to reference the document that contains them.

Comment thread apps/web/vite.config.ts Outdated
server: {
// The dev server binds 0.0.0.0 so other devices can reach it; allow
// any hostname since the app's own host gate enforces the origins.
allowedHosts: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High web/vite.config.ts:12

server.allowedHosts: true disables Vite's host allowlist, so a DNS-rebound hostname can reach the 0.0.0.0 dev server and retrieve source/content before SvelteKit's host-gate runs. Replace this with an explicit allowlist of the development hostnames (or remove the override to use Vite's defaults).

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/vite.config.ts around line 12:

`server.allowedHosts: true` disables Vite's host allowlist, so a DNS-rebound hostname can reach the `0.0.0.0` dev server and retrieve source/content before SvelteKit's `host-gate` runs. Replace this with an explicit allowlist of the development hostnames (or remove the override to use Vite's defaults).

Comment thread docs/backup-restore.md Outdated
names.session,
resolved.refreshedSession,
sessionCookieOptions
sessionCookieOptions(names.secure)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical src/hooks.server.ts:74

For an HTTP DASHBOARD_ORIGIN, the refresh path sets the authenticated session without the Secure attribute, so browsers transmit the bearer cookie over cleartext on every subsequent request. HttpOnly and SameSite do not prevent network interception or replay; enforce HTTPS for the dashboard origin and reject HTTP rather than issuing this session cookie.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/hooks.server.ts around line 74:

For an HTTP `DASHBOARD_ORIGIN`, the refresh path sets the authenticated session without the `Secure` attribute, so browsers transmit the bearer cookie over cleartext on every subsequent request. `HttpOnly` and `SameSite` do not prevent network interception or replay; enforce HTTPS for the dashboard origin and reject HTTP rather than issuing this session cookie.

Comment thread docs/backup-restore.md Outdated
bmdavis419 and others added 9 commits September 11, 2026 01:47
PlanetScale's automatic backups are the primary copy, the home-host
pg_dump the independent one, and R2 gets object versioning or a second
bucket. The backup host installer now checks for pg_dump beside rclone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Public pages, abuse and DMCA contacts, content-zone settings, the
secrets that must exist before the first deploy, and the verification
skill as the final gate. release.md links to it from first-time setup
and the README intro now describes the hosted direction while keeping
the self-hosting instructions.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Browsers refuse Secure cookies on http origins other than localhost, so
signing in from a LAN or Tailscale hostname in development silently lost
the session. The cookie names and Secure flag now follow the dashboard
origin's scheme.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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