Public-repo hosted Hub lifecycle E2E (nightly)
Stripe test lifecycle (npm run test:lifecycle) runs on ubuntu-latest in marklovely/lovely-hub-provision, checking out private home-dashboard at main (or a manual checkout_ref). Provisioning still flows through platform-sandbox and hub-jobs (public provision dispatch when configured).
Branch on sandbox first (#1110). Before the lifecycle jobs, Deploy ref to sandbox deploys checkout_ref to marketing-sandbox and platform-sandbox (scripts/deploy-sandbox-lovely-home.sh, the same script as the private Deploy sandbox Lovely Home workflow). The run then tests that PR's website and platform code, not whatever was deployed by hand last. Lifecycle jobs run only after a successful deploy. Set deploy_sandbox: false to test the sandbox as it is. Runs queue on the hub-lifecycle-nightly group, so two branches never share the sandbox. The sandbox is left on the tested ref until the nightly run (on main) or the next regression.
One commit per run (#1135). platform-sandbox has no Git deploys: Terraform sets production_deployments_enabled = false for the sandbox stack, and deploy-sandbox-lovely-home.sh also turns them off through the API. So pushes to main, including the registry commits a run's own sign-ups make, no longer swap the code under test for main.
Its built-in list of sites is still main's:
- Every sandbox build puts
main's registry files on top of the commit under test (scripts/overlay-main-registry.sh). - After a test home's record or drop, Platform site registry rebuilds the commit platform-sandbox already serves with
main's site list (scripts/refresh-sandbox-platform.sh). Only the site entries come frommain(each site's block in the registry files); the commit keeps its own dependencies, lock files and Worker config, sonpm cistill matches (#1196). The e2e cleanup does the same. If a newer deploy has landed, the refresh fails and says so, rather than putting old code back.
Each plan checks that platform-sandbox serves the deployed commit before (Sandbox runs the commit under test) and after (Sandbox stayed on the commit under test), and fails if it doesn't. Between runs, merges to main don't change sandbox; the 2am nightly deploys main.
Test homes run the same code (#1129). The homes the run signs up (e2e-*) are built from the commit platform-sandbox serves, so a branch regression also tests the branch's hub Worker, D1 migrations and hub app. The public provision workflow decides this in its Which code builds this hub step (scripts/resolve-hub-code-ref.mjs):
- It reads the commit from the platform-sandbox Pages deployment, which #1127 tags and checks.
- It does this only when the home has a row in the sandbox billing database.
- If it can't read the commit, or the sandbox row is missing, the provision fails with the reason instead of falling back to
main.
A test home's teardown checks out the same commit, so its backup and teardown speak the same hub contract as the code that built it (#1197). Customer homes still provision and tear down from HOME_DASHBOARD_REF (or main). The provision run's notice says which commit each test home used. Production sign-up refuses e2e- ids, because only the sandbox platform (LOVELY_STACK=sandbox) accepts them.
Marketing site job (#1444). After the deploy, Marketing site (sandbox) runs npm run test:marketing-sandbox beside the plans: every marketing page, Pricing from platform-sandbox, the sign-up and sign-in forms ready to send, and one Lottie AI answer. No hub, no email, a few minutes. Its report goes to R2 under e2e-reports/{run}/marketing-site. See e2e/README.md.
Same split as public-ci-dispatch.md and public-cd-dispatch.md: heavy browser + npm work avoids the VPS self-hosted queue.
Schedule
| Trigger | Plans | Runners |
|---|---|---|
| Nightly 02:00 UTC (2am GMT / 3am BST): the production hub-jobs Worker's Cloudflare cron dispatches this workflow (#1121) | both (Free, Plus), and all on Sundays (adds multi, the two-homes Multi Home run, #1444), main, deploying the sandbox first | ubuntu-latest on public repo |
workflow_dispatch by hand | both (default), all, free, plus or multi | same |
There's no GitHub schedule: trigger any more. GitHub started the 0 2 * * * schedule about 5 hours late every night (06:54–07:14 UTC, 18–22 Oct 2026). The Cloudflare cron is exact. It's set in terraform/modules/platform_admin/hub_jobs.tf on the production stack only, so the sandbox Worker doesn't start a second run. Changing the cron needs a Platform admin Terraform apply. Plans run one after the other, and since #1112 a failing plan no longer cancels the other.
Not on pull_request — lifecycle touches Stripe, IMAP, and real sandbox hubs.
One-time setup
1. Publish workflow to public repo
After merging the home-dashboard template + sync script:
node scripts/sync-public-lifecycle-workflow.mjs --repo marklovely/lovely-hub-provision
# Or sync provision + lifecycle + CI + CD + E2E cleanup together:
node scripts/sync-all-public-orchestrator-workflows.mjs --repo marklovely/lovely-hub-provisionOr open a PR on lovely-hub-provision with .github/workflows/hub-lifecycle-dispatch.yml copied from docs/public-repo-workflow-template-lifecycle-dispatch.yml.
2. Secrets on lovely-hub-provision (public)
| Secret | Purpose |
|---|---|
HOME_DASHBOARD_REPO | marklovely/home-dashboard |
HOME_DASHBOARD_DISPATCH_TOKEN | PAT Contents: Read on private repo (same as PR CI) |
STRIPE_SECRET_KEY | Stripe test secret (sk_test_ / rk_test_) |
STRIPE_PRICE_ID | Plus price id (sandbox/test) |
E2E_PLUS_CHECKOUT_COUPON_ID | 100% test coupon for hosted Checkout |
E2E_OWNER_EMAIL | GMX base inbox (+ addressing) |
E2E_IMAP_USER | Optional; defaults to owner email |
E2E_IMAP_PASSWORD | GMX IMAP / app password |
Copy lifecycle values from home-dashboard repo secrets (test keys only):
# Example — paste values interactively or from your secret store
gh secret set STRIPE_SECRET_KEY --repo marklovely/lovely-hub-provision
gh secret set STRIPE_PRICE_ID --repo marklovely/lovely-hub-provision
gh secret set E2E_PLUS_CHECKOUT_COUPON_ID --repo marklovely/lovely-hub-provision
gh secret set E2E_OWNER_EMAIL --repo marklovely/lovely-hub-provision
gh secret set E2E_IMAP_USER --repo marklovely/lovely-hub-provision
gh secret set E2E_IMAP_PASSWORD --repo marklovely/lovely-hub-provisionHOME_DASHBOARD_REPO / HOME_DASHBOARD_DISPATCH_TOKEN should already exist if public-ci-dispatch.md is configured.
3. Smoke test (before relying on cron)
- lovely-hub-provision → Actions → Hub lifecycle dispatch → Run workflow.
- Start with
signup_plan: free, default sandbox origins. - When green, run
signup_plan: plus(orbothfor a full serial run).
4. Manual re-run
- Public repo: Actions → Hub lifecycle dispatch → Run workflow (pick plan + optional
checkout_ref). - Private repo (legacy VPS): Actions → Hub lifecycle (Stripe test) — still self-hosted until optionally replaced by a thin dispatch wrapper.
Local serial both plans:
npm run test:lifecycle:fullReading a failure
- Green but flaky. Each test retries once. If attempt 1 fails and the retry passes, the job is green and the report marks the test flaky — open the failed attempt anyway; it is usually a real timing issue.
- Free plan check. If Hub Worker should report the Free plan fails, the error ends with
Plan diagnostics: plan=… planSource=… accountPlan=…(#928):planSource=sandbox|production|configured— that platform answered; withaccountPlan=lovely_multi_*an account-level plan (Multi Home, orACCOUNT_HOME_PLAN_OVERRIDE) made the hub Plus.unknown-hub— no platform has billed the hub;lookup-failed:{platform}:{status}— the lookup failed;cache (…)— the hub used its last confirmed plan (#917). The Worker also reuses a confirmed answer for 30 seconds (#1388); the Free plan poll waits 45 seconds, so a plan confirmed just before the check still shows in time.
- Cleanup. A failed run cancels its hub's billing itself; the report shows
cleanup: Run failed — cancelled Stripe billing for e2e-…. See e2e-sandbox-cleanup.md. - Traces. Open the run's R2 report (link in the job summary). Public runs upload no GitHub artifact (#1169). Each attempt's folder has
trace.zip(npx playwright show-trace trace.zip),test-failed-1.pnganderror-context.md. The trace's network tab shows hub API writes (e.g. noPATCH /api/site/profilemeans setup never saved).
Concurrency
Workflow uses concurrency: hub-lifecycle-nightly with cancel-in-progress: false so overlapping nights or manual runs do not tear down an in-flight provision.
Related workflows
- E2E sandbox cleanup dispatch — orphan
e2e-*teardown on sandbox after failed lifecycle runs; same public repo andubuntu-latestpattern. Publish withnode scripts/sync-public-e2e-cleanup-workflow.mjs. See e2e-sandbox-cleanup.md.
Related docs
- e2e/README.md — env vars and GMX/IMAP
- hub-provision-public-actions.md — provision on public runners
- Operator checklist (store):
docs/public-hub-cd-dispatch-setup.md— PAT patterns shared with CI/CD