You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
compile: no module search-path / project build mode — nested src/** use SiblingModule fails #642
The core-WASM compile command is single-file only — it has no module search path, so a nested src/** project layout where one module does use SiblingModule fails to resolve ("undefined module"). Downstream, the svalinn gateway (stapeln/container-stack/svalinn/src) cannot be compiled as a project.
Evidence
affinescript compile exposes only [--target TRIPLE] FILE [-o OUT] (bin/main.ml, the compile term is target_arg $ path_arg $ output_arg). There is no --search-path / project / manifest option, and the Module_loader is built from defaults, so a use SiblingModule referencing another file under src/ relative to the entry file is not found.
Suggested direction
Either:
a repeatable --search-path DIR flag threaded into the Module_loader config used by compile, or
a project/manifest build mode (compile a directory / a manifest) that roots module search at the project src/.
Context
Surfaced while characterising svalinn-gateway compiler gaps after the cross-module constructor-link fix (#138 / #602, ac98c81). This is a separate gap — module resolution at compile time, not constructor codegen. Confirmed at mainb8ba479.
Checked on main at 70379fe (21 Nov). This gap appears to be closed already, by the loader work in #788 / #797.
What is on main now
Module_loader.config_for_file roots module search at the package root (from the file's module A.B; declaration) and keeps the file's own directory on the search path. Every CLI command, compile included, builds its loader through loader_config_for_file in bin/main.ml.
$AFFINESCRIPT_PATH (colon-separated) adds extra search directories. That covers the "repeatable --search-path" suggestion, without a new flag.
Unit test sibling_import_from_nested in test/test_module_root_flatten.ml covers the nested sibling case.
What I ran locally (OCaml 4.14.1, dune 3.14)
test_main.exe: 589 tests, all pass.
affinescript compile on a nested src/ project, run from an unrelated working directory:
src/Main.affine with use Helper::{h}; (sibling src/Helper.affine): compiles to WASM.
src/gateway/Server.affine (module gateway.Server;) with use Route::{r}; (short sibling): compiles.
the same file with use gateway.Route2::{r}; plus use Helper::{h}; (full path and package-root module): compiles.
A file that declares module Route; but is imported as gateway.Route is refused with a resolution error. That is the intended declared-path check, not this bug.
Caveat
CI has not started on main since 11 Oct (fixed by #803), so none of this has run in CI yet. I suggest that you merge #803, let CI run on main, and then close this issue. The svalinn gateway itself was not tested here.
Activity
docs: onboarding polish — tutorial lesson-01 + audience router + STAT…
Fix remaining parser, face, module, and CI issues
fix: multi-module programs check, evaluate and compile (found running…
hyperpolymath commentedon Nov 21, 2026
Checked on
mainat 70379fe (21 Nov). This gap appears to be closed already, by the loader work in #788 / #797.What is on main now
Module_loader.config_for_fileroots module search at the package root (from the file'smodule A.B;declaration) and keeps the file's own directory on the search path. Every CLI command,compileincluded, builds its loader throughloader_config_for_fileinbin/main.ml.$AFFINESCRIPT_PATH(colon-separated) adds extra search directories. That covers the "repeatable--search-path" suggestion, without a new flag.sibling_import_from_nestedintest/test_module_root_flatten.mlcovers the nested sibling case.What I ran locally (OCaml 4.14.1, dune 3.14)
test_main.exe: 589 tests, all pass.affinescript compileon a nestedsrc/project, run from an unrelated working directory:src/Main.affinewithuse Helper::{h};(siblingsrc/Helper.affine): compiles to WASM.src/gateway/Server.affine(module gateway.Server;) withuse Route::{r};(short sibling): compiles.use gateway.Route2::{r};plususe Helper::{h};(full path and package-root module): compiles.module Route;but is imported asgateway.Routeis refused with a resolution error. That is the intended declared-path check, not this bug.Caveat
CI has not started on
mainsince 11 Oct (fixed by #803), so none of this has run in CI yet. I suggest that you merge #803, let CI run on main, and then close this issue. The svalinn gateway itself was not tested here.No code change proposed, so no PR.
Generated by Claude Code