GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||
GeezerVison is showing github.com — Fix Composer global home lookup order (#586) by mikolalysenko · Pull Request #1421 · SocketDev/socket-patch Conversation
|
| Issue case | Test | Before fix | After |
|---|---|---|---|
#586: stale empty ~/.composer + real ~/.config/composer, XDG system |
covgap_crawlers_composer_crawler::get_vendor_paths_global_xdg_home_outranks_stale_dot_composer |
FAILED (left: [], the issue's exact symptom) |
ok |
#586: XDG_CONFIG_HOME set, ~/.composer/vendor also present |
covgap_crawlers_composer_crawler::get_vendor_paths_global_xdg_config_home_outranks_stale_dot_composer |
FAILED (picked ~/.composer/vendor) |
ok |
Candidate order: XDG vs non-XDG, empty, relative and supplied XDG_CONFIG_HOME |
composer_crawler::tests::test_home_candidates_* (3 unit tests) |
new | ok |
Commands run locally (Linux, as root):
cargo fmt --all -- --check: okcargo clippy --workspace --all-features -- -D warnings: okcargo test --workspace --all-features --no-fail-fast: all 281 composer tests pass. 13 tests fail only in this sandbox: chmod-based write-failure tests that can't fail as root (*_write_failure_*, *unremovable*, relax_loop_must_not_traverse_symlinked_root, etc.), plus e2e_bun_lockb, which needs network access to patches-api.socket.dev. None touch Composer code. CI runs them as non-root.e2e_vendor_composer_build, e2e_redirect_composer_build) exercise project mode, not the global-home fallback, so they weren't re-run locally. CI runs them.npm/, pypi/, gem/) changes are needed: they only dispatch to the binary.I fixed every confirmed finding in ab0ffcb except one. Not fixed: "Composer 1 users with both dirs get the XDG dir". That is the intended trade-off described above.
🤖 Generated with Claude Code
https://claude.ai/code/session_011PgPZPKvQDRtAkxyHR3Pe8
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
When composer isn't on PATH and COMPOSER_HOME is unset, global discovery guessed the Composer home in Composer 1's order and checked ~/.composer first. Composer 2 checks the XDG config dir first on an XDG system (any XDG_* variable set, or /etc/xdg present), so a leftover ~/.composer hid the real global install and scan -g, apply -g and vex -g silently found nothing. Probe $XDG_CONFIG_HOME/composer (or ~/.config/composer) before ~/.composer on XDG systems, as Composer 2's Factory::getHomeDir does. Non-XDG systems and Windows keep their current order. Fixes #586 Assisted-by: Claude Code:claude-opus-5-5
The env() helper in the composer crawler tests is only used by unix-only tests, so it would be dead code (and a clippy error) on Windows. Assisted-by: Claude Code:claude-opus-5-5
Follow-ups from review of the XDG-first order: - Count an XDG_CONFIG_HOME in the supplied environment as an XDG system, so it is never dropped from the probes. - Skip the XDG home when XDG_CONFIG_HOME is relative instead of guessing ~/.config, which Composer would not use; an empty value still means ~/.config, as in Composer. - Build the candidate list on the blocking pool, since the XDG check stats /etc/xdg. - Clear XDG_CONFIG_HOME in a shim test that relies on the HOME fallback, and fix a mislabeled unit-test assertion. Refs #586 Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ab0ffcb. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[agent] Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ready for review (burn-down agent)
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Final review briefWhat it does: Fixes #586. When neither Risk: low. It only changes the last-resort fallback. Windows ordering is the same as before. On non-XDG systems, Look here:
Verified:
Changes I made: none. Open questions (non-blocking):
Auto-merge is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…g-home-order # Conflicts: # crates/socket-patch-core/src/crawlers/composer_crawler.rs
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Composer global-home fallback checks ~/.composer before the XDG home, so scan -g finds no Composer 2 global packages when a stale ~/.composer exists and composer isn't on PATH
There was an error while loading. Please reload this page.