## Why
`artcraft-dashboard` was documented (and configured) with the shared
Cloudflare
commands:
| Setting | Value |
|----------------|-----------------------------------|
| Build command | `npm run build` |
| Deploy command | `npm run deploy` |
| Build variable | `ARTCRAFT_APP=artcraft-dashboard` |
Both scripts fall back to `ARTCRAFT_APP=artcraft-website`, so a
dashboard deploy
that was missing the build variable did two wrong things:
- the build ran the website's static export, including
`signLauncherCatalog()`, so the deployment failed without
`LAUNCHER_CATALOG_SIGNING_KEY`;
- the deploy handed Wrangler the **root** config instead of the
dashboard's:
```
✘ [ERROR] The directory specified by the "assets.directory" field in your
configuration file does not exist:
/opt/buildhome/repo/frontend/apps/artcraft-website-next/out
```
## What changed
- The dashboard README now configures the Worker with `npm run
build:dashboard`
and `npm run deploy:dashboard`. Those npm scripts set
`ARTCRAFT_APP=artcraft-dashboard` inline and pass
`frontend/apps/artcraft-dashboard/wrangler.jsonc` to Wrangler, so the
Worker
needs no build variable at all beyond `NODE_VERSION=22`.
- Added a "Build secrets" section stating the dashboard reads neither
`LAUNCHER_CATALOG_SIGNING_KEY` nor `LINUX_SIGNING_KEY`, and that plain
`npm run build` / `npm run deploy` must not be used for this Worker.
- The root README table now lists the per-app build/deploy commands
instead of an
`ARTCRAFT_APP` column, and documents the same trap.
- `cloudflare_app.sh` header comment updated to match.
- Added the missing `deploy:website` script so all three apps have a
symmetric
`build:<app>` / `deploy:<app>` pair.
No build logic changed: `artcraft-dashboard` never referenced the
signing keys
before this PR either. The change removes the misconfiguration path that
made
them appear to be required.
## Verification
- `env -u LAUNCHER_CATALOG_SIGNING_KEY -u LINUX_SIGNING_KEY pnpm install
--frozen-lockfile && pnpm build`
in `frontend/apps/artcraft-dashboard` — exit 0, `dist/` produced without
`_redirects`.
- `wrangler deploy --dry-run --config
frontend/apps/artcraft-dashboard/wrangler.jsonc`
— reads 5 files from `dist/`, binds `env.ASSETS`, clean exit.
- `node -e require('./package.json')` parses; `bash -n` on
`cloudflare_app.sh` and
`build_cloudflare.sh` passes.
## After merge
In the Cloudflare `artcraft-dashboard` Worker, set build command
`npm run build:dashboard`, deploy command `npm run deploy:dashboard`,
and drop
the `ARTCRAFT_APP` build variable. Keep `NODE_VERSION=22`. No signing
secret
needs to be added to this Worker.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Documentation**
* Clarified the app-specific Cloudflare build and deployment commands
for the website, webapp, and dashboard, including that the bare commands
default to the website and require `ARTCRAFT_APP` to select another app.
* Added dashboard Workers Builds guidance, including its Node.js version
requirement and app-specific Wrangler configuration.
* Clarified that only the website build uses signing credentials and its
launcher assets, and warned against deploying the dashboard with the
default Wrangler command.
* **Deployment**
* Added a dedicated command for deploying the website.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Problem
The admin dashboard is deployed only to Netlify
(`artcraft-dashboard.netlify.app`), while the rest of the frontends
deploy to Cloudflare from this repository. Move it to Cloudflare and
serve it at `dashboard.artcraft.team`.
## Change
- **`frontend/apps/artcraft-dashboard/wrangler.jsonc`** —
`artcraft-dashboard` static-assets Worker: SPA `not_found_handling`,
`run_worker_first: ["/api/*"]`, custom domain `dashboard.artcraft.team`.
- **`cloudflare_worker/index.ts`** — same-origin `/api/*` proxy to
`https://api.storyteller.ai`. The dashboard calls the API with
`credentials: "include"`, so its session cookie has to stay first-party;
`api.storyteller.ai` is a different site than `dashboard.artcraft.team`,
so a direct cross-site call would have the cookie dropped by browsers.
This replaces Netlify's `/api/*` rewrite.
- **`script/website/cloudflare_app.sh` + root `package.json`** —
`ARTCRAFT_APP=artcraft-dashboard`, plus `npm run build:dashboard` / `npm
run deploy:dashboard`.
- **`_redirects`** moved from `public/` to the app root and copied into
`dist/` by `netlify_build.sh`, so the Cloudflare upload never contains
the `/* /index.html 200` loop or the external-host proxy that Workers
reject. Netlify keeps working unchanged as the rollback target.
- **CORS** — `https://dashboard.artcraft.team` allowlisted in
`artcraft_admin_dashboard.rs`, the regression table, and the production
product-origin test.
- **`tsconfig.app.json`** — excludes spec files. `DebugLogCard.spec.ts`
imports `vitest`, which only resolved through the parent workspace's
`node_modules`; the standalone Cloudflare build never installs those, so
`tsc -b` failed.
- Docs: dashboard README (deploy, proxy rationale, rollback) and the
root README Worker table.
## Cloudflare settings
| Setting | Value |
|----------------|-----------------------------------|
| Build command | `npm run build` |
| Deploy command | `npm run deploy` |
| Build variable | `ARTCRAFT_APP=artcraft-dashboard` |
| Build variable | `NODE_VERSION=22` |
`VITE_API_HOST` is deliberately not set: the dashboard keeps calling
`/api`, and the Worker proxies it.
## Checklist before cutover
- [ ] `artcraft.team` is a zone in the Cloudflare account (Workers
custom domains require the zone).
- [ ] `artcraft-dashboard` Worker created from this repo with the
settings above.
- [ ] Domain attached; log in and confirm the session works at
`https://dashboard.artcraft.team`. A `*.workers.dev` URL is not
CORS-allowlisted, so test through the domain (or add the test host to
the CORS config first).
- [ ] Netlify site kept for rollback; reverting is pointing the domain
back at it.
## Testing
- `cargo test -p actix_cors_configs` — 81 passed, including the new
`dashboard_domain` case and the allowlist regression table.
- `pnpm install --frozen-lockfile && pnpm build` in
`frontend/apps/artcraft-dashboard` — succeeds (9014 modules); `dist/`
has no `_redirects`.
- `wrangler deploy --dry-run --config
frontend/apps/artcraft-dashboard/wrangler.jsonc` — clean: 5 assets,
`env.ASSETS` binding, no config warnings.
- Not run: an actual deploy, since there are no Cloudflare credentials
or account access in this environment.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **New Features**
* The ArtCraft Admin Dashboard is now available at
`dashboard.artcraft.team`, with dashboard API requests routed through
the new deployment.
* The dashboard’s production origin is now allowed for cross-origin
requests.
* **Documentation**
* Added deployment and build guidance for the dashboard, including its
Cloudflare hosting and API routing details.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Problem
app.getartcraft.com serves `Hello world`. Its `artcraft-webapp` Worker
builds this repository with `npm run build`, which always built
**artcraft-website-next** and failed on the website's
`LAUNCHER_CATALOG_SIGNING_KEY`. The Worker never got a successful
deploy, so it kept its placeholder.
## Change
- `npm run build` / `npm run deploy` choose the app from the
`ARTCRAFT_APP` build variable via `script/website/cloudflare_app.sh`.
The default, `artcraft-website`, is the old behaviour, so the website
Worker needs no changes.
- `ARTCRAFT_APP=artcraft-webapp` builds only the Nx webapp. It needs
**no signing keys**.
- `frontend/apps/artcraft-webapp/wrangler.jsonc` is now a static-assets
Worker (`artcraft-webapp`). It uses SPA `not_found_handling` and the
`app.getartcraft.com` custom domain, replacing the unused Pages
`app-new` config.
- The Cloudflare `public/_redirects` no longer has the `/* /index.html
200` fallback, since Workers assets reject it as a loop. Netlify's
`_redirects` is untouched.
- `nx build --skipSync` plus the `nx sync` output for
pagedraw/pagescene. Nx refused to build in CI without those references,
and that also fails on current `main`.
## Cloudflare settings for the artcraft-webapp Worker
| Setting | Value |
|----------------|-----------------------------------------|
| Build command | `npm run build` |
| Deploy command | `npm run deploy` |
| Build variable | `ARTCRAFT_APP=artcraft-webapp` |
| Build variable | `VITE_GOOGLE_CLIENT_ID` (as on Netlify) |
## Testing
- `ARTCRAFT_APP=artcraft-webapp CI=true npm run build` with no signing
keys in the environment: succeeds, 239 files, none over 25 MiB.
- `wrangler deploy --config frontend/apps/artcraft-webapp/wrangler.jsonc
--dry-run`: clean, no `_redirects` warnings.
- An unknown `ARTCRAFT_APP` exits 1 with usage.
- Not run: the website build path, which is the unchanged command moved
into the script.
## What was wrong
`script/database/copy_user_account.py` moves an account's email and
password onto another account and says it ends the source account's
sessions. The revocation `UPDATE` had `LIMIT 10` and also matched
sessions that were already deleted. If the source account had more than
ten session rows, some live sessions could survive the transfer and keep
working, because session lookups accept any row with `deleted_at IS
NULL` and `expires_at > NOW()`.
## What changed
- The revocation `UPDATE` has no row limit and only targets live
sessions (`deleted_at IS NULL`), so the timestamps on rows that were
already deleted stay as they were.
- After the update, the script counts the source's remaining live
sessions inside the same transaction. If any are left, it raises, and
the existing handler rolls back.
- The confirmation preview counts live sessions, and the docstring lists
the revocation step.
## Blast radius
This only affects the oncall script that an operator runs by hand. No
service code changed. Session lookups do not use a cache
(`crates/lib/actix_artcraft/src/sessions` reads MySQL directly), so
nothing else needs invalidating.
## Checks
- Run: `python3 -m py_compile script/database/copy_user_account.py`
- Not run: running the script against a database (it needs a live MySQL
and secrets.toml).
Addresses CodeRabbit security findings (CWE-613).
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Bug Fixes**
* Account-copy operations now stop and roll back if any live source
sessions remain, rather than committing an incomplete transfer.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
- **shell:S7688 (43)**: `[[ ]]` in place of `[ ]` in
`script/metrics/apply_{dashboards,metric_configs,monitors}.sh`,
`script/common/frontend_preflight.sh` and
`script/website/unix_frontend_dashboard_dev.sh`. Every script has a bash
shebang and `bash -n` passes. No test uses `-a`/`-o`, escaped
parentheses or an unquoted pattern on the right of `=`. The numeric
operands are `$#`, internal flags, exit codes, a parsed Node major
version and curl's status code, so `[[ ]]`'s arithmetic reading changes
nothing.
- **shell:S6505 (4)**: `npm install --ignore-scripts` in
`frontend_preflight.sh`, `unix_frontend_webapp_dev.sh` and
`frontend/build_modules.sh`. The frontend has no install scripts of its
own, and this repo's CI already builds with `npm ci --ignore-scripts`.
Same change as storytold/artcraft#2818.
- **Scope**: `_docs/old/**` joins `sonar.exclusions`. It's the retired
local-dev setup (an old Dockerfile, `kubernetes.yml`, nginx config) that
nothing references, and it held the docker and kubernetes findings under
`_docs/old/old_localdev_setup`.
Same as the other PRs here: not merged without the owner's go-ahead
(production service).
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Chores**
* Frontend dependency installation now skips package-provided lifecycle
scripts, including during development setup. This changes which scripts
run during installation but does not change the frontend’s intended
features or behavior.
* Updated internal checks used by dashboard, metric, and monitor scripts
without changing their conditions or outcomes.
* Expanded static-analysis exclusions to include archived documentation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Resolves the bundled-asset and script security findings SonarCloud
reports outside vendored code.
- **Web:S5725** `frontend/api_docs.html` — Swagger UI was loaded over
protocol-relative `//unpkg.com` URLs with no integrity check. Now
`https://` plus `integrity`/`crossorigin` on all three assets.
- **shell:S6505** the three remaining `npx` calls in Netlify/dev scripts
now pass `--no-install`, so they run the pinned local binary instead of
downloading and running one.
- **secrets:S6418** removed the long-dead MinIO access/secret key pair
commented out in the deprecated inference-job env file.
- **python:S4790** the Gravatar hash is an MD5 identifier required by
Gravatar's URL scheme, so it is marked `usedforsecurity=False`.
Verified: file contents diffed against the previous URLs; no
build-affecting script semantics changed (`--no-install` only rejects
on-demand downloads).
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Bug Fixes**
* API documentation resources now load over HTTPS with integrity
verification.
* Account-copying operations preserve their existing output while
supporting environments that restrict security-related hashing.
* **Chores**
* Build and cleanup commands use locally available tooling and continue
cleanup if the reset command fails.
* Removed commented-out credential settings from the development
configuration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
We need to remove irrelevant FakeYou records that do not impact the
ArtCraft product
- 87M irrelevant media file records (no relation to ArtCraft)
- 105M jobs records (which we purge occasionally anyway)
- lots of other files: audit logs, old/irrelevant stripe event logs,
feed data, etc. etc.
Two reasons for this:
- super brittle when pinned to non-main commit
e1a70095c4409478c1ded499fb8dd4afa540fb90
- I was recently stuck on a flight without good wifi and setting up a
new devenv. Cargo was totally unable to download the remote github
dependency, but was fine downloading the entire artcraft repo. Seems bad
to link to other repos that Cargo can't quickly pull on low bandwidth.
We'll need to slim this down later and eventually get back on main
branch.