Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion FIDELITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ The committed PNGs under `testdata/renders/` back every claim here. Reproduce
them with the commands at the bottom. The measured-vs-Chrome numbers live in
[`bench/REPORT.md`](bench/REPORT.md).

## 2026-11-21 (round 49) — engine#418 CLOSED for real: the goja compiler bug round 48 characterized was already fixed upstream a month before this repo's pinned commit; bumping the dependency fixes the real page end to end (fix, engine#418)

Round 48 (just below) stopped at "no safe engine-level mitigation exists" without checking whether goja itself had already addressed the bug it had just characterized — a `priorart --repo dop251/goja` search against the exact mechanism, run before concluding anything further, should have been (and now was) the very next step per this fleet's own bibliography-first rule, not an afterthought.

- `priorart --repo dop251/goja "arguments object corrupts closure variable stash slot allocation"` surfaces `dop251/goja#862`, **"Fixed extra arguments overwriting variables in the stash when arguments are copied to it"**, merged 2026-11-10 into `844f1a0e4767` — its own repro (`function F(x){ if(false) var y=1; var r=typeof y; return function(){return x+y+r}; } F(1,2,3)()`) is the SAME mechanism round 48 found by a completely different route: a closure captures a parameter, the function is called with MORE arguments than declared parameters, and the extras overwrite the stash slots holding the function's own `var`s. This repo's pinned goja commit (`v0.0.0-20260926152631-...`, 2026-09-26) predates the fix by six weeks.
- Verified directly, not assumed from the PR description: bumped the scratch repro module (not yet this repo) to the fix commit and re-ran every case from round 48's own test matrix. Every previously-wrong result is now correct — including the REAL i18next `resolve()` body with NO mitigation applied at all (`"use strict"` is no longer needed; it never was the fix). Confirmed again against `go get github.com/dop251/goja@latest` (`v0.0.0-20261121162556-79d6ad37b976`, today's HEAD).
- Bumped this repo's own `go.mod`/`go.sum` to the same latest commit and re-rendered the real `https://support.github.com/request/landing` page end to end: every string now renders correctly ("Help", "Sign in with GitHub", "Sign in with GHE", "New to GitHub? Create an account", "Unable to sign in? Get help", the full footer and cookie banner) — confirmed visually against the rendered PNG, zero instances of the `key 'X (en)' returned an object instead of string` fallback anywhere on the page.
- `go build`/`go vet`/`gofmt -l`/`go test ./...`/`govulncheck ./...` clean on the bumped dependency. `go test ./... -race` surfaces two pre-existing, unrelated flakes in `js/worker_test.go` (a synchronization gap between the test's own goroutines, nothing to do with goja or this fix) — confirmed to reproduce identically on unmodified `main` before this change (stash-and-compare, the same discipline round 46's own tests used), so out of this round's scope; filed as its own, separate, narrow gap rather than bundled into this fix.
- No upstream issue was filed against `dop251/goja`: the bug is already fixed there, so filing one would only duplicate `#862`, precisely what `priorart` exists to prevent.

## 2026-11-21 (round 48) — engine#418: the mechanism is a real goja compiler bug, reproduced in isolation and traced to its likely source; two of round 47's own conclusions corrected; no safe engine-level fix found (investigation, engine#418 — still NOT fixed, root cause now fully characterized)

Picked up round 47's open investigation. Built on its own live-patch technique (`console.log` probes inserted into a byte-for-byte copy of the real, currently-served `911-fd88881beb259e08c065.js` chunk, served through an overridden `Engine.Client.Transport` while every other request still hits the real network) with more careful comma-expression-safe insertion — an early attempt that inserted a semicolon-terminated statement mid-expression silently broke parsing and dropped the real page's own rendered element count from 842 to 150, caught and fixed before drawing any conclusion from it.
Expand Down Expand Up @@ -1722,7 +1732,7 @@ byte for byte. A round mentioned below by number (e.g. "round 105", "round
## Known gaps (updated 2026-08-30 — see the note above on why this drifted)

- **CLOSED for `document.implementation.createDocument` (round 35, 2026-11-12, engine#418 (partial)) — a minimal detached XML-shaped document (`createElement`/`createElementNS`, an optional root `documentElement`), the same scope `createHTMLDocument` (round 52) already set.** Did not exist at all before this round. Confirmed real trigger: `@azure/core-xml`'s own XML-building helper, bundled into github.com's own Support app, called unconditionally at module-evaluation time — threw and aborted the whole chunk. `createAttribute`/`NamedNodeMap.setNamedItem`/`createCDATASection`, the SAME caller's own deeper helpers, are a separate, not-yet-confirmed-reachable gap (only hit by an actual file-attachment upload), deliberately left open.
- **OPEN, root cause FOUND (a genuine upstream goja compiler bug) but NOT fixable at the engine level yet: every localized string on github.com's own Support app renders as i18next's own literal `key 'X (en)' returned an object instead of string.` fallback text (round 35, 2026-11-12; narrowed round 36, 2026-11-14; narrowed FURTHER round 47, 2026-11-15; mechanism found and two of round 47's own conclusions corrected, round 48, 2026-11-21; engine#418).** Round 48 proved the real `resolve()`'s nested `forEach` callbacks DO run (correcting round 47's "skipped entirely" theory) and reproduced the exact corruption in isolation, standalone, against the goja version this repo pins: a function with exactly one declared parameter that textually reads `arguments[N]` (`N≥1`) anywhere in its body, with any nested non-arrow `function(){}` closure capturing another local variable, corrupts that variable's storage — reproduces at 1, 2, or 3 levels of closure nesting alike. `"use strict"` (confirmed textually present AND confirmed active via a runtime probe, both in isolation and on the real page), `goja.Compile`'s own `strict` parameter, and splitting the multi-declarator `var` statement were all directly tested against the EXACT real function shape and NONE change the outcome — an earlier, over-simplified reduction inside round 48 itself had wrongly suggested they did; that conclusion is retracted. The only thing that fixes it is removing the `arguments[]` read, which this fallback cannot safely do to arbitrary third-party minified source without a real AST. Likely goja-internal cause (for an upstream report, not yet filed): `moveArgsToStash()`/`finaliseVarAlloc()` (`compiler.go:614-834`, invoked from `compiler_expr.go:1559-1615`) run their one stash-slot-allocation pass AFTER a function's entire body — including nested closures — is already compiled, and fold argument bindings into the stash whenever `arguments` is referenced anywhere in the body, apparently colliding with a slot a nested closure already captured.
- **CLOSED for every localized string on github.com's own Support app rendering as i18next's own literal `key 'X (en)' returned an object instead of string.` fallback text (round 35, 2026-11-12; narrowed round 36, 2026-11-14; narrowed FURTHER round 47, 2026-11-15; mechanism found round 48; fixed round 49, 2026-11-21; engine#418).** Root cause was a real goja compiler bug (a function with one declared parameter reading `arguments[N]`, `N≥1`, with a nested non-arrow closure capturing another local variable, corrupts that variable's storage) — already fixed upstream a month before this repo's pinned commit (`dop251/goja#862`, merged 2026-11-10). Bumping `go.mod`'s `goja` dependency is the entire fix; confirmed end to end against the real `support.github.com` page (every string renders correctly, zero fallback text) and against round 48's own full test matrix. No engine-level code change was needed.
- **PARTIALLY CLOSED for `WebAssembly.compileStreaming`/`instantiateStreaming` and the module-size/linear-memory caps (2026-11-03, engine#341) — see round 189's own entry just below, now updated: both ARE implemented, and both caps are now configurable (`Engine.MaxWasmModuleBytes`/`MaxWasmMemoryBytes`) rather than hardcoded. Everything else round 189 already disclosed as unimplemented (the synchronous `Module`/`Instance` constructors, Table/Global imports/exports, standalone `Memory`/`Table` objects, WASI) remains exactly as disclosed there — this round did not touch any of them.** `compileStreaming`/`instantiateStreaming` are not genuine incremental streaming (this engine's `fetch()` has no streaming body to begin with — see the round's own log entry above), but the JS-facing Promise/Response contract is satisfied exactly, which is what every real caller's own code actually observes.
- **CLOSED for `window.postMessage` (round 201, 2026-11-02, engine#340) — a no-op; real cross-window message delivery is not simulated (this engine's single-document model has no second window/frame to deliver to; `MessagePort`'s own `postMessage`, via `MessageChannel`, already delivers for real and is unaffected).** Did not exist as a global at all before this round — only `MessagePort.postMessage` did. Confirmed real trigger: Google's own widely-deployed reCAPTCHA script (`gstatic.com/recaptcha/...`), which calls it unconditionally at load; reproduced live on spotify.com as `ReferenceError: postMessage is not defined`.
- **CLOSED for `document.referrer` (round 200, 2026-11-01, engine#339) — always returns the empty string (this engine's single-URL fetch model has no referring-page history to report).** Did not exist at all before this round. Confirmed real trigger: Fathom Analytics' own widely-served `script.js`, whose `trackPageview()` calls `document.referrer.indexOf(hostname)` unconditionally — identically on vuejs.org and astro.build, two otherwise-unrelated sites sharing the same third-party script.
Expand Down
4 changes: 2 additions & 2 deletions bench/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ require (
github.com/andybalholm/brotli v1.2.8 // indirect
github.com/breml/rootcerts v0.3.7 // indirect
github.com/chromedp/sysutil v1.1.0 // indirect
github.com/dlclark/regexp2/v2 v2.5.2 // indirect
github.com/dop251/goja v0.0.0-20260926152631-39ec2650adc9 // indirect
github.com/dlclark/regexp2/v2 v2.11.0 // indirect
github.com/dop251/goja v0.0.0-20261121162556-79d6ad37b976 // indirect
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect
github.com/ebitengine/purego v0.11.3 // indirect
github.com/evanw/esbuild v0.28.2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions bench/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ github.com/chromedp/chromedp v0.16.0 h1:rOO4deOm4CbZgBCa8mD9g2rDyIoNs0BkgvNrlbp5
github.com/chromedp/chromedp v0.16.0/go.mod h1:rbuGKFT1vMcFcFqKfPIO1GpX/N+2s8onm2qMxZLbU5U=
github.com/chromedp/sysutil v1.1.0 h1:PUFNv5EcprjqXZD9nJb9b/c9ibAbxiYo4exNWZyipwM=
github.com/chromedp/sysutil v1.1.0/go.mod h1:WiThHUdltqCNKGc4gaU50XgYjwjYIhKWoHGPTUfWTJ8=
github.com/dlclark/regexp2/v2 v2.5.2 h1:HAsucWRhsqcDzl6Ua9aR8JwYOTzrZyPrF0/FNxJVAI0=
github.com/dlclark/regexp2/v2 v2.5.2/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU=
github.com/dop251/goja v0.0.0-20260926152631-39ec2650adc9 h1:Ksd3Vil12b/ykT5NjGzd3qNc688cJB9OUXJZZChEktI=
github.com/dop251/goja v0.0.0-20260926152631-39ec2650adc9/go.mod h1:u8yZRUavu+N4EnFFy6J5fVtjE7lEcZ2YyV2GcBXY9c8=
github.com/dlclark/regexp2/v2 v2.11.0 h1:z5uRPHav+eTVpoffDSuUP2KPS4f1ONZaPDK73S8HA0w=
github.com/dlclark/regexp2/v2 v2.11.0/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU=
github.com/dop251/goja v0.0.0-20261121162556-79d6ad37b976 h1:OuX7CZEaTVzYknG+YkXAUwflEQrQflFpndifpyPbjjs=
github.com/dop251/goja v0.0.0-20261121162556-79d6ad37b976/go.mod h1:L1yoLBco9M3b2Gdh1UZHg+BIePeAdV1bwknaLLxAgoc=
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 h1:2tV76y6Q9BB+NEBasnqvs7e49aEBFI8ejC89PSnWH+4=
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707/go.mod h1:qssHWj60/X5sZFNxpG4HBPDHVqxNm4DfnCKgrbZOT+s=
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/go-webengine/engine
go 1.27.4

require (
github.com/dop251/goja v0.0.0-20260926152631-39ec2650adc9
github.com/dop251/goja v0.0.0-20261121162556-79d6ad37b976
github.com/evanw/esbuild v0.28.2
github.com/go-browserhttp/browserhttp v0.2.0
github.com/go-gfx/gfx v0.37.0
Expand All @@ -27,7 +27,7 @@ require (
require (
github.com/andybalholm/brotli v1.2.8 // indirect
github.com/breml/rootcerts v0.3.7 // indirect
github.com/dlclark/regexp2/v2 v2.5.2 // indirect
github.com/dlclark/regexp2/v2 v2.11.0 // indirect
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect
github.com/ebitengine/purego v0.11.3 // indirect
github.com/go-images/gif v0.2.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ github.com/andybalholm/brotli v1.2.8 h1:H9F6r7RNwzSRsx/lytpIYkbjNFMt2yNBwsJ2+0gp
github.com/andybalholm/brotli v1.2.8/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/breml/rootcerts v0.3.7 h1:KZZkmd591bmq//te85L0u33zgtI3phyGlfD8u7/pzUg=
github.com/breml/rootcerts v0.3.7/go.mod h1:S/PKh+4d1HUn4HQovEB8hPJZO6pUZYrIhmXBhsegfXw=
github.com/dlclark/regexp2/v2 v2.5.2 h1:HAsucWRhsqcDzl6Ua9aR8JwYOTzrZyPrF0/FNxJVAI0=
github.com/dlclark/regexp2/v2 v2.5.2/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU=
github.com/dop251/goja v0.0.0-20260926152631-39ec2650adc9 h1:Ksd3Vil12b/ykT5NjGzd3qNc688cJB9OUXJZZChEktI=
github.com/dop251/goja v0.0.0-20260926152631-39ec2650adc9/go.mod h1:u8yZRUavu+N4EnFFy6J5fVtjE7lEcZ2YyV2GcBXY9c8=
github.com/dlclark/regexp2/v2 v2.11.0 h1:z5uRPHav+eTVpoffDSuUP2KPS4f1ONZaPDK73S8HA0w=
github.com/dlclark/regexp2/v2 v2.11.0/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU=
github.com/dop251/goja v0.0.0-20261121162556-79d6ad37b976 h1:OuX7CZEaTVzYknG+YkXAUwflEQrQflFpndifpyPbjjs=
github.com/dop251/goja v0.0.0-20261121162556-79d6ad37b976/go.mod h1:L1yoLBco9M3b2Gdh1UZHg+BIePeAdV1bwknaLLxAgoc=
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 h1:2tV76y6Q9BB+NEBasnqvs7e49aEBFI8ejC89PSnWH+4=
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707/go.mod h1:qssHWj60/X5sZFNxpG4HBPDHVqxNm4DfnCKgrbZOT+s=
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
Expand Down
Loading