Skip to content

docs: Fugue Explorables — interactive, data-first documentation rehaul - #39

Merged
alexnodeland merged 5 commits into
mainfrom
docs/explorables
Jul 21, 2026
Merged

docs: Fugue Explorables — interactive, data-first documentation rehaul#39
alexnodeland merged 5 commits into
mainfrom
docs/explorables

Conversation

@alexnodeland

@alexnodeland alexnodeland commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Fugue Explorables — an interactive, data-first docs rehaul

A new Explorables section explorable-explanations grammar with visual math language, plus a full 0.2.0 truth pass over every existing page.

The design system

  • One metaphor: a Model is a score, a Handler is a performer, a Trace is a recording, inference is listening backwards.
  • One color algebra across every canvas, equation, and sentence: prior (blue) × likelihood (yellow) = posterior (green); coral = current sample, violet = momentum/structure. KaTeX terms are colored to match the pixels.
  • The law: no widget without a live distribution over real data. Data points are draggable; posteriors update same-frame; parameter space and data space are linked views (a point on one side is a curve on the other).
  • Everything is seeded and reproducible (a seeded run is a replayable trace — fugue's own worldview), dependency-free vanilla JS (no CDNs, works offline), theme-aware, reduced-motion safe, keyboard accessible.

The six pages

Page What you touch
Anatomy of a Probabilistic Program Click coins into existence, scrub the Beta prior, watch sequential updating leave ghost trails
The Model Is a Score Drag five observations; exact conjugate posterior follows your hand; fugue's CPS chain performs below, Prior vs Replay handlers rain 200 draws
Random Walks in Posterior Space Bayesian regression twin-panel: drag data mid-run and the posterior heatmap deforms under the MH chain; live split-R̂/ESS (0.2.0 diagnostics math ported to JS)
Rolling, Not Guessing: HMC Same dataset; leapfrog trajectories, momentum arrows, divergence counter, energy strip-chart, MH race at matched budget
Particles That Tell Stories SMC with weight-sized particles, resampling lineage fans, live filtering-distribution ribbon + mean ±1σ band
A Field Guide to Distributions All 17 distributions, real constructor params/constraints, sampler racing its own density, natural-return-type badges

Content truth pass (all existing pages)

Five reviewer agents verified every code snippet against src/ and examples/. Fixed: broken for-loop-in-prob! snippets (the macro can't parse them), a duplicate-address hierarchical sample that panics at runtime, a fabricated ScoreGivenTrace::new().score() API, dead gaussian_mean example references, wrong repo URLs, stale memory-subsystem claims, and missing 0.2.0 coverage (HMC in the architecture diagram, i64 natural return type, normalized ESS note).

Site bug fixed

default-theme = "dark" is not a valid mdbook theme name — light-OS visitors silently got light CSS while <html class="dark"> claimed otherwise. Now navy (+ preferred-dark-theme), and the viz library detects dark/light from mdbook's own --bg token rather than trusting class names.

Verification

  • mdbook build clean; node --check on all 7 JS files; distribution math spot-checked against known values (17 checks).
  • Playwright drive-through of every page: zero console errors, Step/Play/drag/slider smoke tests, dark + light themes, 1280px and 420px (no horizontal overflow).
  • All 38 internal links resolve; SUMMARY diff is pure addition; every Rust snippet on the new pages API-verified against src/ (adaptive_mcmc_chain, hmc_chain, ReplayHandler fields, Model enum variants, trampoline shape…).

🤖 Generated with Claude Code

https://claude.ai/code/session_01DEAKcbnLVP8iSXub2Pqor2

Adds an Explorables section: six interactive pages in the tradition of
Bret Victor's explorable explanations and 3Blue1Brown's visual math,
built on a shared dependency-free canvas library (docs/fugue-viz.js,
~5k lines total, no CDNs, no build step, theme-aware, reduced-motion
safe, seeded/reproducible).

Every widget centers on live data: draggable observations with priors
and posteriors updating in real time. Metropolis and HMC share one
Bayesian linear regression as twin-panel views (data space with
posterior spaghetti <-> parameter space with the sampler), with live
split-R-hat/ESS implementing the 0.2.0 diagnostics math in JS. The
monad page performs a Normal-mean model one effect at a time over a
draggable dataset with its exact conjugate posterior. SMC shows the
filtering distribution and mean band over its particle cloud.

Also a 0.2.0 truth pass over all existing pages: fixed broken prob!
snippets (raw for-loops the macro cannot parse), a duplicate-address
hierarchical sample that would panic, a fabricated ScoreGivenTrace
API, dead example references, wrong repo URLs, and stale memory-
subsystem claims; every remaining snippet verified against src/.

Fixes a live site bug: default-theme was "dark", which is not an
mdbook theme name, so light-OS visitors got the light CSS fallback
while the html class claimed dark; now navy, and the viz library
detects dark/light from mdbook's --bg token instead of class names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEAKcbnLVP8iSXub2Pqor2
Copilot AI review requested due to automatic review settings July 13, 2026 16:35
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

alexnodeland and others added 4 commits July 13, 2026 14:05
…ages

Every widget now autoplays when scrolled into view (pausing offscreen;
reduced-motion gets a rich pre-rendered frame, never an empty axis) and
heroes pre-warm so first paint already shows a running system.

Adds docs/viz/inline.js: ten parameterized ambient micro-widgets
(dist-strip, posterior-morph, trace-ticker, rhat-spark, shrinkage,
regression-mini, mixture-resp, logistic-boundary, elbo-climb, abc-eps)
with real math inside (split-R-hat and ESS ported from
src/inference/diagnostics.rs, EM responsibilities, conjugate updates),
embedded at the point of discussion across ~20 pages — including a
deliberately unconverged rhat-spark on debugging-models and a live
partial-pooling shrinkage widget on hierarchical-models.

Removes all "new in 0.2.0"-style callouts (13 sites incl. the
distributions widget's selector group) — version history lives in the
CHANGELOG, not the docs.

Browser-verified: all 25 widget-bearing pages animate on arrival, zero
console errors, zero >50ms long tasks during ambient play on the
busiest pages, reduced-motion renders rich static frames (fixed a
resize race that blanked paused micro-widgets).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEAKcbnLVP8iSXub2Pqor2
Fixes the root cause of mobile bugginess: .fv-canvas set touch-action:
none on EVERY canvas, so thumb swipes over any figure ate page scroll.
Canvases now default to pan-y; full gesture capture is opt-in via a
shared FV.drag manager (pointer capture, claims the gesture only when
the touch actually hits a draggable, >=22px hit inflation on coarse
pointers, grab halo). Killed the same class in inline.js (unconditional
preventDefault on touchmove) and in every hero's hand-rolled drag code;
monad's machinery strip no longer steals scroll swipes as Steps;
flash decay is time-based; layouts audited at 390px and 320px.

Adds docs/viz/minis.js — eight page-support figures woven into the
explorables' explanation sections: autocorrelation decay and a live
sigma-sweep on Metropolis, the double-well momentum-vs-random-walk
strip and a divergence-cliff scatter on HMC, an animated bind-chain
on the monad page, sequential-update small multiples on Anatomy, an
ESS timeline on SMC, and a natural-return-types flow on Distributions.

Mobile-verified via emulated 390x844 touch contexts with CDP touch
events: swipe-over-widget scrolls the page, point-drags move points
without scrolling, zero console errors, zero >50ms long tasks; full
desktop regression green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEAKcbnLVP8iSXub2Pqor2
…isibly converge

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018yo1jdkckG7yQ9eBqLbaDB
…ink)

Starts at ±3.4 stationary SDs with thin warmup threads (SD 0.32), a held
separated phase, then a smoothstep funnel onto the shared band. Before,
starts ±2.2 with SD 0.65 meant the merged band spanned nearly the same
pixels as the separated chains — nothing visibly converged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018yo1jdkckG7yQ9eBqLbaDB
@alexnodeland
alexnodeland merged commit 32285a0 into main Jul 21, 2026
5 checks passed
@alexnodeland
alexnodeland deleted the docs/explorables branch July 21, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants