From 057b6d2851a4393ce193cb1064a031d93ed194ea Mon Sep 17 00:00:00 2001 From: Douwe de Vries Date: Sat, 14 Nov 2026 19:36:16 +0100 Subject: [PATCH 1/4] Deploy the tested Web release to Vercel through CI --- .github/workflows/ci.yml | 105 +++++++++++++++++- .gitignore | 2 + README.md | 36 +++++- docs/WEB_CI_RESULTS.md | 18 ++- docs/adr/0019-web-runtime.md | 3 +- docs/adr/0020-vercel-ci-deployment.md | 30 +++++ tools/prepare_vercel.py | 67 +++++++++++ tools/test_vercel_deploy.py | 74 ++++++++++++ tools/vercel_build.py | 64 +++++++++++ tools/web_tests/deployment.spec.cjs | 61 ++++++++++ tools/web_tests/package-lock.json | 3 + tools/web_tests/package.json | 1 + .../playwright.deployment.config.cjs | 18 +++ vercel.json | 23 ++++ 14 files changed, 495 insertions(+), 10 deletions(-) create mode 100644 docs/adr/0020-vercel-ci-deployment.md create mode 100644 tools/prepare_vercel.py create mode 100644 tools/test_vercel_deploy.py create mode 100644 tools/vercel_build.py create mode 100644 tools/web_tests/deployment.spec.cjs create mode 100644 tools/web_tests/playwright.deployment.config.cjs create mode 100644 vercel.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78ebc8b6..ae12c4a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ on: concurrency: group: ci-${{ github.ref }} - cancel-in-progress: true + cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: contents: read @@ -56,7 +56,7 @@ jobs: "https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/${GODOT_ZIP}" echo "$GODOT_SHA512 $RUNNER_TEMP/$GODOT_ZIP" | sha512sum --check unzip -q "$RUNNER_TEMP/$GODOT_ZIP" -d ~/godot - mv ~/godot/Godot_v${GODOT_VERSION}-stable_linux.x86_64 ~/godot/godot + mv "$HOME/godot/Godot_v${GODOT_VERSION}-stable_linux.x86_64" "$HOME/godot/godot" chmod +x ~/godot/godot - name: Run checks @@ -92,7 +92,7 @@ jobs: "https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/${GODOT_ZIP}" echo "$GODOT_SHA512 $RUNNER_TEMP/$GODOT_ZIP" | sha512sum --check unzip -q "$RUNNER_TEMP/$GODOT_ZIP" -d ~/godot - mv ~/godot/Godot_v${GODOT_VERSION}-stable_linux.x86_64 ~/godot/godot + mv "$HOME/godot/Godot_v${GODOT_VERSION}-stable_linux.x86_64" "$HOME/godot/godot" chmod +x ~/godot/godot - name: Cache Web export templates @@ -107,7 +107,9 @@ jobs: run: tools/install_godot_templates.sh - name: Verify Web tooling - run: python3 -m unittest discover -s tools -p test_web_tools.py + run: | + python3 -m unittest discover -s tools -p test_web_tools.py + python3 -m unittest discover -s tools -p test_vercel_deploy.py - name: Export browser bundles timeout-minutes: 30 @@ -122,6 +124,7 @@ jobs: uses: actions/upload-artifact@v6 with: name: farlanding-web-${{ github.sha }} + overwrite: true path: | build/web/ tools/serve_web.py @@ -131,7 +134,7 @@ jobs: - uses: actions/setup-node@v6 with: - node-version: 24 + node-version: 26 cache: npm cache-dependency-path: tools/web_tests/package-lock.json @@ -167,9 +170,101 @@ jobs: uses: actions/upload-artifact@v6 with: name: farlanding-web-evidence-${{ github.sha }} + overwrite: true path: | build/logs/ tools/web_tests/test-results/ tools/web_tests/playwright-report/ if-no-files-found: warn retention-days: 14 + + deploy-production: + name: Deploy production + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + needs: [web] + runs-on: ubuntu-latest + timeout-minutes: 25 + permissions: + contents: read + actions: read + environment: + name: production + url: ${{ vars.VERCEL_PRODUCTION_URL }} + concurrency: + group: production-deploy + cancel-in-progress: false + env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-node@v6 + with: + node-version: 26 + cache: npm + cache-dependency-path: tools/web_tests/package-lock.json + + - name: Prepare the tested release for Vercel + env: + GH_TOKEN: ${{ github.token }} + run: | + python3 tools/prepare_vercel.py --repository "$GITHUB_REPOSITORY" \ + --run-id "$GITHUB_RUN_ID" --commit "$GITHUB_SHA" + + - name: Pull Vercel environment information + run: npx --yes vercel@65.16.0 pull --cwd .vercel-source --yes --environment=production --token="$VERCEL_TOKEN" + + - name: Build the tested artifact on Vercel + id: deployment + run: | + npx --yes vercel@65.16.0 deploy --cwd .vercel-source --yes --prod --skip-domain \ + --json --token="$VERCEL_TOKEN" > "$RUNNER_TEMP/deployment.json" + python3 - <<'PY' + import json, os + from pathlib import Path + deployment = json.loads((Path(os.environ['RUNNER_TEMP']) / 'deployment.json').read_text())['deployment'] + assert deployment['readyState'] == 'READY' + with open(os.environ['GITHUB_OUTPUT'], 'a') as output: + output.write('url=' + deployment['url'] + '\n') + PY + + - name: Install hosted browser test runtime + working-directory: tools/web_tests + run: | + npm ci + npx playwright install --with-deps chromium + + - name: Verify the staged game before promotion + working-directory: tools/web_tests + env: + WEB_DEPLOYMENT_URL: ${{ steps.deployment.outputs.url }} + WEB_DEPLOYMENT_COMMIT: ${{ github.sha }} + WEB_DEPLOYMENT_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }} + run: npx playwright test --config playwright.deployment.config.cjs + + - name: Promote production + env: + DEPLOYMENT_URL: ${{ steps.deployment.outputs.url }} + run: npx --yes vercel@65.16.0 promote "$DEPLOYMENT_URL" --yes --token="$VERCEL_TOKEN" + + - name: Verify the public production domain + working-directory: tools/web_tests + env: + WEB_DEPLOYMENT_URL: ${{ vars.VERCEL_PRODUCTION_URL }} + WEB_DEPLOYMENT_COMMIT: ${{ github.sha }} + WEB_DEPLOYMENT_PUBLIC_ONLY: '1' + run: npx playwright test --config playwright.deployment.config.cjs + + - name: Upload hosted browser evidence + if: always() + uses: actions/upload-artifact@v6 + with: + name: farlanding-production-evidence-${{ github.sha }} + overwrite: true + path: | + tools/web_tests/test-results/ + tools/web_tests/playwright-report/ + if-no-files-found: ignore + retention-days: 14 diff --git a/.gitignore b/.gitignore index f984d70a..1c1085de 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ node_modules/ tools/web_tests/test-results/ tools/web_tests/playwright-report/ .audit/ +.vercel/ +.vercel-source/ diff --git a/README.md b/README.md index 3ebd3272..43ae099d 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ at this origin. Wait for the saved confirmation before reloading. Denied storage or failed persistence produces a warning. Clearing site data or changing the port or origin can make existing progress unavailable. Fullscreen requires a user click. Leaving the tab pauses the mission; resume explicitly when returning. -Keyboard and mouse are required. Mobile and hosting are outside this milestone. +Keyboard and mouse are required. Mobile controls remain outside this milestone. Every successful CI `web` job publishes `farlanding-web-` in the run's Artifacts section. Download and extract it, then run the same manifest verification @@ -152,7 +152,7 @@ and every bundle file's hash. It describes required HTTP headers; a ZIP has none ### Browser checks -Node **20+** is needed only for testing. Export diagnostics separately: +Node **26.x** is needed only for testing and deployment. Export diagnostics separately: ```sh tools/export.sh Web WebDiagnostics @@ -174,3 +174,35 @@ opt-in to avoid competing with software WebGL on CI runners. The broad mission matrix also runs from CI's manual **Run workflow** action. `WebDiagnostics` is for testing only; play the release under `build/web`. Browser versions and acceptance evidence are tracked in [the Web results](docs/WEB_CI_RESULTS.md). + +### Production deployment + +Successful pushes to `main` deploy to [Farlanding](https://farlanding.vercel.app) +after native checks and browser gameplay pass. Pull requests and manual test runs +do not deploy. Both the CI Node steps and the Vercel project use Node 26.x. + +The Vercel Hobby project uses the same team and CI-controlled deployment policy as +Space Explorer. Its Git auto-deploys are disabled. Because the exported game exceeds +Hobby's 100 MB CLI source-upload limit, CI uploads a small build script referring +to that run's tested GitHub artifact. Vercel downloads the short-lived artifact URL +and verifies both GitHub's archive digest and the release's file inventory and +commit before publishing any files. Godot is not rebuilt on Vercel. + +CI first creates an unaliased production deployment and runs real browser input +against it, including the isolation headers and WebAssembly MIME type. Only a +passing staged game is promoted. CI then checks the public production domain +without authentication. Use that stable domain for play so browser saves stay at +the same origin across deployments. + +Repository secrets: `VERCEL_TOKEN`, `VERCEL_ORG_ID`, `VERCEL_PROJECT_ID`, and +`VERCEL_AUTOMATION_BYPASS_SECRET`. The last one lets the staged browser check pass +Vercel's preview protection; traces are disabled when it is used so request +credentials are not recorded. `VERCEL_PRODUCTION_URL` is a repository variable. +The deployment uses the GitHub `production` environment and Vercel CLI 65.16.0. + +Deploy through CI rather than rebuilding an old deployment in the Vercel dashboard: +the artifact download URL expires. Rerun the deployment job in a push-to-`main` +workflow while its tested artifact is retained, or rerun that entire push workflow +to create a fresh artifact. Manual **Run workflow** runs remain test-only. +Existing ready deployments can still be promoted +or rolled back without downloading the source artifact again. diff --git a/docs/WEB_CI_RESULTS.md b/docs/WEB_CI_RESULTS.md index 2f13b3a1..25ce6f3b 100644 --- a/docs/WEB_CI_RESULTS.md +++ b/docs/WEB_CI_RESULTS.md @@ -133,5 +133,19 @@ limit of the first browser milestone, not a passing result for the original targ A human listening receipt, a complete campaign playthrough in Safari, and GPU / WebAssembly memory-leak qualification have not been represented as completed. Automated mixer evidence supplements those checks; it is not a fabricated listener. -Hosting, mobile controls, PWA, cloud saves, and branch-protection changes remain -outside this milestone. +Mobile controls, PWA, cloud saves, and branch-protection changes remain outside +this milestone. Hosting is covered by the Vercel follow-up below. + +## Vercel follow-up + +The Vercel Hobby project and both projects' CI Node steps use Node 26.x. A staged +Farlanding deployment successfully retrieved the green `7d92b3e` CI artifact, +verified its archive digest and all nine release files, and served the full game +without a plan upgrade. The hosted browser smoke reached a Kessel landing with no +browser errors. It reproduced missing audio worklets on a protected deployment +until the automation bypass cookie was enabled; the corrected check passed. + +Production promotion is wired into CI after native/browser gates and the staged +hosted game check. A separate unauthenticated check verifies the stable production +domain after promotion. See [ADR 0020](adr/0020-vercel-ci-deployment.md) for the +artifact handoff, headers, credentials, and rollback constraints. diff --git a/docs/adr/0019-web-runtime.md b/docs/adr/0019-web-runtime.md index 334181b9..98608c11 100644 --- a/docs/adr/0019-web-runtime.md +++ b/docs/adr/0019-web-runtime.md @@ -10,7 +10,8 @@ player-node playback enums use a different numbering. Serve on loopback for development. Threaded exports need a secure context and `Cross-Origin-Opener-Policy: same-origin` plus `Cross-Origin-Embedder-Policy: require-corp`. Localhost qualifies. Future hosting -must supply these headers and the WebAssembly MIME type. No hosting is configured. +must supply these headers and the WebAssembly MIME type. Vercel CI deployment is +described in [ADR 0020](0020-vercel-ci-deployment.md). ## Reasons diff --git a/docs/adr/0020-vercel-ci-deployment.md b/docs/adr/0020-vercel-ci-deployment.md new file mode 100644 index 00000000..2946ca58 --- /dev/null +++ b/docs/adr/0020-vercel-ci-deployment.md @@ -0,0 +1,30 @@ +# 0020. Publish the tested Web artifact through Vercel CI + +Deploy production only after the native and browser jobs succeed on a push to +`main`. Disable Vercel Git auto-deploys, use a GitHub production environment, +and serialize main runs so older production deployments cannot overtake newer +ones. Node 26.x and Vercel CLI 65.16.0 are pinned for the deployment tooling. + +Use the existing Vercel Hobby team, matching Space Explorer's CI ownership of +production. The Web release is about 168 MB, above Hobby's 100 MB CLI source-upload +limit. A small source upload therefore contains only the static hosting config, +a Python build script, and a short-lived URL for the current CI run's artifact. +No GitHub token is sent to Vercel. The build checks GitHub's immutable artifact +archive SHA-256, the expected source commit, clean release preset, and the complete +exported file inventory. Only `build/web` becomes public. Godot is not rebuilt. + +Serve COOP `same-origin`, COEP `require-corp`, and `application/wasm` on the engine +binary. Revalidate stable filenames rather than caching them immutably across +production releases. Missing paths remain missing; there is no SPA fallback. + +Create a production deployment with `--skip-domain`, exercise the actual hosted +game, then promote only after that check passes. The staged check uses an +automation bypass header and cookie so audio worklets can load on a protected +deployment. Do not record traces containing the bypass credential. After +promotion, check the production domain without authentication. Keep play and +saves on the stable production origin. + +Signed artifact URLs expire. CI creates a new URL for each deployment; dashboard +source rebuilds of old deployments are not supported. Existing ready deployments +can be promoted or rolled back. Do not upgrade the Vercel plan or add an asset +hosting service for this workflow. diff --git a/tools/prepare_vercel.py b/tools/prepare_vercel.py new file mode 100644 index 00000000..e7b68504 --- /dev/null +++ b/tools/prepare_vercel.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +"""Create a tiny Vercel source upload referring to this run's immutable artifact.""" +import argparse +import json +import os +from pathlib import Path +import re +import shutil +import subprocess +from urllib.error import HTTPError +from urllib.request import build_opener, HTTPRedirectHandler, Request, urlopen + +ROOT = Path(__file__).resolve().parent.parent + + +class NoRedirect(HTTPRedirectHandler): + def redirect_request(self, req, fp, code, msg, headers, newurl): + return None + + +def prepare(repository, run_id, commit, output): + token = os.environ.get('GH_TOKEN') or os.environ.get('GITHUB_TOKEN') + if not token: + token = subprocess.check_output(['gh', 'auth', 'token'], text=True).strip() + headers = {'Authorization': f'Bearer {token}', 'Accept': 'application/vnd.github+json', + 'X-GitHub-Api-Version': '2022-11-28'} + api = f'https://api.github.com/repos/{repository}/actions' + request = Request(f'{api}/runs/{run_id}/artifacts?per_page=100', headers=headers) + with urlopen(request, timeout=30) as response: + artifacts = json.load(response)['artifacts'] + matches = [item for item in artifacts if item['name'] == f'farlanding-web-{commit}' + and not item['expired'] and str(item['workflow_run']['id']) == str(run_id)] + if len(matches) != 1: + raise ValueError('Expected exactly one release artifact from the current run') + artifact = matches[0] + digest = artifact.get('digest', '') + if not re.fullmatch(r'sha256:[0-9a-f]{64}', digest): + raise ValueError('GitHub did not supply a SHA-256 archive digest') + # Never send the GitHub token to the redirected artifact storage host. + request = Request(f"{api}/artifacts/{artifact['id']}/zip", headers=headers) + try: + build_opener(NoRedirect).open(request, timeout=30) + raise ValueError('Expected an artifact download redirect') + except HTTPError as error: + if error.code != 302: + raise + signed_url = error.headers['Location'] + if not signed_url.startswith('https://'): + raise ValueError('Artifact redirect must use HTTPS') + output.mkdir(parents=True, exist_ok=True) + shutil.copyfile(ROOT / 'vercel.json', output / 'vercel.json') + shutil.copyfile(ROOT / 'tools/vercel_build.py', output / 'build.py') + (output / '.vercelignore').write_text('public/\n.vercel/\n') + (output / 'artifact.json').write_text(json.dumps({ + 'url': signed_url, 'sha256': digest.removeprefix('sha256:'), 'commit': commit, + })) + print(f'Prepared Vercel source for tested artifact {artifact["id"]} at {commit}') + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--repository', required=True) + parser.add_argument('--run-id', required=True) + parser.add_argument('--commit', required=True) + parser.add_argument('--output', type=Path, default=Path('.vercel-source')) + args = parser.parse_args() + prepare(args.repository, args.run_id, args.commit, args.output) diff --git a/tools/test_vercel_deploy.py b/tools/test_vercel_deploy.py new file mode 100644 index 00000000..78f71a0b --- /dev/null +++ b/tools/test_vercel_deploy.py @@ -0,0 +1,74 @@ +import hashlib +import json +from pathlib import Path +import tempfile +import unittest +import zipfile + +from vercel_build import unpack + +COMMIT = 'a' * 40 +ROOT = Path(__file__).resolve().parent.parent + + +class VercelDeployTest(unittest.TestCase): + def archive(self, directory, *, preset='Web', dirty=False, corrupt=False, extra=False): + files = {name: name.encode() for name in ('index.html', 'index.js', 'index.wasm', 'index.pck')} + manifest = {'commit': COMMIT, 'dirty': dirty, 'preset': preset, + 'files': {name: hashlib.sha256(data).hexdigest() for name, data in files.items()}} + path = directory / 'release.zip' + with zipfile.ZipFile(path, 'w') as archive: + for name, data in files.items(): + archive.writestr('build/web/' + name, b'corrupt' if corrupt and name == 'index.pck' else data) + archive.writestr('build/web/manifest.json', json.dumps(manifest)) + archive.writestr('tools/serve_web.py', 'not a public asset') + if extra: + archive.writestr('build/web/extra/manifest.json', '{}') + return path, hashlib.sha256(path.read_bytes()).hexdigest() + + def test_only_verified_release_files_become_public(self): + with tempfile.TemporaryDirectory() as temporary: + directory = Path(temporary) + archive, digest = self.archive(directory) + output = directory / 'public' + output.mkdir() + (output / 'stale.txt').write_text('old deployment') + unpack(archive, output, digest, COMMIT) + self.assertEqual({p.name for p in output.iterdir()}, + {'index.html', 'index.js', 'index.wasm', 'index.pck', 'manifest.json'}) + self.assertEqual((output / 'index.pck').read_bytes(), b'index.pck') + + def test_bad_digest_wrong_commit_dirty_and_diagnostic_artifacts_are_rejected(self): + with tempfile.TemporaryDirectory() as temporary: + directory = Path(temporary) + for mode in ['archive', 'commit', 'dirty', 'diagnostic', 'file', 'extra']: + with self.subTest(mode=mode): + archive, digest = self.archive(directory, preset='WebDiagnostics' if mode == 'diagnostic' else 'Web', + dirty=mode == 'dirty', corrupt=mode == 'file', extra=mode == 'extra') + with self.assertRaises(ValueError): + unpack(archive, directory / 'public', '0' * 64 if mode == 'archive' else digest, + 'b' * 40 if mode == 'commit' else COMMIT) + self.assertFalse((directory / 'public').exists()) + + def test_archive_cannot_write_outside_the_bundle(self): + with tempfile.TemporaryDirectory() as temporary: + directory = Path(temporary) + archive, _ = self.archive(directory) + with zipfile.ZipFile(archive, 'a') as zipped: + zipped.writestr('build/web/../../escape', 'bad') + digest = hashlib.sha256(archive.read_bytes()).hexdigest() + with self.assertRaisesRegex(ValueError, 'Invalid artifact path'): + unpack(archive, directory / 'public', digest, COMMIT) + self.assertFalse((directory / 'escape').exists()) + + def test_vercel_headers_support_threads_and_wasm(self): + config = json.loads((ROOT / 'vercel.json').read_text()) + self.assertFalse(config['git']['deploymentEnabled']) + headers = {h['key']: h['value'] for h in config['headers'][0]['headers']} + self.assertEqual(headers['Cross-Origin-Opener-Policy'], 'same-origin') + self.assertEqual(headers['Cross-Origin-Embedder-Policy'], 'require-corp') + self.assertEqual(config['headers'][1]['headers'][0]['value'], 'application/wasm') + + +if __name__ == '__main__': + unittest.main() diff --git a/tools/vercel_build.py b/tools/vercel_build.py new file mode 100644 index 00000000..72f377cf --- /dev/null +++ b/tools/vercel_build.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Vercel build: unpack the verified GitHub CI release, never rebuild the game.""" +import hashlib +import json +from pathlib import Path, PurePosixPath +import shutil +import tempfile +from urllib.request import urlopen +import zipfile + + +def file_digest(path): + digest = hashlib.sha256() + with Path(path).open('rb') as source: + for chunk in iter(lambda: source.read(1024 * 1024), b''): + digest.update(chunk) + return digest.hexdigest() + + +def unpack(archive, output, expected_digest, expected_commit): + if file_digest(archive) != expected_digest: + raise ValueError('CI artifact archive hash mismatch') + with tempfile.TemporaryDirectory() as temporary: + bundle = Path(temporary) + with zipfile.ZipFile(archive) as zipped: + for item in zipped.infolist(): + path = PurePosixPath(item.filename) + if path.is_absolute() or '..' in path.parts: + raise ValueError('Invalid artifact path') + if path.parts[:2] != ('build', 'web') or item.is_dir(): + continue + target = bundle.joinpath(*path.parts[2:]) + target.parent.mkdir(parents=True, exist_ok=True) + with zipped.open(item) as source, target.open('wb') as dest: + shutil.copyfileobj(source, dest) + manifest = json.loads((bundle / 'manifest.json').read_text()) + if (manifest['commit'] != expected_commit or manifest['dirty'] + or manifest['preset'] != 'Web'): + raise ValueError('Artifact is not the clean release for this commit') + actual = {str(path.relative_to(bundle)): file_digest(path) + for path in bundle.rglob('*') if path.is_file() and path != bundle / 'manifest.json'} + if actual != manifest['files']: + raise ValueError('Web release file inventory or hash mismatch') + if not {'index.html', 'index.js', 'index.wasm', 'index.pck'} <= actual.keys(): + raise ValueError('Incomplete Web release') + if output.exists(): + shutil.rmtree(output) + shutil.copytree(bundle, output) + print(f'Prepared tested release {expected_commit}: {len(actual)} verified files') + + +def main(): + config = json.loads(Path('artifact.json').read_text()) + if not config['url'].startswith('https://'): + raise ValueError('Artifact download must use HTTPS') + with tempfile.TemporaryDirectory() as temporary: + archive = Path(temporary) / 'release.zip' + with urlopen(config['url'], timeout=180) as response, archive.open('wb') as dest: + shutil.copyfileobj(response, dest) + unpack(archive, Path('public'), config['sha256'], config['commit']) + + +if __name__ == '__main__': + main() diff --git a/tools/web_tests/deployment.spec.cjs b/tools/web_tests/deployment.spec.cjs new file mode 100644 index 00000000..75a13e74 --- /dev/null +++ b/tools/web_tests/deployment.spec.cjs @@ -0,0 +1,61 @@ +const { test, expect } = require('@playwright/test'); + +if (process.env.WEB_DEPLOYMENT_URL && !process.env.WEB_DEPLOYMENT_PUBLIC_ONLY) { + test('production serves the tested release and reaches a playable landing', async ({ page }, info) => { + const url = process.env.WEB_DEPLOYMENT_URL; + const errors = []; + page.on('pageerror', error => errors.push(String(error))); + page.on('console', entry => { if (entry.type() === 'error') errors.push(entry.text()); }); + await expect.poll(async () => { + const response = await page.request.get(`${url}/manifest.json`); + return response.ok() ? (await response.json()).commit : null; + }, { timeout: 60000 }).toBe(process.env.WEB_DEPLOYMENT_COMMIT); + for (const path of ['/', '/index.wasm', '/index.pck']) { + const response = await page.request.head(url + path); + expect(response.ok()).toBe(true); + expect(response.headers()['cross-origin-opener-policy']).toBe('same-origin'); + expect(response.headers()['cross-origin-embedder-policy']).toBe('require-corp'); + if (path.endsWith('.wasm')) expect(response.headers()['content-type']).toContain('application/wasm'); + } + const manifest = await (await page.request.get(`${url}/manifest.json`)).json(); + expect(manifest.dirty).toBe(false); + expect(manifest.preset).toBe('Web'); + await page.goto(url); + await page.getByRole('button', { name: 'Play Farlanding' }).click(); + await expect.poll(() => page.evaluate(() => window.farlanding?.ready), { timeout: 90000 }).toBe(true); + expect(await page.evaluate(() => crossOriginIsolated)).toBe(true); + expect(await page.evaluate(() => window.farlanding.diagnostics)).toBeUndefined(); + await page.mouse.click(630, 388, { delay: 80 }); + await page.mouse.click(600, 285, { delay: 80 }); + const landing = page.waitForEvent('console', { + predicate: entry => entry.text().includes('kessel_proving: 18 resource nodes and the bases placed'), timeout: 90000, + }); + await page.mouse.click(850, 522, { delay: 80 }); + await landing; + await page.mouse.click(580, 385, { delay: 80 }); + expect(await page.evaluate(() => window.farlanding.errors)).toEqual([]); + expect(errors).toEqual([]); + await page.screenshot({ path: info.outputPath('production-landing.png') }); + await info.attach('release-manifest', { body: JSON.stringify(manifest), contentType: 'application/json' }); + }); +} + +if (process.env.WEB_DEPLOYMENT_URL && process.env.WEB_DEPLOYMENT_PUBLIC_ONLY) { + test('the production domain exposes the current release without authentication', async () => { + const url = process.env.WEB_DEPLOYMENT_URL; + // Node fetch sends no Playwright protection headers, cookies, or Vercel token. + await expect.poll(async () => { + const response = await fetch(`${url}/manifest.json`); + return response.ok() && response.headers.get('content-type')?.includes('application/json') + ? (await response.json()).commit : null; + }, { timeout: 60000 }).toBe(process.env.WEB_DEPLOYMENT_COMMIT); + for (const path of ['/', '/index.wasm', '/index.pck']) { + const response = await fetch(url + path, { method: 'HEAD' }); + expect(response.status).toBe(200); + expect(new URL(response.url).origin).toBe(new URL(url).origin); + expect(response.headers.get('cross-origin-opener-policy')).toBe('same-origin'); + expect(response.headers.get('cross-origin-embedder-policy')).toBe('require-corp'); + if (path.endsWith('.wasm')) expect(response.headers.get('content-type')).toContain('application/wasm'); + } + }); +} diff --git a/tools/web_tests/package-lock.json b/tools/web_tests/package-lock.json index 6d405941..4e070446 100644 --- a/tools/web_tests/package-lock.json +++ b/tools/web_tests/package-lock.json @@ -9,6 +9,9 @@ "version": "1.0.0", "devDependencies": { "@playwright/test": "1.65.1" + }, + "engines": { + "node": "26.x" } }, "node_modules/@playwright/test": { diff --git a/tools/web_tests/package.json b/tools/web_tests/package.json index b11cf98b..32e125e4 100644 --- a/tools/web_tests/package.json +++ b/tools/web_tests/package.json @@ -6,6 +6,7 @@ "test": "playwright test" }, "type": "commonjs", + "engines": { "node": "26.x" }, "devDependencies": { "@playwright/test": "1.65.1" }, diff --git a/tools/web_tests/playwright.deployment.config.cjs b/tools/web_tests/playwright.deployment.config.cjs new file mode 100644 index 00000000..28253f25 --- /dev/null +++ b/tools/web_tests/playwright.deployment.config.cjs @@ -0,0 +1,18 @@ +const { defineConfig } = require('@playwright/test'); +module.exports = defineConfig({ + testDir: '.', testMatch: 'deployment.spec.cjs', workers: 1, retries: 0, + timeout: 240000, expect: { timeout: 30000 }, + outputDir: `test-results/${process.env.WEB_DEPLOYMENT_PUBLIC_ONLY ? 'production' : 'staged'}`, + reporter: [['list'], ['html', { open: 'never', outputFolder: `playwright-report/${process.env.WEB_DEPLOYMENT_PUBLIC_ONLY ? 'production' : 'staged'}` }]], + use: { + viewport: { width: 1280, height: 720 }, + screenshot: 'only-on-failure', + // Traces record request headers; never retain the staging protection secret. + trace: process.env.WEB_DEPLOYMENT_BYPASS_SECRET ? 'off' : 'retain-on-failure', + extraHTTPHeaders: process.env.WEB_DEPLOYMENT_BYPASS_SECRET ? { + 'x-vercel-protection-bypass': process.env.WEB_DEPLOYMENT_BYPASS_SECRET, + 'x-vercel-set-bypass-cookie': 'true', + } : {}, + launchOptions: { args: process.platform === 'darwin' ? ['--use-angle=metal'] : ['--use-angle=swiftshader', '--enable-unsafe-swiftshader'] }, + }, +}); diff --git a/vercel.json b/vercel.json new file mode 100644 index 00000000..b6ea3c72 --- /dev/null +++ b/vercel.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://openapi.vercel.sh/vercel.json", + "framework": null, + "installCommand": "", + "buildCommand": "python3 build.py", + "outputDirectory": "public", + "git": { "deploymentEnabled": false }, + "headers": [ + { + "source": "/(.*)", + "headers": [ + { "key": "Cross-Origin-Opener-Policy", "value": "same-origin" }, + { "key": "Cross-Origin-Embedder-Policy", "value": "require-corp" }, + { "key": "X-Content-Type-Options", "value": "nosniff" }, + { "key": "Cache-Control", "value": "public, max-age=0, must-revalidate" } + ] + }, + { + "source": "/index.wasm", + "headers": [{ "key": "Content-Type", "value": "application/wasm" }] + } + ] +} From d2c6506d19d779f61a15dad9dbd5891400b4dc48 Mon Sep 17 00:00:00 2001 From: Douwe de Vries Date: Sat, 14 Nov 2026 19:39:39 +0100 Subject: [PATCH 2/4] Check the native fetch response status in the public deployment smoke --- tools/web_tests/deployment.spec.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/web_tests/deployment.spec.cjs b/tools/web_tests/deployment.spec.cjs index 75a13e74..56c1887d 100644 --- a/tools/web_tests/deployment.spec.cjs +++ b/tools/web_tests/deployment.spec.cjs @@ -46,7 +46,7 @@ if (process.env.WEB_DEPLOYMENT_URL && process.env.WEB_DEPLOYMENT_PUBLIC_ONLY) { // Node fetch sends no Playwright protection headers, cookies, or Vercel token. await expect.poll(async () => { const response = await fetch(`${url}/manifest.json`); - return response.ok() && response.headers.get('content-type')?.includes('application/json') + return response.ok && response.headers.get('content-type')?.includes('application/json') ? (await response.json()).commit : null; }, { timeout: 60000 }).toBe(process.env.WEB_DEPLOYMENT_COMMIT); for (const path of ['/', '/index.wasm', '/index.pck']) { From 9bbe27e0d0e9d5ed6ccb6958958a2160297c0dcd Mon Sep 17 00:00:00 2001 From: Douwe de Vries Date: Sat, 14 Nov 2026 19:48:20 +0100 Subject: [PATCH 3/4] Resolve artifact download redirects inside the Vercel build --- .github/workflows/ci.yml | 4 ++- README.md | 17 +++++++------ docs/WEB_CI_RESULTS.md | 7 ++++++ docs/adr/0020-vercel-ci-deployment.md | 16 +++++++----- tools/prepare_vercel.py | 22 +++------------- tools/test_vercel_deploy.py | 36 ++++++++++++++++++++++++++- tools/vercel_build.py | 36 +++++++++++++++++++++++---- 7 files changed, 99 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae12c4a3..c7300be4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -218,9 +218,11 @@ jobs: - name: Build the tested artifact on Vercel id: deployment + env: + GH_TOKEN: ${{ github.token }} run: | npx --yes vercel@65.16.0 deploy --cwd .vercel-source --yes --prod --skip-domain \ - --json --token="$VERCEL_TOKEN" > "$RUNNER_TEMP/deployment.json" + --build-env "GH_TOKEN=$GH_TOKEN" --json --token="$VERCEL_TOKEN" > "$RUNNER_TEMP/deployment.json" python3 - <<'PY' import json, os from pathlib import Path diff --git a/README.md b/README.md index 43ae099d..29478a64 100644 --- a/README.md +++ b/README.md @@ -184,9 +184,12 @@ do not deploy. Both the CI Node steps and the Vercel project use Node 26.x. The Vercel Hobby project uses the same team and CI-controlled deployment policy as Space Explorer. Its Git auto-deploys are disabled. Because the exported game exceeds Hobby's 100 MB CLI source-upload limit, CI uploads a small build script referring -to that run's tested GitHub artifact. Vercel downloads the short-lived artifact URL -and verifies both GitHub's archive digest and the release's file inventory and -commit before publishing any files. Godot is not rebuilt on Vercel. +to that run's tested GitHub artifact by ID and digest. Vercel resolves a fresh +download URL when its build starts, using that CI job's short-lived GitHub token +as a build-only secret with repository contents/Actions read permissions. It is +never stored in source files or public assets and is not forwarded to artifact +storage. The build verifies GitHub's archive digest and the release's complete +file inventory and commit. Godot is not rebuilt on Vercel. CI first creates an unaliased production deployment and runs real browser input against it, including the isolation headers and WebAssembly MIME type. Only a @@ -201,8 +204,8 @@ credentials are not recorded. `VERCEL_PRODUCTION_URL` is a repository variable. The deployment uses the GitHub `production` environment and Vercel CLI 65.16.0. Deploy through CI rather than rebuilding an old deployment in the Vercel dashboard: -the artifact download URL expires. Rerun the deployment job in a push-to-`main` -workflow while its tested artifact is retained, or rerun that entire push workflow +the job's GitHub token expires when that job finishes. Rerun the deployment job in +a push-to-`main` workflow while its tested artifact is retained, or rerun that entire push workflow to create a fresh artifact. Manual **Run workflow** runs remain test-only. -Existing ready deployments can still be promoted -or rolled back without downloading the source artifact again. +Existing ready deployments can still be promoted or rolled back without +downloading the source artifact again. diff --git a/docs/WEB_CI_RESULTS.md b/docs/WEB_CI_RESULTS.md index 25ce6f3b..5d72a6ee 100644 --- a/docs/WEB_CI_RESULTS.md +++ b/docs/WEB_CI_RESULTS.md @@ -145,6 +145,13 @@ without a plan upgrade. The hosted browser smoke reached a Kessel landing with n browser errors. It reproduced missing audio worklets on a protected deployment until the automation bypass cookie was enabled; the corrected check passed. +Review also caught GitHub's one-minute artifact-redirect lifetime. Preparation now +stores only artifact identity and digest; the build resolves the URL immediately +before downloading with a job-scoped read-only token. Six deployment-tool tests +cover that handoff and rejection of incorrect/dirty/diagnostic/corrupt releases. +The revised download path also retrieved and verified the real nine-file artifact +locally. It does not forward authorization to the redirected storage host. + Production promotion is wired into CI after native/browser gates and the staged hosted game check. A separate unauthenticated check verifies the stable production domain after promotion. See [ADR 0020](adr/0020-vercel-ci-deployment.md) for the diff --git a/docs/adr/0020-vercel-ci-deployment.md b/docs/adr/0020-vercel-ci-deployment.md index 2946ca58..179b5dc2 100644 --- a/docs/adr/0020-vercel-ci-deployment.md +++ b/docs/adr/0020-vercel-ci-deployment.md @@ -8,9 +8,13 @@ ones. Node 26.x and Vercel CLI 65.16.0 are pinned for the deployment tooling. Use the existing Vercel Hobby team, matching Space Explorer's CI ownership of production. The Web release is about 168 MB, above Hobby's 100 MB CLI source-upload limit. A small source upload therefore contains only the static hosting config, -a Python build script, and a short-lived URL for the current CI run's artifact. -No GitHub token is sent to Vercel. The build checks GitHub's immutable artifact -archive SHA-256, the expected source commit, clean release preset, and the complete +a Python build script, and the current CI run's artifact identity and digest. +Resolve GitHub's one-minute download redirect inside the build, immediately before +fetching it. Pass only the deployment job's temporary, repository-scoped GitHub +token as a build-only secret, with contents/Actions read permissions. Never put it +in source files, public assets, or requests to redirected artifact storage. +The build checks GitHub's immutable artifact archive SHA-256, the expected source +commit, clean release preset, and the complete exported file inventory. Only `build/web` becomes public. Godot is not rebuilt. Serve COOP `same-origin`, COEP `require-corp`, and `application/wasm` on the engine @@ -24,7 +28,7 @@ deployment. Do not record traces containing the bypass credential. After promotion, check the production domain without authentication. Keep play and saves on the stable production origin. -Signed artifact URLs expire. CI creates a new URL for each deployment; dashboard -source rebuilds of old deployments are not supported. Existing ready deployments -can be promoted or rolled back. Do not upgrade the Vercel plan or add an asset +The GitHub job token expires after the job. CI supplies a fresh token for each +deployment; dashboard source rebuilds of old deployments are not supported. +Existing ready deployments can be promoted or rolled back. Do not upgrade the Vercel plan or add an asset hosting service for this workflow. diff --git a/tools/prepare_vercel.py b/tools/prepare_vercel.py index e7b68504..e4eb75da 100644 --- a/tools/prepare_vercel.py +++ b/tools/prepare_vercel.py @@ -7,17 +7,11 @@ import re import shutil import subprocess -from urllib.error import HTTPError -from urllib.request import build_opener, HTTPRedirectHandler, Request, urlopen +from urllib.request import Request, urlopen ROOT = Path(__file__).resolve().parent.parent -class NoRedirect(HTTPRedirectHandler): - def redirect_request(self, req, fp, code, msg, headers, newurl): - return None - - def prepare(repository, run_id, commit, output): token = os.environ.get('GH_TOKEN') or os.environ.get('GITHUB_TOKEN') if not token: @@ -36,23 +30,13 @@ def prepare(repository, run_id, commit, output): digest = artifact.get('digest', '') if not re.fullmatch(r'sha256:[0-9a-f]{64}', digest): raise ValueError('GitHub did not supply a SHA-256 archive digest') - # Never send the GitHub token to the redirected artifact storage host. - request = Request(f"{api}/artifacts/{artifact['id']}/zip", headers=headers) - try: - build_opener(NoRedirect).open(request, timeout=30) - raise ValueError('Expected an artifact download redirect') - except HTTPError as error: - if error.code != 302: - raise - signed_url = error.headers['Location'] - if not signed_url.startswith('https://'): - raise ValueError('Artifact redirect must use HTTPS') output.mkdir(parents=True, exist_ok=True) shutil.copyfile(ROOT / 'vercel.json', output / 'vercel.json') shutil.copyfile(ROOT / 'tools/vercel_build.py', output / 'build.py') (output / '.vercelignore').write_text('public/\n.vercel/\n') (output / 'artifact.json').write_text(json.dumps({ - 'url': signed_url, 'sha256': digest.removeprefix('sha256:'), 'commit': commit, + 'repository': repository, 'artifact_id': artifact['id'], + 'sha256': digest.removeprefix('sha256:'), 'commit': commit, })) print(f'Prepared Vercel source for tested artifact {artifact["id"]} at {commit}') diff --git a/tools/test_vercel_deploy.py b/tools/test_vercel_deploy.py index 78f71a0b..a238826e 100644 --- a/tools/test_vercel_deploy.py +++ b/tools/test_vercel_deploy.py @@ -1,17 +1,51 @@ import hashlib +import io import json from pathlib import Path import tempfile import unittest +from unittest.mock import patch +from urllib.error import HTTPError import zipfile -from vercel_build import unpack +from vercel_build import download, unpack +import prepare_vercel COMMIT = 'a' * 40 ROOT = Path(__file__).resolve().parent.parent class VercelDeployTest(unittest.TestCase): + def test_preparation_persists_identity_not_expiring_urls_or_tokens(self): + metadata = {'artifacts': [{'id': 42, 'name': f'farlanding-web-{COMMIT}', 'expired': False, + 'workflow_run': {'id': 99}, 'digest': 'sha256:' + 'a' * 64}]} + with tempfile.TemporaryDirectory() as temporary: + output = Path(temporary) + with patch.dict('os.environ', {'GH_TOKEN': 'test-job-token'}), \ + patch('prepare_vercel.urlopen', return_value=io.BytesIO(json.dumps(metadata).encode())) as get: + prepare_vercel.prepare('owner/repo', '99', COMMIT, output) + get.assert_called_once() + config = json.loads((output / 'artifact.json').read_text()) + self.assertEqual(set(config), {'repository', 'artifact_id', 'sha256', 'commit'}) + self.assertEqual(config['artifact_id'], 42) + self.assertNotIn('test-job-token', (output / 'artifact.json').read_text()) + + def test_build_resolves_a_fresh_redirect_and_does_not_forward_the_token(self): + config = {'repository': 'owner/repo', 'artifact_id': 42} + url = 'https://artifact.example/download?signature=fresh' + redirect = HTTPError('https://api.github.com', 302, 'Found', {'Location': url}, None) + with tempfile.TemporaryDirectory() as temporary: + output = Path(temporary) / 'archive.zip' + with patch('vercel_build.build_opener') as opener, \ + patch('vercel_build.urlopen', return_value=io.BytesIO(b'archive')) as get: + opener.return_value.open.side_effect = redirect + download(config, 'test-job-token', output) + request = opener.return_value.open.call_args.args[0] + self.assertEqual(request.full_url, 'https://api.github.com/repos/owner/repo/actions/artifacts/42/zip') + self.assertEqual(request.get_header('Authorization'), 'Bearer test-job-token') + get.assert_called_once_with(url, timeout=180) + self.assertEqual(output.read_bytes(), b'archive') + def archive(self, directory, *, preset='Web', dirty=False, corrupt=False, extra=False): files = {name: name.encode() for name in ('index.html', 'index.js', 'index.wasm', 'index.pck')} manifest = {'commit': COMMIT, 'dirty': dirty, 'preset': preset, diff --git a/tools/vercel_build.py b/tools/vercel_build.py index 72f377cf..875223e4 100644 --- a/tools/vercel_build.py +++ b/tools/vercel_build.py @@ -2,13 +2,42 @@ """Vercel build: unpack the verified GitHub CI release, never rebuild the game.""" import hashlib import json +import os from pathlib import Path, PurePosixPath import shutil import tempfile -from urllib.request import urlopen +from urllib.error import HTTPError +from urllib.request import build_opener, HTTPRedirectHandler, Request, urlopen import zipfile +class NoRedirect(HTTPRedirectHandler): + def redirect_request(self, req, fp, code, msg, headers, newurl): + return None + + +def download(config, token, archive): + # Resolve GitHub's one-minute redirect only when the build is ready to fetch it. + api = f'https://api.github.com/repos/{config["repository"]}/actions/artifacts/{config["artifact_id"]}/zip' + request = Request(api, headers={'Authorization': f'Bearer {token}', + 'Accept': 'application/vnd.github+json', + 'X-GitHub-Api-Version': '2022-11-28'}) + try: + response = build_opener(NoRedirect).open(request, timeout=30) + response.close() + raise ValueError('Expected an artifact download redirect') + except HTTPError as error: + if error.code != 302: + raise + signed_url = error.headers['Location'] + error.close() + if not signed_url.startswith('https://'): + raise ValueError('Artifact redirect must use HTTPS') + # The job token goes only to GitHub, never to the redirected storage host. + with urlopen(signed_url, timeout=180) as response, archive.open('wb') as dest: + shutil.copyfileobj(response, dest) + + def file_digest(path): digest = hashlib.sha256() with Path(path).open('rb') as source: @@ -51,12 +80,9 @@ def unpack(archive, output, expected_digest, expected_commit): def main(): config = json.loads(Path('artifact.json').read_text()) - if not config['url'].startswith('https://'): - raise ValueError('Artifact download must use HTTPS') with tempfile.TemporaryDirectory() as temporary: archive = Path(temporary) / 'release.zip' - with urlopen(config['url'], timeout=180) as response, archive.open('wb') as dest: - shutil.copyfileobj(response, dest) + download(config, os.environ['GH_TOKEN'], archive) unpack(archive, Path('public'), config['sha256'], config['commit']) From 01edd80b6d04a8545b7c0908c50d3365384e3a4a Mon Sep 17 00:00:00 2001 From: Douwe de Vries Date: Sat, 14 Nov 2026 20:09:04 +0100 Subject: [PATCH 4/4] Isolate final-mix recordings from random playback state --- docs/AUDIO_STYLE.md | 5 +++++ docs/WEB_CI_RESULTS.md | 7 +++++++ game/tests/audio/test_final_mix.gd | 11 +++++++++++ 3 files changed, 23 insertions(+) diff --git a/docs/AUDIO_STYLE.md b/docs/AUDIO_STYLE.md index 1a186533..046beacb 100644 --- a/docs/AUDIO_STYLE.md +++ b/docs/AUDIO_STYLE.md @@ -1001,6 +1001,11 @@ and the details are random. Across four runs the calm scenes spanned 1.5–2.6 L The finale's peak varied most (−1.9 to −5.0 dBFS): it is the campaign's one unducked climax, with explosions landing on top of the cue. +CI qualification now seeds the audio service, music director, and ambience director's +own RNGs and restarts score/ambience playback for each scene. A global seed alone did +not control random bed offsets or prior playback state. The 3.5/4.5 LU limits stay +unchanged; this fixture reset does not change the game's production mix or variety. + Fixed in Phase 9: - **Hollow Meridian calm was 2.5–4 LU hot** (−25.5 against about −28.5). Its `calm` state played diff --git a/docs/WEB_CI_RESULTS.md b/docs/WEB_CI_RESULTS.md index 5d72a6ee..82c41736 100644 --- a/docs/WEB_CI_RESULTS.md +++ b/docs/WEB_CI_RESULTS.md @@ -152,6 +152,13 @@ cover that handoff and rejection of incorrect/dirty/diagnostic/corrupt releases. The revised download path also retrieved and verified the real nine-file artifact locally. It does not forward authorization to the redirected storage host. +A native CI run failed the calm-scene comparison at 3.517 LU against its 3.5 LU +limit. The mix fixture seeded only the global RNG, leaving the directors' private +RNGs and bed playback positions uncontrolled. It now resets those scene inputs +without changing production audio or the loudness limits. The full native audio +suite passed 416 tests / 6,374 assertions with no engine errors or warnings; the +calm-scene spread was approximately 2.6 LU. + Production promotion is wired into CI after native/browser gates and the staged hosted game check. A separate unauthenticated check verifies the stable production domain after promotion. See [ADR 0020](adr/0020-vercel-ci-deployment.md) for the diff --git a/game/tests/audio/test_final_mix.gd b/game/tests/audio/test_final_mix.gd index d80a083f..89d2eccd 100644 --- a/game/tests/audio/test_final_mix.gd +++ b/game/tests/audio/test_final_mix.gd @@ -124,7 +124,18 @@ var _vent: Node3D func before_each() -> void: + Events.campaign_screen_changed.emit(&"") + # These directors own RNGs: the global seed does not control bed offsets, + # wandering or one-shot variations. Start each scene from the same mix state. + Audio.ambience().stop() + Audio.ambience()._use_set(AmbienceSet.new()) + await wait_process_frames(1) seed(1729) + Audio._rng.seed = 1729 + Audio._last_variation.clear() + Audio.ambience()._rng.seed = 1729 + Audio.music()._rng.seed = 1729 + Audio.play_score(load(KESSEL_SCORE) as MusicScore) _mix = MixScene.new() # Positional players only mix with a camera in the viewport (the game always # has one; the test runner does not).