Skip to content

fix: pin the guide compiler and validate lesson output - #1439

Open
fhammerschmidt wants to merge 3 commits into
rescript-lang:masterfrom
fhammerschmidt:fix/1421-guide-compiler
Open

fhammerschmidt wants to merge 3 commits into
rescript-lang:masterfrom
fhammerschmidt:fix/1421-guide-compiler

Conversation

@fhammerschmidt

@fhammerschmidt fhammerschmidt commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

The guide previously selected the newest stable compiler on the CDN during each build. Lessons were never compiled or checked against their expected output, and a failed versions download could publish the guide without a compiler.

Pin the guide to ReScript v12.3.1 and validate lessons during prerendering:

  • Compile each starter and reference solution with the same published browser compiler, libraries, module system, and warnings as the learner's editor.
  • Reuse the browser's source instrumentation and output transformation, load the matching CDN runtime imports, and require an exact matching checkpoint log line.
  • Add optional build-only exercise.solutionCode, defaulting to the starter. The function lesson supplies a reference solution while retaining the original exercise for learners.
  • Stop builds on download, compile, runtime, or output failures, with source-file diagnostics. Reference solutions are excluded from published lesson data.
  • Report failed or stalled browser compiler loading; a stalled request displays a reload message after 15 seconds.
  • Share compiler endpoint configuration and console serialization with fix: share guide and playground compiler helpers #1441, keeping both PRs independently buildable.
  • Document compiler upgrades and the current validation contract: synchronous output, no browser-only APIs, and a one-second execution limit.

Targets website master (v12). No compiler repository changes.

Validation:

  • Strict ReScript compilation and formatting pass.
  • All 16 real compiler validation tests pass locally, including both published lessons, invalid starters and solutions, exact output mismatches, final-expression instrumentation, runtime imports and errors, runaway code, and CDN/version failures.
  • Guide production build passes. A deliberately incorrect checkpoint fails the production build with its lesson filename.
  • Generated HTML and loader data exclude reference solutions.
  • All six GitHub Actions jobs pass after the compatibility update, including all 16 real compiler checks and 53 guide browser tests. Browser regressions cover failed and stalled compiler downloads.
  • A temporary merge with fix: share guide and playground compiler helpers #1441 is conflict-free and passes strict compilation, all 97 Node tests, and the guide production build with lesson validation enabled.

Fixes #1405.
Part of #1421.

Pin browser compilation and lesson validation to ReScript v12.3.1. Compile each starter and reference solution during prerendering, then compare its runtime output with the checkpoint using the shared guide transformations.

Keep reference solutions out of published lesson data, fail builds on compiler CDN errors, and show stalled browser compiler loading with a reload message. Add real compiler validation and browser failure coverage.

Fixes rescript-lang#1405. Part of rescript-lang#1421.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T21:49:16.617083Z 9145607 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Use common compiler endpoint configuration and console serialization so the guide compiler pin and lesson validator stay compatible with the playground refactor in rescript-lang#1441.

Keep this PR independently buildable before rescript-lang#1441 is merged.

Fixes rescript-lang#1405.

Part of rescript-lang#1421.
Keep validation failures fatal while allowing the shared compiler loader refactor in rescript-lang#1441 to merge cleanly.

Part of rescript-lang#1421.

This branch has not been deployed

No deployments
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.

Guide compiler is unpinned and lessons are never validated

1 participant