Skip to content

Make inclusion error output independent of the source path - #8691

Merged
cknitt merged 3 commits into
masterfrom
cristianoc/fix-inclusion-error-path-dependence
Oct 3, 2026
Merged

cknitt merged 3 commits into
masterfrom
cristianoc/fix-inclusion-error-path-dependence

Conversation

@cristianoc

@cristianoc cristianoc commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #8712.

Summary

  • Decide inclusion-error elision independently of source paths. Includemod.report_error prints a non-final part of a module inclusion error as "..." when is_big holds. is_big marshalled the error part and compared the byte size with Clflags.error_size (500). The part holds locations, so the size grew with the source file name: compiling the super_errors fixture module_sig_value_arity_mismatch_nested.res from /tmp/s printed "Modules do not match:" in full, and from a 227-character directory printed "...". Fifteen super_errors fixtures changed output the same way when compiled from a long path.

Note for review: Clflags.error_size changes unit from bytes of marshalled data to heap words (500 → 400); every existing snapshot is unchanged.

Test plan

  • dune build
  • dune build @fmt
  • dune build --profile browser @check
  • make
  • make lib
  • no change in the runtime and Belt lib/ outputs
  • make test
  • make test-analysis
  • make test-tools
  • make test-gentype
  • make test-syntax
  • make checkformat
  • npm run check

🤖 Generated with Claude Code

Includemod.report_error prints a non-final part of a module inclusion
error as "..." when is_big holds. is_big marshalled the error part and
compared the byte size with Clflags.error_size (500). The part holds
locations, so the size grew with the source file name: compiling the
super_errors fixture module_sig_value_arity_mismatch_nested.res from
/tmp/s printed "Modules do not match:" in full, and from a 227-character
directory printed "...". Fifteen super_errors fixtures changed output
the same way when compiled from a long path.

is_big now counts the words of the distinct blocks reachable from the
error part, with string contents excluded, and Clflags.error_size is
400 words. Across the super_errors fixtures the largest part printed in
full measures 298 words and the one elided part (RecordInclusion.res)
measures over 469, so every snapshot keeps its output.

The super_errors runner also compiles every fixture from a copy under a
temporary directory more than 200 characters long and compares it with
the same snapshot. Before this change that run fails for 15 fixtures
(and the in-place run fails for module_sig_value_arity_mismatch_nested
in an 83-character worktree); after it, all pass, both from that path
and from a short /tmp path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>
@cristianoc
cristianoc requested a review from cknitt October 2, 2026 06:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 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-02T06:33:04.680015Z e5512e7 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e5512e7523

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

Comment thread compiler/ml/clflags.ml
Comment thread compiler/ml/includemod.ml
Comment on lines +637 to +642
(* An error part is big when its heap representation exceeds
[!Clflags.error_size] words. Each distinct reachable block counts its header
and fields; a block without scannable fields (string, float, custom) or a
closure counts its header only. String contents are excluded so that the
decision is independent of source file names stored in locations. The walk
stops as soon as the limit is exceeded, which bounds the visited list. *)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Document this user-facing bug fix in the changelog

This changes compiler diagnostics that users see, but the commit does not update CHANGELOG.md; add an entry under the current Unreleased bug-fix section and include the PR link as required.

AGENTS.md reference: AGENTS.md:L93-L95

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added in 5eb5ae9, under the Unreleased section with the PR link.

@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.19%. Comparing base (ece8b14) to head (d470c36).
⚠️ Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
compiler/ml/includemod.ml 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8691      +/-   ##
==========================================
+ Coverage   78.67%   79.19%   +0.51%     
==========================================
  Files         476      473       -3     
  Lines       64402    64020     -382     
==========================================
+ Hits        50670    50699      +29     
+ Misses      13732    13321     -411     
Files with missing lines Coverage Δ
compiler/ml/clflags.ml 20.00% <ø> (ø)
compiler/ml/includemod.ml 75.71% <92.85%> (+0.38%) ⬆️

... and 99 files with indirect coverage changes

🚀 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.

The copies sat under a fixed 200-character padding below the temporary
directory, so on Windows the fixture paths exceeded 260 characters and bsc
could not open them ("No such file or directory" for every fixture). The
padding is now sized so the fixtures directory is 180 characters long on
every platform: still longer than any checkout path (the elision showed
from about 120), and the longest fixture path stays well below the limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Oct 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@8691

@rescript/darwin-arm64

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

@rescript/darwin-x64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: d470c36

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

@cknitt
cknitt merged commit e004c80 into master Oct 3, 2026
24 checks passed
@cknitt
cknitt deleted the cristianoc/fix-inclusion-error-path-dependence branch October 3, 2026 05: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