Skip to content

Commit 35c7081

Browse files
feat(wasm): add the fix-candidate output pane to five more recipes
Layer 1 pages showed one of two different output sections depending on when the recipe was written. `dateutil-1478` and `lark-1585` render "Baseline output" above "Fix-candidate output"; the other six render a single "Output". That split was an accident of authoring order, not a decision, and it left the numpy page looking a generation behind the dateutil one. Seeing the wrong result next to the right one is the point of a reproduction page. One pane only tells a visitor that something is broken; two tell them what "fixed" looks like. So the two-pane block becomes the Layer 1 default, and this commit moves five recipes onto it: cpython-137205, numpy-28287, pandas-56679, php-12167, ruby-21709. regex-779 lands separately because its second pane runs a real build. None of those five has a corrected build this page can execute, so the second pane says exactly that and names the upstream status. It never shows a hand-written "expected" output — Vivarium reproduces, it does not assert. Verified upstream state, rather than trusting the recipe READMEs: numpy/numpy#28287 open. The only merged response is a deprecation of the generic unit (PR 29619, milestone 2.5.0), not a behaviour fix. python/cpython#137205 open. pandas-dev/pandas#56679 open. bugs.ruby-lang.org#21709 open. php/php-src#12167 fixed in PHP 8.2.12 — but see below. php-12167 is the interesting one, and its README said something that is no longer true. The recipe was documented as a "sentinel" that would flip to `unreproduced` once php-wasm shipped a build past 8.2.12. It would not. [email protected] does ship PHP 8.4.1, but its default build has no SimpleXML: `simplexml_load_string()` is undefined, so bumping the pin does not flip the verdict, it breaks the reproduction — and reports a false fix signal while doing it. The one prerelease between 0.0.8 and 0.1.0 never finished initialising. Both verified in-browser; the README now records that instead of the old premise. `.vh-variant-output--note` is new in the shared stylesheet. `<pre>` defaults to `white-space: pre`, which is right for JSON but turns a one-line sentence into a horizontal scroll that clips mid-word — observed on the live dateutil page before writing this. The panes also carry `data-fix-status`, so the state is readable without parsing prose. The follow-up that makes the two-pane block mandatory can assert on it, in both locales, instead of matching text. Not in this commit: regex-779's real fixed build, and the validator change that requires the block on every recipe. The validator has to land after every recipe conforms or it red-lights main — so the docs added here say plainly that today's check covers only recipes shipping a `fix-candidate.json`, rather than promising enforcement that does not exist yet. Also folded in: regex-779, php-12167 and ruby-21709 each carried three `<link rel="preload">` tags for Pyodide's `pyodide.asm.wasm`, `python_stdlib.zip` and `pyodide-lock.json` — copy-paste from the Pyodide template. None of the three loads Pyodide (they run a Rust wasm32-wasip1 binary, php-wasm and Ruby.wasm respectively), so every visitor to those pages was fetching roughly 10 MB of assets nothing ever read. The `preconnect` to jsDelivr stays; all three still pull their own runtime from it. Drive-by: `.claude/launch.json` pointed at bun 1.3.14 and uv 0.11.14, neither of which is installed any more, so `preview_start` failed with ENOENT. Repointed at the current mise installs. Co-Authored-By: Claude Opus 5 <[email protected]>
1 parent 9c4ae97 commit 35c7081

16 files changed

Lines changed: 260 additions & 39 deletions

File tree

‎.claude/launch.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"configurations": [
44
{
55
"name": "vivarium-docs",
6-
"runtimeExecutable": "C:\\Users\\Jam\\AppData\\Local\\mise\\installs\\bun\\1.3.14\\bin\\bun.exe",
6+
"runtimeExecutable": "C:\\Users\\Jam\\AppData\\Local\\mise\\installs\\bun\\1.4.0\\bin\\bun.exe",
77
"runtimeArgs": ["--cwd=docs", "run", "dev"],
88
"port": 3000
99
},
1010
{
1111
"name": "vivarium-layer1",
12-
"runtimeExecutable": "C:\\Users\\Jam\\AppData\\Local\\mise\\installs\\uv\\0.11.14\\uv.exe",
12+
"runtimeExecutable": "C:\\Users\\Jam\\AppData\\Local\\mise\\installs\\uv\\0.12.8\\uv.exe",
1313
"runtimeArgs": ["run", "--no-project", "--python", "3.13", "python", "-m", "http.server", "8767", "--directory", "src/layer1_wasm"],
1414
"port": 8767
1515
}

‎.claude/rules/recipe-authoring.md‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,60 @@ Use the helpers in
187187
[`src/layer1_wasm/_shared/verdict.ts`](../../src/layer1_wasm/_shared/verdict.ts)
188188
so DOM and globals stay in sync.
189189

190+
**Output section — two panes, always**:
191+
192+
Every Layer 1 page shows the buggy behaviour and the corrected
193+
behaviour side by side. There is no single-pane variant; a recipe
194+
with no fix to run still ships both panes and says so in the second
195+
one. Copy the block from
196+
[`dateutil-1478/index.html`](../../src/layer1_wasm/dateutil-1478/index.html):
197+
198+
```html
199+
<section class="vh-main__col vh-main__col--output vh-output-multi">
200+
<header class="vh-variant-head" data-variant="baseline">
201+
<h2 class="vh-variant-head__title" data-i18n="section.baseline.h2">Baseline output</h2>
202+
</header>
203+
<div class="vh-variant-stage" data-variant="baseline">
204+
<pre id="output" class="vh-variant-output" data-i18n="output.pending">(pending)</pre>
205+
</div>
206+
207+
<header class="vh-variant-head vh-variant-head--secondary" data-variant="fix-candidate">
208+
<h2 class="vh-variant-head__title" data-i18n="section.fix.h2">Fix-candidate output</h2>
209+
</header>
210+
<pre id="output-fix" class="vh-variant-output" data-i18n="output.waitingBaseline">(waiting for baseline)</pre>
211+
</section>
212+
```
213+
214+
- `.vh-variant-stage` around `#output` is **required**.
215+
[`_assets/chrome.js`](../../src/layer1_wasm/_assets/chrome.js) inserts
216+
`<div class="vh-progress">` into `#output`'s parent; without the
217+
wrapper the loading overlay pushes the fix pane down the page.
218+
- All styling lives in
219+
[`_shared/style.css`](../../src/layer1_wasm/_shared/style.css)
220+
(`.vh-output-multi`, `.vh-variant-*`). Per-recipe CSS is not needed.
221+
- Three ways to fill the fix pane, in order of preference:
222+
1. **Fork wheel** — `fix-candidate.json` + the helpers in
223+
[`_shared/fix-candidate.ts`](../../src/layer1_wasm/_shared/fix-candidate.ts).
224+
Pure-Python packages only; see `dateutil-1478` (main-thread) and
225+
`lark-1585` (one Web Worker per variant).
226+
2. **A second artefact built from a fixed dependency version** —
227+
e.g. a second `wasm32-wasip1` binary, or a different runtime build.
228+
3. **No candidate** — when no fixed build can be executed in the
229+
browser. Use `data-i18n="output.noFixCandidate"` plus the
230+
`vh-variant-output--note` class (which wraps prose instead of
231+
scrolling it), and name the upstream status in the text. **Never
232+
hand-write an "expected" output**: the pane must only ever show
233+
something that actually ran.
234+
- The top-level `#verdict` pill mirrors the **baseline only**. A red
235+
pill driven by the fix pane would flag its desired `unreproduced`
236+
as a failure.
237+
- `scripts/validate-fix-candidates.ts` checks this markup at build
238+
time, but **only on recipes that ship a `fix-candidate.json`** — the
239+
no-candidate variant is not yet covered, so review the block by eye
240+
until `regex-779` converts and the check widens to every recipe. If
241+
you adopt a new variant mechanism, extend that script in the same PR
242+
rather than carving the recipe out.
243+
190244
**Local validation**:
191245

192246
```bash

‎src/layer1_wasm/README.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,33 @@ Each new Layer 1 recipe is its own immediate subdirectory of this folder
5252
contain an `index.html`; companion files (`repro.ts`, `README.md`,
5353
fixtures, generated-highlight inputs) live alongside.
5454

55+
## Page shape — two output panes
56+
57+
Every recipe page puts the reproduction script on the left and **two**
58+
output panes on the right: **Baseline output**, the behaviour visitors
59+
came to see, and **Fix-candidate output**, the same reproduction run
60+
against a build where the bug is fixed. Seeing both at once is the
61+
point of the page — a single pane only tells you something is wrong,
62+
not what "right" looks like.
63+
64+
Not every bug has a fixed build that can run in a browser. When it
65+
does not — the upstream issue is still open, or the fixed build cannot
66+
be produced for WASM — the second pane says exactly that and names the
67+
upstream status. It never shows a hand-written "expected" output:
68+
Vivarium reproduces, it does not assert.
69+
70+
The markup is shared — copy it from
71+
[`dateutil-1478/`](./dateutil-1478/), the reference implementation.
72+
73+
Build-time enforcement is currently **partial**:
74+
[`scripts/validate-fix-candidates.ts`](./scripts/validate-fix-candidates.ts)
75+
checks the two-pane markup only on recipes that ship a
76+
`fix-candidate.json`, so a recipe using the no-candidate variant can
77+
still ship a malformed or missing pane. Widening that check to every
78+
recipe waits on `regex-779`, the last page still on the single-pane
79+
markup — a validator that requires the block before every recipe has
80+
it would fail the build on `main`.
81+
5582
## Verdict surface
5683

5784
Every Layer 1 reproduction emits its verdict via the in-page surface

‎src/layer1_wasm/_shared/style.css‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,16 @@ body.vh-drawer-open {
16691669
box-sizing: border-box;
16701670
}
16711671

1672+
/* A pane holding a status note rather than program output — the
1673+
* "no fix candidate yet" state on recipes whose upstream fix cannot
1674+
* be executed in the browser. `<pre>` defaults to `white-space: pre`,
1675+
* which is right for JSON output but turns a one-line sentence into a
1676+
* horizontal scroll that clips mid-word. Prose wraps instead. */
1677+
.vh-variant-output--note {
1678+
white-space: pre-wrap;
1679+
overflow-wrap: anywhere;
1680+
}
1681+
16721682
/* Multi-variant recipes (recipes that stack several `<pre>` output
16731683
* panels in one page): opt out of chrome.js's single-output grid by
16741684
* adding `vh-output-multi` to the output column.

‎src/layer1_wasm/cpython-137205/i18n.ja.json‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
"page.h1": "{0} の再現",
1414
"chip.bugContext": "{0} bug の背景",
1515
"section.script.h2": "再現スクリプト",
16-
"section.output.h2": "出力",
17-
"output.placeholder": "(実行中)",
16+
"section.baseline.h2": "baseline の出力",
17+
"output.pending": "(待機中)",
18+
"section.fix.h2": "fix 候補の出力",
19+
"output.noFixCandidate": "(fix 候補はまだありません — python/cpython#137205 は upstream で未解決)",
1820
"page.title": "Vivarium · python/cpython#137205 の再現",
1921
"verdict.pending": "Pyodide runtime を読み込み中…",
2022
"drawer.body.p1": "Python の {0} は、{2} で開いた接続では {1} を黙って捨てる。{3} で開いた別の接続では同じ PRAGMA が効くため、本来同じ FK 強制になるはずの 2 つの接続が食い違う。",

‎src/layer1_wasm/cpython-137205/index.html‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,31 @@ <h2 data-i18n="section.script.h2">Reproduction script</h2>
104104
<span class="line"><span style="color:#E1E4E8">}</span></span></code></pre>
105105
</section>
106106

107-
<section class="vh-main__col vh-main__col--output">
108-
<h2 data-i18n="section.output.h2">Output</h2>
109-
<pre id="output" data-i18n="output.placeholder">(running)</pre>
107+
<section class="vh-main__col vh-main__col--output vh-output-multi">
108+
<header class="vh-variant-head" data-variant="baseline">
109+
<h2 class="vh-variant-head__title" data-i18n="section.baseline.h2">
110+
Baseline output
111+
</h2>
112+
</header>
113+
<div class="vh-variant-stage" data-variant="baseline">
114+
<!-- chrome.js inserts <div class="vh-progress"> before #output;
115+
the stage stacks both children in one grid cell so the
116+
overlay covers the pre during loading without taking
117+
extra column height. -->
118+
<pre id="output" class="vh-variant-output" data-i18n="output.pending">(pending)</pre>
119+
</div>
120+
121+
<header class="vh-variant-head vh-variant-head--secondary" data-variant="fix-candidate">
122+
<h2 class="vh-variant-head__title" data-i18n="section.fix.h2">
123+
Fix-candidate output
124+
</h2>
125+
</header>
126+
<pre
127+
id="output-fix"
128+
class="vh-variant-output vh-variant-output--note"
129+
data-fix-status="none"
130+
data-i18n="output.noFixCandidate"
131+
>(no fix candidate yet — python/cpython#137205 is still open upstream)</pre>
110132
</section>
111133
</div>
112134

‎src/layer1_wasm/numpy-28287/i18n.ja.json‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
"page.h1": "{0} の再現",
1414
"chip.bugContext": "{0} bug の背景",
1515
"section.script.h2": "再現スクリプト",
16-
"section.output.h2": "出力",
17-
"output.placeholder": "(実行中)",
16+
"section.baseline.h2": "baseline の出力",
17+
"output.pending": "(待機中)",
18+
"section.fix.h2": "fix 候補の出力",
19+
"output.noFixCandidate": "(fix 候補はまだありません — numpy/numpy#28287 は upstream で未解決)",
1820
"page.title": "Vivarium · numpy/numpy#28287 の再現",
1921
"verdict.pending": "Pyodide runtime を読み込み中…",
2022
"drawer.body.p1": "NumPy の {0} の順序付けは、値のひとつが {1} 単位を使っていると推移的でなくなる。{2}、{3}、{4} に対して NumPy は {5} と {6} を報告するのに {7} となる——組み込みの比較演算子における推移律の違反。",

‎src/layer1_wasm/numpy-28287/index.html‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,31 @@ <h2 data-i18n="section.script.h2">Reproduction script</h2>
103103
<span class="line"><span style="color:#E1E4E8">}</span></span></code></pre>
104104
</section>
105105

106-
<section class="vh-main__col vh-main__col--output">
107-
<h2 data-i18n="section.output.h2">Output</h2>
108-
<pre id="output" data-i18n="output.placeholder">(running)</pre>
106+
<section class="vh-main__col vh-main__col--output vh-output-multi">
107+
<header class="vh-variant-head" data-variant="baseline">
108+
<h2 class="vh-variant-head__title" data-i18n="section.baseline.h2">
109+
Baseline output
110+
</h2>
111+
</header>
112+
<div class="vh-variant-stage" data-variant="baseline">
113+
<!-- chrome.js inserts <div class="vh-progress"> before #output;
114+
the stage stacks both children in one grid cell so the
115+
overlay covers the pre during loading without taking
116+
extra column height. -->
117+
<pre id="output" class="vh-variant-output" data-i18n="output.pending">(pending)</pre>
118+
</div>
119+
120+
<header class="vh-variant-head vh-variant-head--secondary" data-variant="fix-candidate">
121+
<h2 class="vh-variant-head__title" data-i18n="section.fix.h2">
122+
Fix-candidate output
123+
</h2>
124+
</header>
125+
<pre
126+
id="output-fix"
127+
class="vh-variant-output vh-variant-output--note"
128+
data-fix-status="none"
129+
data-i18n="output.noFixCandidate"
130+
>(no fix candidate yet — numpy/numpy#28287 is still open upstream)</pre>
109131
</section>
110132
</div>
111133

‎src/layer1_wasm/pandas-56679/i18n.ja.json‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
"page.h1": "{0} の再現",
1414
"chip.bugContext": "{0} bug の背景",
1515
"section.script.h2": "再現スクリプト",
16-
"section.output.h2": "出力",
17-
"output.placeholder": "(実行中)",
16+
"section.baseline.h2": "baseline の出力",
17+
"output.pending": "(待機中)",
18+
"section.fix.h2": "fix 候補の出力",
19+
"output.noFixCandidate": "(fix 候補はまだありません — pandas-dev/pandas#56679 は upstream で未解決)",
1820
"page.title": "Vivarium · pandas-dev/pandas#56679 の再現",
1921
"verdict.pending": "Pyodide runtime を読み込み中…",
2022
"drawer.body.p1": "{0} は dtype {1} を返すのに、{2} は dtype {3} を返す。この 2 つのコンストラクタは、空の入力に対して一貫した dtype を返すべき。",

‎src/layer1_wasm/pandas-56679/index.html‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,31 @@ <h2 data-i18n="section.script.h2">Reproduction script</h2>
9292
<span class="line"><span style="color:#E1E4E8">}</span></span></code></pre>
9393
</section>
9494

95-
<section class="vh-main__col vh-main__col--output">
96-
<h2 data-i18n="section.output.h2">Output</h2>
97-
<pre id="output" data-i18n="output.placeholder">(running)</pre>
95+
<section class="vh-main__col vh-main__col--output vh-output-multi">
96+
<header class="vh-variant-head" data-variant="baseline">
97+
<h2 class="vh-variant-head__title" data-i18n="section.baseline.h2">
98+
Baseline output
99+
</h2>
100+
</header>
101+
<div class="vh-variant-stage" data-variant="baseline">
102+
<!-- chrome.js inserts <div class="vh-progress"> before #output;
103+
the stage stacks both children in one grid cell so the
104+
overlay covers the pre during loading without taking
105+
extra column height. -->
106+
<pre id="output" class="vh-variant-output" data-i18n="output.pending">(pending)</pre>
107+
</div>
108+
109+
<header class="vh-variant-head vh-variant-head--secondary" data-variant="fix-candidate">
110+
<h2 class="vh-variant-head__title" data-i18n="section.fix.h2">
111+
Fix-candidate output
112+
</h2>
113+
</header>
114+
<pre
115+
id="output-fix"
116+
class="vh-variant-output vh-variant-output--note"
117+
data-fix-status="none"
118+
data-i18n="output.noFixCandidate"
119+
>(no fix candidate yet — pandas-dev/pandas#56679 is still open upstream)</pre>
98120
</section>
99121
</div>
100122

0 commit comments

Comments
 (0)