Repository navigation
fix(scripts): ramdisk-orchestrator resolves its mount point after argument parsing - #949
Conversation
…ument parsing The default mount point was computed at load time from $HOME, so under `set -u` the script died with "HOME: unbound variable" before --help or --mount could run whenever HOME was unset (cron, systemd, env -i). The default is now resolved after parse_args: XDG_RUNTIME_DIR, then XDG_STATE_HOME, then HOME/.local/state, each under hypatia/workspace (the path main already uses, so an existing mount is still found). With none of them set and no --mount, it says so and stops. The no-sudo scratch fallback moves to an unpredictable mktemp directory in the system temp dir instead of a $$-suffixed path inside XDG_RUNTIME_DIR, which is itself a small tmpfs. tests/ramdisk-orchestrator-test.sh covers each case in a bare env -i environment with --dry-run (nothing cloned, mounted or scanned) and is wired into tests/e2e.sh. Against main's script it fails 3 of 6. Ported from #929, which is otherwise superseded by main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xn9nqHVbUTRLgBdedoXAc8
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
What
scripts/ramdisk-orchestrator.shcomputed its default mount point when the script loaded, from$HOME. Underset -uthat meant any run withHOMEunset died withHOME: unbound variablebefore it got to--helpor--mount. That includes cron, systemd units andenv -i.This PR keeps the only part of #929 that main doesn't already have. The rest of #929 is superseded by main; see the closing comment there.
parse_args. The default isXDG_RUNTIME_DIR, elseXDG_STATE_HOME, else~/.local/state, always underhypatia/workspace. That is the path main already uses, so an existing mount is still found and reused. ci: repin standards callers to 75bd599, whose own lock GitHub accepts #929 had renamed it tohypatia-workspace, which would have orphaned that mount; this PR does not carry the rename.--mount. The script logsNo XDG_RUNTIME_DIR, XDG_STATE_HOME or HOME; pass --mount PATHand exits 1, instead of an unbound-variable crash.mktemp -d -t hypatia-workspace.XXXXXXXXin the system temp dir. Before, it used a predictable$$-suffixed path insideXDG_RUNTIME_DIR, which is itself a small tmpfs.Test
tests/ramdisk-orchestrator-test.sh(new) runs the script withenv -i, so the environment holds onlyPATH, the variables under test and an empty repos dir. Every run is--dry-runwith a repo name that doesn't exist, so nothing is cloned, mounted or scanned. It is wired intotests/e2e.sh, whichtests.ymlruns.--helpwith no HOME/XDG--mount→ refusal naming--mount--mount PATHwith no HOME/XDGXDG_RUNTIME_DIRXDG_STATE_HOMEHOME/.local/stateLocal checks:
bash -nis clean on all three files.shellcheck -S warningon the script reports only SC2034 and SC2155. Both are already on main and neither is in the lines this PR touches.tests/e2e.shend to end here: there is no Elixir in this container, so it stops at preflight. CI'stests.ymlinstalls Elixir before running it.Generated by Claude Code