test: TLS + HTTP/2 test vhost with the client dist served at /

The test nginx is now the production shape of DESIGN 11.1 and the browser
gate's real path (#66, spec #63 decision 6): TLS-only listener with
http2 on, a self-signed certificate generated per run (tools/tlsdev.mjs,
added to the process's default CA list so verification stays on), the
client dist at / with SPA fallback, index no-cache and a year-immutable
/assets/ cache, and the tile gate's internal /_tiles/ still unreachable.

Existing tile/doors/oneway/wallbehaviour harnesses point their server's
public origin at the https vhost, so they prove the same listener the
browser uses. tools/vhost.test.mjs is the independent node:http2 client
(cert SANs, ALPN h2, cache headers, SPA fallback, direct /_tiles/ 404);
e2e/h2.test.mjs drives devbox chromium via playwright-core and asserts
the page reports h2 (`devbox run e2e`, npm deps outside tools/).

Root devbox gains chromium + openssl. Harness builds use a worktree-local
nimcache so parallel worktrees stop corrupting each other's objects.

Refs #66
This commit is contained in:
2026-11-20 23:11:05 +01:00
parent 0448002cc5
commit 1dff520f31
18 changed files with 627 additions and 27 deletions
+6 -1
View File
@@ -27,8 +27,13 @@ export function buildServer(opts = {}) {
: path.join(projectRoot, 'run', 'test', `server-${defines.join('-').replace(/[^A-Za-z0-9-]/g, '')}`))
if (builtCache.has(key)) return builtCache.get(key)
fs.mkdirSync(path.dirname(out), { recursive: true })
// Worktree-local nimcache: Nim's default (~/.cache/nim/<project>_d) is shared by every checkout of
// the repo, so two worktrees building at once corrupt each other's object files. run/ is
// gitignored, and the variant name keeps a fault build separate from the clean build's cache.
const cache = path.join(projectRoot, 'run', 'nimcache', path.basename(out))
const args = ['c', '--hints:off', '--mm:orc', `--nimblePath:${nimblePkgs()}`,
...defines.map(d => `-d:${d}`), `-o:${out}`, path.join('server', 'main.nim')]
`--nimcache:${cache}`, ...defines.map(d => `-d:${d}`), `-o:${out}`,
path.join('server', 'main.nim')]
const r = spawnSync('nim', args, { cwd: projectRoot, encoding: 'utf8' })
if (r.status !== 0) throw new Error(`nim c server/main.nim ${defines.join(' ')} failed:\n${r.stdout}\n${r.stderr}`)
builtAt = out