docs(docs): R2 — RUST.md §8 (migrated components, operations, runtime, census, proofs, measurements, behaviour differences, risks), CLAUDE.md, DEPLOY.md (CSP before an R2 image, never built on the VPS), WORKSPACE, TEST_STRATEGY, packages README, CHANGELOG

This commit is contained in:
bchanot committed 2026-10-14 00:51:44 +02:00
1 parent 7be94d4ce6
commit 8e8c58efca
7 files changed
+306 -76

No files matched your search

+23 -7
View File
@@ -608,6 +608,13 @@ builds. The procedure below is prepared and documented now; it replaces
this way is deployed, after a separate validation**. Until then the live
deployment keeps building on the VPS as documented above.
**From R2 on (`feature/rust-r2-domain-core`), the application image
compiles the Rust core** (Dockerfile stage `wasm`: the Rust toolchain and
`wasm-bindgen-cli` in a builder stage). Such an image is never built on the
VPS (1 vCPU, 1 GB): it is built on the development machine or a runner and
pulled by digest, with the CSP of the next section in place first. The live
deployment, built from `main` before R2, is not affected.
1. Build and publish: run the manual workflow `release-images`
(`.gitea/workflows/release-images.yml`, `workflow_dispatch`, never on
push) on the forge. Prerequisite not met yet: no runner, registry or
@@ -634,14 +641,23 @@ working with the read-only token.
### WebAssembly and the CSP (from R2 on)
The application does not load the Rust core module before plan R2. When it
does, the two `Content-Security-Policy` headers of this file (nginx and
Caddy options) must carry `'wasm-unsafe-eval'` in `script-src`:
From R2 the application loads the Rust core module in the sheet pages (the
editor, the new-report submit, the PDF import). Before an R2 image is
deployed, the two `Content-Security-Policy` headers of this file (nginx and
Caddy options above) must carry `'wasm-unsafe-eval'` in `script-src`; the
examples above still show the header of the live, pre-R2 deployment:
```text
script-src 'self' 'wasm-unsafe-eval';
```
Without the keyword an R2 image stays usable but degraded: the sign-in and
account pages work, the editor shows "Le moteur de calcul de Faunosteo n'a
pas pu être chargé" with a retry, and the tab's draft is left untouched
(proven on the image by `docker/csp-proof/app-image.sh`,
`docs/development/RUST.md` §8.5). The keyword adds nothing for a pre-R2
image, so it can be set on the proxy before the switch.
Proven at R0 under the production nginx image and headers with headless
Chrome for Testing 156 (`docker/csp-proof/run.sh`, result in
`docs/development/RUST.md` §5): with `script-src 'self'` the browser refuses
@@ -651,10 +667,10 @@ the module instantiates. `'wasm-unsafe-eval'` allows WebAssembly compilation
only, never `eval` or inline scripts (the proof's inline variant was still
blocked). Browser floor for the keyword: Chrome 97, Firefox 102, Safari 16
(the Vite 7 baseline). The `.wasm` file is served as `application/wasm` by
`nginx:1.31-alpine` out of the box; at R2 `docker/nginx.conf` gains
`gzip_static on;` for a precompressed `.wasm.gz` (or `gzip_types
application/wasm`) and the served, compressed size is what the D-R13 budget
counts.
`nginx:1.31-alpine` out of the box; since R2 the image precompresses it and
`docker/nginx.conf` serves the `.wasm.gz` with `gzip_static on;` (372 KB
served for 1.18 MB raw, D-R13 budget 600 KB). A proxy in front must pass
`Content-Encoding` through and keep the `application/wasm` type.
---