Skip to content

fix(mix): scope dep library names relative to the project - #3983

Open
sh41 wants to merge 3 commits into
KronicDeth:mainfrom
sh41:fix-3926-relative-library-name-token
Open

fix(mix): scope dep library names relative to the project#3983
sh41 wants to merge 3 commits into
KronicDeth:mainfrom
sh41:fix-3926-relative-library-name-token

Conversation

@sh41

@sh41 sh41 commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Fixes the absolute path reported in #3926.

A Mix dep's project library was named <dep> [<absolute content root URL>]. That name is also the file name the platform derives for .idea/libraries, and what every <orderEntry> repeats, so none of it survived a different checkout path. $PROJECT_DIR$ cannot help: path macros only collapse a path at the start of an attribute value, and the file name is derived before serialization. The scope is now relative to the project base directory — the same anchor $PROJECT_DIR$ resolves to.

Names written by older versions are replaced on the next sync. Only the <dep> [<token>] shape this plugin writes is ever touched; a bare name may be a user's own library and is left alone.

Also here, because the rename is not usable without them:

  • Tools > Elixir > Rebuild Mix Libraries, since nothing but a deps/ change or first-time project setup could rebuild libraries, leaving a project with wrong ones no way back.
  • Repair on project open, escalating to a full sync only when libraries and content roots disagree, so a healthy project does no dependency scanning. It waits for the JPS model first — the IDE applies the real .iml over the cached model seconds after open, and would otherwise discard the sync.

Verified against two real WSL projects: a single-root one migrated 43 old-scheme entries and persisted without a manual save; a two-root umbrella with an out-of-tree sibling module produced . and ../<sibling> scopes.

This is enough for the reporter to test. Remaining clean-up — order entries left by deps removed from mix.exs, and orphaned libraries scoped outside every content root — is deferred to #3927.

sh41 added 3 commits August 31, 2026 22:06
The absolute content-root URL in a dep library's name is also its file name under
.idea/libraries and what every <orderEntry> repeats, so none of it survived a
different checkout path. $PROJECT_DIR$ cannot help: path macros only collapse a
path at the start of a value, and the file name is derived before serialization.

Names written by older versions are replaced on the next sync. Only the
"<dep> [<token>]" shape this plugin writes is ever touched.
Libraries are rebuilt only from deps/ and _build/ events or a first-time project
setup, so a project whose libraries are wrong has no way back: deps.get over
already-fetched deps changes nothing on disk, and reopening does not re-sync.
A deps/ directory removed while the IDE was closed leaves libraries pointing at
nothing and nothing notices: an already-configured project enqueues no sync at
open, and the entries stay valid so pruning ignores them.

The check reads only in-memory library state and escalates to a full sync just
on disagreement, keeping the deps/_build scan off the healthy path. It waits for
the JPS model, which the IDE applies over the cached one seconds after open and
which would otherwise discard the sync.
@github-actions

Copy link
Copy Markdown

Test Results

Commit 4d7b338f · 12 legs

Required legs: 0 failing tests, all 12 ran to completion.

count
tests per leg 7,077 - 7,181
runs 85,318
✅ passing runs 85,318
❌ failing runs 0
💤 skipped runs 0
❌ distinct tests failing somewhere 0
result files 5,184
wall clock (longest leg) 15m 55s
runner time (all legs) 2h 40m

runs counts executions across the whole matrix, so a test present in every leg is one test and as many runs as there are legs - that is the figure to read for a matrix whose job is per-version validation. distinct tests failing somewhere collapses it back: a test that fails on four legs counts once. Every row spans required and informational legs alike; only the required-leg line above decides whether this commit can merge.

Required legs

leg os IDEA Elixir OTP status tests wall clock
1.13.4+25.3.2.21 ubuntu-22.04 2025.3.6 1.13.4 25.3.2.21 ✅ passed 7,077 7,077 0 12m 23s
1.14.5+26.2.5.21 ubuntu-22.04 2025.3.6 1.14.5 26.2.5.21 ✅ passed 7,100 7,100 0 14m 21s
1.15.8+26.2.5.21 ubuntu-22.04 2025.3.6 1.15.8 26.2.5.21 ✅ passed 7,103 7,103 0 15m 55s
1.16.3+26.2.5.21 ubuntu-22.04 2025.3.6 1.16.3 26.2.5.21 ✅ passed 7,105 7,105 0 11m 59s
1.17.3+27.1.2 ubuntu-22.04 2025.3.6 1.17.3 27.1.2 ✅ passed 7,119 7,119 0 13m 18s
1.18.4+27.3.4 ubuntu-22.04 2025.3.6 1.18.4 27.3.4 ✅ passed 7,138 7,138 0 12m 25s
1.19.5+28.4 ubuntu-22.04 2025.3.6 1.19.5 28.4 ✅ passed 7,175 7,175 0 12m 22s
1.20.2+29.0 ubuntu-22.04 2025.3.6 1.20.2 29.0 ✅ passed 7,181 7,181 0 12m 55s
IDEA 2025.3.6 ubuntu-22.04 2025.3.6 1.13.4 24.3.4.6 ✅ passed 7,080 7,080 0 12m 18s
IDEA 2026.1.4 ubuntu-22.04 2026.1.4 1.13.4 24.3.4.6 ✅ passed 7,080 7,080 0 12m 11s
IDEA 2026.2 ubuntu-22.04 2026.2 1.13.4 24.3.4.6 ✅ passed 7,080 7,080 0 14m 24s
Win25, IDEA 2025.3.6 windows-2025 2025.3.6 1.13.4 24.3.4.6 ✅ passed 7,080 7,080 0 15m 35s

Counts only - for which tests failed, open a leg’s Test Results (…) check, or the Failed tests summary on its test (…) job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant