Skip to content

Resolve documentation links for private Hex dependencies - #2273

Merged
josevalim merged 3 commits into
elixir-lang:mainfrom
mvanhorn:fix/1975-private-hex-dependency-doc-links
Oct 15, 2026
Merged

josevalim merged 3 commits into
elixir-lang:mainfrom
mvanhorn:fix/1975-private-hex-dependency-doc-links

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

The docs task now reads the project lock and recognizes organization repositories in seven- and eight-element Hex lock entries. For those dependencies, it builds URLs using the organization host, locked package name, and loaded application version. Generated documentation links for private Hex dependencies point to public HexDocs URLs instead of the organization’s documentation host, leaving those links broken unless explicitly overridden. Dependency URLs were built solely from the application name and loaded application version.

Tests for this live in test/mix/tasks/docs_test.exs.

Fixes #1975

The docs task now reads the project lock and recognizes organization
repositories in seven- and eight-element Hex lock entries. For those
dependencies, it builds URLs using the organization host, locked package
name, and loaded application version. Other entries retain the existing
URL format, and explicit dependency URL overrides still take precedence.
The added regression test covers private direct and transitive
dependencies, overrides, applications without version metadata, and
fallback handling.

Fixes elixir-lang#1975
Comment thread test/mix/tasks/docs_test.exs Outdated
{:earmark_parser, "foo"}
end

test "includes private dependency URLs from the project lock", %{tmp_dir: tmp_dir} = context do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we unit test them via the run function, as done by the other tests in this file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2f3ff36. The private lock test now calls run/3 against the current project with a temporary lockfile, same as the other tests here, and the throwaway Mix project is gone.

Comment thread lib/mix/tasks/docs.ex Outdated
Private organization dependencies now link to
https://<org>.hexorgs.pm/<package>/<vsn>/, as suggested in review.

The private lock test now calls run/3 against the current project with a
temporary lockfile, like the other tests in the file, instead of building
a throwaway Mix project.
Comment thread lib/mix/tasks/docs.ex Outdated
Read private dependency organizations from Mix.Dep.cached, keyed on
dep.scm == Hex.SCM and dep.opts[:repo], instead of parsing the lock
file. The test now seeds the cached deps rather than a temporary
lockfile.
@github-actions

Copy link
Copy Markdown

@josevalim
josevalim merged commit 8c1b0fa into elixir-lang:main Oct 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Broken links for dependencies belonging to organizations

3 participants