forked from tas/major_tom
Disable origin cache headers to prevent stale JS/WASM mismatch
static-web-server's default cache-control sends max-age=31536000 (1 year) for .js files but only 1 day for .wasm. After redeployment, Cloudflare CDN serves the cached old .js with a fresh .wasm, causing EM_ASM address table mismatches and runtime crashes. Disable built-in cache headers at the origin so Cloudflare respects new content on each deploy. Also update AGENTS.md: add deploy commands, fix emsdk path, document the Cloudflare cache-purge requirement, and correct stale MAX_ENTITY_SPAWNS and MAX_EXIT_ZONES values.
This commit is contained in:
12
AGENTS.md
12
AGENTS.md
@@ -21,7 +21,9 @@ make DEBUG=1 # Alternative debug flag
|
||||
make web # WASM build → dist-web/
|
||||
make web-serve # WASM build + HTTP server on :8080
|
||||
make windows # Cross-compile → dist-win64/
|
||||
make k8s # Build web + container image + deploy to local k3s
|
||||
make clean # Remove all build artifacts
|
||||
./deploy.sh # Full deploy: clean build → container → k3s rollout
|
||||
```
|
||||
|
||||
Compiler flags: `-Wall -Wextra -std=c11 -I include -I src`
|
||||
@@ -33,11 +35,15 @@ There are no test or lint targets. Verify changes by building with `make` and co
|
||||
- **WASM builds** require the Emscripten SDK. The `emsdk/` directory in the project root is
|
||||
gitignored; source the environment before building:
|
||||
```bash
|
||||
source ~/emsdk/emsdk_env.sh # or wherever emsdk is installed
|
||||
source emsdk/emsdk_env.sh
|
||||
make web
|
||||
```
|
||||
- **Windows cross-compilation** requires MinGW (`x86_64-w64-mingw32-gcc`) and vendored
|
||||
SDL2 development libraries in `deps/win64/` (also gitignored).
|
||||
- **Web deployment** goes through Cloudflare CDN (`jnr.schick-web.site`). After deploying
|
||||
a new build, **purge the Cloudflare cache** so stale `.js`/`.wasm` files are not served.
|
||||
Emscripten's `.js` and `.wasm` outputs are tightly coupled (EM_ASM address tables must
|
||||
match); serving a cached `.js` with a fresh `.wasm` causes runtime crashes.
|
||||
|
||||
## Project Structure
|
||||
|
||||
@@ -264,5 +270,5 @@ incremental progress.
|
||||
| `TICK_RATE` | 60 | Fixed timestep Hz |
|
||||
| `DEFAULT_GRAVITY` | 980.0f | px/s² |
|
||||
| `MAX_ENTITIES` | 512 | Entity pool size |
|
||||
| `MAX_ENTITY_SPAWNS` | 128 | Per-level spawn slots |
|
||||
| `MAX_EXIT_ZONES` | 8 | Per-level exit zones |
|
||||
| `MAX_ENTITY_SPAWNS` | 512 | Per-level spawn slots |
|
||||
| `MAX_EXIT_ZONES` | 16 | Per-level exit zones |
|
||||
|
||||
Reference in New Issue
Block a user