Repository navigation
Provide dimn in the curl nightly installer - #2178
Conversation
eric8810
left a comment
There was a problem hiding this comment.
dimn is a relative symlink to the stable dim-nightly entry, so it follows upgrades without its own version pointer. An existing path, including an unrelated dangling link, is preserved, and the CLI chooses its nightly home/update channel from the build version rather than the invoked alias. Exact-head scripts CI passed the nightly install/upgrade/conflict fixture; ci-ok passed. The isolated macOS smoke is author-reported.
Non-blocking: the shortcut is optional, so a late ln error after the main entry has already been switched could be a warning instead of making the installer return failure.
zerob13
left a comment
There was a problem hiding this comment.
One blocker in the new alias behavior (scripts/install-nightly.sh:42–53): the active dim-nightly command is switched before the optional dimn install. If the alias path becomes occupied during installation, alias creation can fail and cause the installer to report failure after the active version has changed. That contradicts the advertised keep-existing behavior. Verify that an existing or newly occupied alias is left untouched and the result accurately reports whether the primary install succeeded. The existing static alias preservation and green Linux tests do not cover a collision during alias setup. The unrelated payload-cache and default-plugin issues predate this shortcut and are not approval conditions here.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: #2178 Provide dimn in the curl nightly installer
Reviewed head b1387a0b against origin/main d2603dd8. The diff is 4 files, +26/-4. The change adds an optional dimn shortcut next to the managed dim-nightly entry, documents it, and covers creation, rerun and a foreign symlink in the installer test. Verdict: APPROVE.
Optional P3: the alias step can fail after the entry is switched
Problem: scripts/install-nightly.sh:47 creates the shortcut after mv -f has already replaced the active dim-nightly entry (:43). The ln runs under set -e, so if ~/.local/bin/dimn becomes occupied between the check at :46 and :47, or the link call fails transiently, the installer exits nonzero after the nightly was installed. It also skips the keep-existing message at :49-53.
Failure scenario: a second installer process with a different XDG_DATA_HOME (so a different lock) or any other writer creates dimn in that window. The link call fails, the script exits 1, and the caller reports a failed install although the active version was already switched and the existing path was left untouched.
Evidence: scripts/install-nightly.sh:45-53. The other writer's path is preserved, so the content contract holds; only the exit status and message are wrong. I agree with zerob13 on the late alias failure.
Fix: make the optional alias step non-fatal, for example ignore the ln failure and let the check at :49-53 report the kept path, so the primary install result stays accurate.
Optional P3: test coverage for the preserved file and the collision
The test covers a foreign symlink at dimn (scripts/nightly.test.mjs:78-84) but not an existing regular file, which takes the same -L false branch with a different readlink outcome, and not a path that becomes occupied during alias setup. Add the regular-file case; making the alias step non-fatal makes the collision case deterministic to assert.
Optional P3: the docs promise dimn unconditionally
README.md:30 and docs/release/README.md:47 say to run dimn or dim-nightly. When an existing foreign dimn is preserved, running dimn does not start Nightly. The release page does say the existing path is kept, but the quickstart sentence still reads as unconditional. Qualify it, or say to use dim-nightly when the shortcut was kept.
Verification
node --test scripts/nightly.test.mjs: 1 passed on macOS, covering create, rerun, upgrade and foreign symlink.sh -n scripts/install-nightly.shpasses;git diff --checkis clean.- Merge-tree against
origin/mainand the open heads #2141, #2002, #2174 and #2177 is clean. - CI at this head:
ci-ok,scriptsandchangespass; the other jobs are skipped. - Isolated HOME, TMPDIR and XDG under the review data directory; no external services; no residual processes.
Unverified
- The GNU/Linux run is inferred from POSIX shell and
ln/readlinkbehavior; the test above ran on macOS only.
| printf 'Installed dim-nightly %s at %s\n' "$version" "$entry" | ||
| short=$bin/dimn | ||
| if [ ! -e "$short" ] && [ ! -L "$short" ]; then | ||
| ln -s dim-nightly "$short" |
There was a problem hiding this comment.
This optional alias step runs after mv -f has already switched the active entry (:43) and is fatal under set -e. If $short becomes occupied between the check at :46 and this line, or the link call fails transiently, the installer exits nonzero after the nightly was installed and skips the keep-existing message. The other writer's path is preserved, so the content contract holds, but the exit status and message are wrong. Make this step non-fatal and let the check at :49-53 report the kept path. Optional.
There was a problem hiding this comment.
Fixed at 0506c22: the alias step is now non-fatal (scripts/install-nightly.sh:47), an occupied path is preserved and reported by the check at :49-55, and the new race tests assert exit 0 and preservation for a regular file and a directory. Verified at this head; withdrawing this optional finding.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: #2178 Provide dimn in the curl nightly installer
Reviewed head 0506c22 against origin/main 076df0a. The diff is 4 files, +47/-4. The PR adds dimn as an optional shortcut to the stable dim-nightly entry in the curl nightly installer, documents the shortcut in the README quickstart and the nightly release contract, and covers the shortcut in the installer test. Verdict: APPROVE.
The new commit resolves the prior blocker
At b1387a0 the shortcut step ran after mv -f had already switched the active entry (scripts/install-nightly.sh:43) and was fatal under set -e. A path that became occupied after the check at :46 therefore made the installer exit nonzero with the new version already active, and the keep-existing message was skipped.
At this head the optional step is grouped with || : (scripts/install-nightly.sh:47) and the check at :49-55 reports the result. The shortcut is created inside the private $linkdir and hard-linked into $bin/ with ln -P, so a path that appears after the check makes ln fail with EEXIST instead of writing $bin/dimn/dim-nightly into a directory that appeared in that window. An existing entry, whether a regular file, directory, managed symlink or foreign symlink, is never replaced.
The new test injects the collision at the alias step, deterministically, once as a regular file and once as a directory (scripts/nightly.test.mjs:86-102), and asserts exit 0, the keep message, the preserved content and an empty foreign directory. Against a copy of the b1387a0 installer the same test fails: the file case exits 1, and a directory-only run leaves dim-nightly inside the foreign directory. Both cases therefore pin the fix. This also resolves the only CHANGES_REQUESTED blocker on the PR.
Prior findings
All three optional P3s from review 6056628718 are addressed and should be withdrawn:
- Late alias failure: fixed by the non-fatal step at
scripts/install-nightly.sh:47and the keep-existing branch at:49-55. - Test coverage: the regular-file case and the collision-during-setup case are asserted at
scripts/nightly.test.mjs:86-102; preservation is checked byte for byte and the directory is checked empty. - Docs:
README.md:30now qualifies the shortcut, anddocs/release/README.md:47states that an unavailable or taken name is left alone.
Finding
Optional P3, inline at scripts/nightly.test.mjs:93: the fake ln falls back to the hardcoded /bin/ln. On a development system that provides /bin/sh but not /bin/ln (NixOS, for example), every ln call after the fake is installed fails with 127, the collision install at scripts/nightly.test.mjs:96 exits nonzero, and the test fails at :97 for a reason unrelated to this change. Fix: resolve the real ln in the test process before the installer environment shadows PATH and embed that absolute path in the fake script.
Verification
node --test scripts/nightly.test.mjspasses with isolated HOME, TMPDIR and XDG_DATA_HOME on macOS (Darwin 27.2.0, arm64).sh -n scripts/install-nightly.shandgit diff --check origin/main...HEADpass.-Pis a POSIXlnoption. A BSDlnprobe showsln -Pfails with EEXIST and does not follow a derived link name that is a symlink to a directory; the GNU coreutils source never treats the derived destination entry as a directory and links to the symlink itself with-P. ThescriptsCI job runsnode --test scripts/*.test.mjson self-hosted Linux x64 and passed at this head.- CI at 0506c22:
scriptsandci-oksuccess (https://github.com/arcships/dim/actions/runs/45746228248/job/139662975400). The PR is open at this head.
Conflicts
git merge-tree --write-tree origin/main HEADis clean against 076df0a. Main has not changedscripts/install-nightly.sh,scripts/nightly.test.mjsor the nightly section of either doc since the PR base.- Open PRs #1881, #2174, #2197, #2206, #2210 and #2211 touch no file in this diff. #2210 and #2211 touch
crates/dim-cli/README.mdandscripts/tui-tmux/scenarios.mjs, so there is no overlap.
Unverified
- Filesystems that refuse hard links to symlinks were not exercised. There the hard-link step fails, the installer prints
Shortcut unavailableand exits 0, anddim-nightlystill installs; I verified this branch by inspection, not by the test. - BusyBox
lndoes not implement-P, so a BusyBox user would take the same fallback. The nightly Linux binaries are built in manylinux 2.28 glibc containers, so that platform is outside the supported target.
| if [ -f "$HOME/race-directory" ]; then mkdir "$HOME/.local/bin/dimn"; else echo foreign >"$HOME/.local/bin/dimn"; fi | ||
| fi;; | ||
| esac | ||
| exec /bin/ln "$@"\n`, { mode: 0o755 }); |
There was a problem hiding this comment.
Optional P3: the fake ln falls back to the hardcoded /bin/ln. On a system without /bin/ln (NixOS, for example, which provides /bin/sh but not /bin/ln), every ln call after the fake is installed fails with 127, the collision install at scripts/nightly.test.mjs:96 exits nonzero, and the test fails at :97 for a reason unrelated to this change. Fix: resolve the real ln in the test process before the installer environment shadows PATH, for example const ln = execFileSync('sh', ['-c', 'command -v ln'], { encoding: 'utf8' }).trim(), and embed that absolute path in the fake script.
zerob13
left a comment
There was a problem hiding this comment.
Approved at 0506c22b6832bf62c7cce6cb3e060798e3d14dde. The previous alias-collision finding is resolved: a file or directory appearing at the optional dimn name is preserved, while an already successful primary installation remains successful and reports the alias outcome accurately. The collision fixture verifies both cases, and the exact-merge Linux scripts job and ci-ok passed. The earlier baseline installer concerns remain outside this change.
Summary
dimnas a shortcut to the stabledim-nightlycommand on fresh and existing installations, so both names start the current version after upgrades.~/.local/bin/dimnand leave npm installations alone. Document both commands in the project README and the nightly release contract.Refs #2131.
Design rule checklist
N/A: installer-only change; no runtime parts, state, Timeline, lifecycle, or service contracts changed.
Documentation
Verification
node --test scripts/*.test.mjs: 158 passed, 4 skipped. The nightly flow covers fresh installs, adding the shortcut to an existing install, upgrades, and preserving an unrelated dangling shortcut.0.1.0-nightly.3package with the modified script in an isolated home on macOS arm64. Both commands reported the same version on fresh and repeated installs, and a pre-existing regular file atdimnwas preserved.sh -n, ShellCheck, andgit diff --checkpassed. No nightly release was triggered.