Sema relative import resolution needs diagnosis for omitted base directory in containerized builds
0 reputation · 09 Jul 2023, 03:19 UTC
Unresolved base directory inference for Sema relative imports
Sema's relative import resolution is documented to resolve module paths against a configurable base directory. When that override is omitted, the compiler falls back to inferring the base from the process working directory or the first source file path. In local development, this inference typically lands on the project root because the process runs from that directory. In containerized or CI environments, the working directory may be a temporary build staging path, or source files may be passed to the compiler in a different order, causing the inferred base to shift.
The documentation does not specify a guaranteed default fallback for omitted overrides, and the compiler does not appear to log a warning when the inferred base directory differs from the expected project root. This leaves an unresolved decision about how Sema should behave when the optional base-directory configuration is absent and the environment's working directory is not the project root.
What is the intended default resolution strategy when the base directory override is omitted in a non-local environment? Does Sema guarantee any specific fallback order between the process working directory and the first source file path? Is there a supported way to make the inferred base directory observable without changing the build command?