Skip to content

Report the Hex package name for renamed rebar.lock entries - #176

Merged
andrew merged 2 commits into
git-pkgs:mainfrom
abhinavgautam01:rebar-lock-pkg-rename
Dec 3, 2026
Merged

andrew merged 2 commits into
git-pkgs:mainfrom
abhinavgautam01:rebar-lock-pkg-rename

Conversation

@abhinavgautam01

@abhinavgautam01 abhinavgautam01 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #175.

Summary

A rebar.lock entry for a renamed package names the app first and the Hex package inside {pkg, ...}:

{<<"jiffy">>,{pkg,<<"jiffy_fork">>,<<"1.1.1">>},0}

rebarPkgRegex only captured the app name, so this was reported as jiffy with pkg:hex/jiffy@1.1.1, while the installed package is jiffy_fork. It now captures the package name too and uses it for Name, giving pkg:hex/jiffy_fork@1.1.1. That matches the rebar.config parser in #174 for {jiffy, "1.1.1", {pkg, jiffy_fork}}.

rebar3 keys pkg_hash and pkg_hash_ext by the app name (expand_locks in apps/rebar/src/rebar_config.erl), so the integrity lookup keeps using the app name. Entries that are not renamed have the same name in both places and are unaffected.

This changes the Name and PURL callers receive for renamed packages.

Tests

  • testdata/rebar/rebar.lock gains a renamed jiffy / jiffy_fork entry, with hashes keyed by jiffy in both hash sections.
  • TestRebarLock expects jiffy_fork at 1.1.1 with its pkg_hash_ext integrity.
  • TestRebarLockUsesHexPackageNameForRenames checks that no dependency is reported under the app name.
  • rebar_lock_test.go checks pkg:hex/jiffy_fork@1.1.1 and the integrity through Parse.

go build ./..., go vet ./..., go test ./... and golangci-lint run ./... all pass.

Summary by CodeRabbit

  • Bug Fixes
    • Rebar lockfile dependency records now preserve renamed package names, their recorded versions, and associated integrity information. For example, jiffy_fork is represented with its correct package identifier and version, helping ensure dependency listings reflect the details in the lockfile.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The Rebar lock parser now captures the application name and Hex package name separately. It uses the application name for filtering and integrity lookup, and emits the package name and version. Tests verify the renamed package’s dependency details and PURL.

Changes: Rebar renamed package parsing

Layer / File(s) Summary
Parse renamed package entries
internal/rebar/rebar.go, internal/rebar/rebar_test.go, rebar_lock_test.go
The parser uses the application name for skip checks and integrity lookup, while using the package name and version for the dependency. Tests verify the jiffy_fork version, PURL, and integrity.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: andrew

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@andrew
andrew merged commit 0b6e306 into git-pkgs:main Dec 3, 2026
2 of 3 checks passed
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.

rebar.lock reports the app name instead of the Hex package name for renamed packages

2 participants