chore(memory): R4 plan validated by the owner (BDR-057, LRN-059, LRN-060)

This commit is contained in:
bchanot committed 2026-10-18 04:42:53 +02:00
1 parent 2c8ac2ebe6
commit ac2a3bc41b
4 files changed
+38 -2

No files matched your search

+12
View File
@@ -454,3 +454,15 @@ Apply: R4 PDF worker failure states, Step 8 avatar upload errors, any capped ret
- User text into i18n templates: `.replace(re, () => value)`; string replacement expands `$&`/`$'`.
- Picker opened from a confirm dialog: call `input.click()` synchronously in the confirm handler (user activation, WebKit).
Apply: any export/backup feature, R4 PDF reader worker failures, Step 13 uploads.
## LRN-059 | 2026-10-17 | Rust `from_utf8_lossy` matches TextDecoder; serde_json differs from JSON.parse on overflow and surrogates
- `String::from_utf8_lossy` after stripping one BOM = `new TextDecoder().decode()` (non-fatal): 200,015 random + edge byte strings (overlong, UTF-8 surrogates, truncated, double BOM), 0 diff. Parity holds on tested sequences, not proven in general.
- JSON.parse vs serde_json: `1e400` → JS Infinity (JSON.stringify writes `null`), serde_json "number out of range"; lone surrogate escape kept by JS, refused by serde_json; duplicate key last value at first position in both (preserve_order). A JS path that did parse → stringify has side effects (overflow → null, dropped duplicates): reproduce them or declare them.
Apply: Rust ports of JS readers of untrusted text (R4 PDF reader, Step 13 uploads, Step 15 server validation).
## LRN-060 | 2026-10-17 | wasm-bindgen glue retains its instance until reload; only a terminated worker frees linear memory
- `--target web` glue keeps the instance in module scope (`let wasm`, `__wbg_finalize_init`); ES module records are never unloaded, so each fresh glue import (`?instance=n`) keeps its old instance and memory (BLK-012: dead instances retained until reload). Linear memory never shrinks.
- Memory-heavy one-shot work: reuse the long-lived instance (high-water kept until reload) or run in a Worker terminated after (everything freed). A "disposable instance" on the main thread is a leak, not a release.
Apply: R4 import worker and export placement, any future in-browser wasm batch job.