Skip to content

Record the module after a qualified free path in the AST header - #8939

Merged
tsnobip merged 1 commit into
masterfrom
fix-missing-alias
Oct 21, 2026
Merged

tsnobip merged 1 commit into
masterfrom
fix-missing-alias

Conversation

@tsnobip

@tsnobip tsnobip commented Oct 21, 2026

Copy link
Copy Markdown
Member

In a namespaced package, a module that names a sibling only as Ns.Target (for example <Aria.Input /> inside the Aria package) got no dependency on it. The -bs-ast header listed the head Ns alone, and both build systems drop their own namespace, since it doesn't say which module to wait for. So User could compile before or alongside Target and fail with:

The module Ns.Target is an alias for module Target-Ns, which is missing

It could also stay stale after Target changed. Whether it failed depended on scheduling, which is why rescript-rust reported it on a project where rescript happened not to.

Depend now also records S.M for a free path S.M…. Both build systems already resolve Ns.M to M-Ns inside namespace Ns and take the head of any other dotted name, so neither needs a change.

Tests

  • New shared rewatch test compile/22-qualified-own-namespace-dependency.sh: a clean build of a namespaced package where User reaches Target only as Ns.Target, then an incremental build that must recompile User and report its type error. Without the fix it fails with both rescript and rescript-rust. With the fix it passes with both.
  • make test-rewatch and the ounit, mocha, build and docstring tests pass.

🤖 Generated with Claude Code

Why:
    In a namespaced package, a module that names a sibling only as
    `Ns.Target` got no dependency on it: the `-bs-ast` header listed the
    head `Ns` alone, and both build systems drop their own namespace, since
    it does not say which module to wait for. User could then compile
    before or alongside Target, failing with "Ns.Target is an alias for
    module Target-Ns, which is missing", or stay stale after Target
    changed. Whether it failed depended on scheduling, so `rescript-rust`
    reported it on projects where `rescript` happened not to.

Diagnostic removed (clean build of a namespaced package):
Example:
    // Target.res
    let value = 1
    // User.res
    let value = Ns.Target.value + 1
Before (diagnostic):
    The module Ns.Target is an alias for module Target-Ns, which is missing
After (diagnostic): (none)

Dependencies modified (AST header of User.res):
Before (text):
    Ns
After (text):
    Ns
    Ns.Target

Depend now also records `S.M` for a free path `S.M…`. Both build systems
already resolve `Ns.M` to `M-Ns` inside namespace `Ns` and take the head of
any other dotted name, so they need no change.

Review: Does the larger header change dependencies outside the own namespace?
    Only by adding precise ones: Rust takes the head of `Belt.Array`, and the
    OCaml builder resolves `Dep.X` to `X-Dep` when Dep is another package's
    namespace, beside the namespace map it already depends on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Paul Tsnobiladzé <[email protected]>
@github-actions

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.14%. Comparing base (38ba55a) to head (ce76999).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8939   +/-   ##
=======================================
  Coverage   81.14%   81.14%           
=======================================
  Files         456      456           
  Lines       63760    63775   +15     
=======================================
+ Hits        51738    51753   +15     
  Misses      12022    12022           
Files with missing lines Coverage Δ
compiler/ml/depend.ml 84.49% <100.00%> (+0.14%) ⬆️

... and 1 file 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.

@cknitt

cknitt commented Oct 21, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T10:48:07.609052Z ce76999 Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: ce769990f6

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

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

@rescript/darwin-arm64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: ce76999

@github-actions

Copy link
Copy Markdown

@tsnobip
tsnobip merged commit 2a7ea0c into master Oct 21, 2026
38 of 40 checks passed
@tsnobip
tsnobip deleted the fix-missing-alias branch October 21, 2026 12:02
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