fix(load): name the file and the OS cause when a script cannot be loaded - #508
Merged
Merged
Conversation
ray_load_file_fn returned a bare `io` for every failure — open, stat, map — so a missing dependency in a startup script printed `error: io`, which reads like an IPC, journal or storage failure and sends diagnosis the wrong way. Each failure now says which step failed on which file and why: `error: io: load "missing/x.rfl": No such file or directory`, `... : is a directory`, `... : cannot map N bytes: ...`. Both the mmap and the Windows fread branches. Closes #505 Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
…n .sys.args `load` resolved a relative path against the working directory only, so a script invoked from its project root and from its own directory could not both find a shared file, and piped or heredoc input — which has no file of its own — had no anchor at all. q answers this with QHOME. A relative load path is now tried against the working directory first and, when that does not exist and RAYFORCE_HOME is set, below the home; an absolute path is used as given; nested loads follow the same rule (relative to the working directory, not to the loading file, as q). A failure names every path tried. The command-line script itself is not subject to the fallback. (.sys.args) gains `source`: the file currently being evaluated — the innermost load, or the command-line script — by the path that was actually opened, so a script can locate its neighbours from any working directory; empty at the REPL, under a pipe, or in a hook or timer outside any file. `file` is the command line's script ($0); `source` follows nested loads ($BASH_SOURCE). The REPL's pseudo-file name is now a shared constant so `source` can recognise it. Closes #506 Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
feat(load): RAYFORCE_HOME fallback for relative paths, and source in .sys.args
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
loadreturned a bareioon any failure, so a missing dependency in a startup script printederror: io, indistinguishable from an IPC, journal or storage failure. Every failing step now names the file and the OS cause:Both the mmap branch and the Windows fread branch. Source file/line and the load chain, which the issue lists as ideal, are not included: the parser's nfo already attributes eval errors inside the loaded file to it, and a load-chain trace is a separate change.
Test
test/rfl/system/load_errors.rfl: the codes in-process, and the exact lines on a subprocess's stderr for a missing file and a directory, plus the non-zero exit of the failing script.Closes #505
https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg