Skip to content

Replace CPPO browser branches with platform modules - #8541

Merged
cristianoc merged 1 commit into
masterfrom
browser-platform-modules
Aug 10, 2026
Merged

Replace CPPO browser branches with platform modules#8541
cristianoc merged 1 commit into
masterfrom
browser-platform-modules

Conversation

@cristianoc

Copy link
Copy Markdown
Collaborator

Replace BROWSER conditionals with Dune-selected ordinary modules. The browser profile selects playground implementations while every other profile selects native implementations, keeping dev and release builds functionally identical and documenting the convention where it is applied.

Keep the platform boundary narrow: native builds use C primitives and artifact persistence, while the playground uses JavaScript-compatible primitives and no-op persistence. Keep shared Cmt_format behavior in an ordinary module and use generated source rules instead of virtual libraries, which trigger a Dune internal error with the compiler's unwrapped libraries and break @check and ocaml-lsp.

Remove CPPO from compiler sources that no longer need preprocessing, remove the unused hash_small_int test hook, and retain CPPO only for genuine type-specialization templates. Update architecture guidance and the error-variant catalog for the new source layout.

Signed-off-by: Cristiano Calcagno cristianoc@users.noreply.github.com


Stack created with GitHub Stacks CLIGive Feedback 💬

Replace BROWSER conditionals with Dune-selected ordinary modules. The browser profile selects playground implementations while every other profile selects native implementations, keeping dev and release builds functionally identical and documenting the convention where it is applied.

Keep the platform boundary narrow: native builds use C primitives and artifact persistence, while the playground uses JavaScript-compatible primitives and no-op persistence. Keep shared Cmt_format behavior in an ordinary module and use generated source rules instead of virtual libraries, which trigger a Dune internal error with the compiler's unwrapped libraries and break @check and ocaml-lsp.

Remove CPPO from compiler sources that no longer need preprocessing, remove the unused hash_small_int test hook, and retain CPPO only for genuine type-specialization templates. Update architecture guidance and the error-variant catalog for the new source layout.

Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>
@cristianoc
cristianoc force-pushed the browser-platform-modules branch from 14821f2 to b0c5f42 Compare August 10, 2026 09:34
@cristianoc
cristianoc marked this pull request as ready for review August 10, 2026 09:34
@cristianoc
cristianoc requested a review from cknitt August 10, 2026 09:35
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.71499% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.78%. Comparing base (9f26fa6) to head (b0c5f42).

Files with missing lines Patch % Lines
compiler/ext/ext_string.ml 83.10% 37 Missing ⚠️
compiler/ml/cmt_format_common.ml 68.18% 7 Missing ⚠️
compiler/core/lam_compile_main.ml 96.62% 5 Missing ⚠️
compiler/ext/ext_sys.ml 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8541      +/-   ##
==========================================
+ Coverage   74.70%   74.78%   +0.08%     
==========================================
  Files         460      466       +6     
  Lines       62389    62821     +432     
==========================================
+ Hits        46608    46983     +375     
- Misses      15781    15838      +57     
Files with missing lines Coverage Δ
compiler/core/lam_module_ident.ml 86.66% <ø> (ø)
compiler/ext/hash_set_ident_mask.ml 96.42% <100.00%> (+0.06%) ⬆️
compiler/ext/js_reserved_map.ml 88.88% <100.00%> (ø)
compiler/ml/cmt_format.ml 100.00% <100.00%> (ø)
tests/ounit_tests/ounit_hash_stubs_test.ml 68.42% <100.00%> (-3.01%) ⬇️
compiler/ext/ext_sys.ml 0.00% <0.00%> (ø)
compiler/core/lam_compile_main.ml 96.62% <96.62%> (ø)
compiler/ml/cmt_format_common.ml 78.18% <68.18%> (ø)
compiler/ext/ext_string.ml 83.10% <83.10%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new

pkg-pr-new Bot commented Aug 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8541

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8541

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8541

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8541

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8541

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8541

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8541

commit: b0c5f42

@github-actions

Copy link
Copy Markdown

@cknitt

cknitt commented Aug 10, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: b0c5f42419

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cknitt cknitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great to get rid of CPPO! Platform-specific modules are a much better mechanism. 🎉

@cristianoc
cristianoc merged commit 40835e6 into master Aug 10, 2026
29 checks passed
@cristianoc
cristianoc deleted the browser-platform-modules branch August 10, 2026 14:42
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