Skip to content

Add opt-in path alias normalization - #26

Merged
pboling merged 1 commit into
mainfrom
fix/path-alias-normalization
Jul 19, 2026
Merged

Add opt-in path alias normalization#26
pboling merged 1 commit into
mainfrom
fix/path-alias-normalization

Conversation

@pboling

@pboling pboling commented Jul 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Add opt-in path alias normalization for local sibling gem paths before they are passed to Bundler.
  • Support explicit path_aliases: config plus *_PATH_ALIASES / NOMONO_PATH_ALIASES env configuration.
  • Verify aliases with File.realpath and fail closed when configured aliases are malformed or do not resolve to the same directory.

Why

Bundler serializes the gem ..., path: value it receives into Gemfile.lock path remotes. Equivalent aliases such as /var/home/... and /home/... therefore churn lockfiles unless the path spelling is normalized before Bundler sees it.

Example

eval_nomono_gems(
  gems: %w[kettle-dev kettle-test],
  prefix: "KETTLE_DEV",
  path_env: "KETTLE_DEV_DEV",
  path_aliases: {
    "/var/home/pboling" => "/home/pboling"
  }
)

Or via env:

KETTLE_DEV_PATH_ALIASES=/var/home/pboling=/home/pboling

Verification

  • K_SOUP_COV_DO=false bundle exec kettle-test spec/nomono/resolver_spec.rb spec/nomono/gemfile_dsl_spec.rb
  • bin/rake rubocop_gradual:autocorrect
  • K_SOUP_COV_DO=false bundle exec kettle-test
  • git diff --check

Copilot AI review requested due to automatic review settings July 18, 2026 22:18
Comment thread lib/nomono/resolver.rb Fixed
@coveralls

coveralls commented Jul 18, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29666870940

Coverage decreased (-5.4%) to 94.643%

Details

  • Coverage decreased (-5.4%) from the base build.
  • Patch coverage: 3 uncovered changes across 1 file (32 of 35 lines covered, 91.43%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
lib/nomono/resolver.rb 35 32 91.43%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 123
Covered Lines: 120
Line Coverage: 97.56%
Relevant Branches: 45
Covered Branches: 39
Branch Coverage: 86.67%
Branches in Coverage %: Yes
Coverage Strength: 12.31 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds opt-in path alias normalization for locally-resolved sibling gem paths so Bundler receives a canonicalized path spelling (reducing Gemfile.lock churn when equivalent paths like /var/home/... vs /home/... exist).

Changes:

  • Extend Nomono::Resolver#gems with optional path_aliases / *_PATH_ALIASES / NOMONO_PATH_ALIASES support and normalize resolved gem paths accordingly.
  • Add specs covering alias normalization, precedence (most-specific match), and validation/error behavior.
  • Document the new configuration in the README and record it in the changelog.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spec/nomono/resolver_spec.rb Adds test coverage for alias parsing, normalization, precedence, and failure modes.
spec/nomono/gemfile_dsl_spec.rb Verifies normalized paths flow through eval_nomono_gems into gem(path:) calls.
README.md Documents *_PATH_ALIASES / NOMONO_PATH_ALIASES and shows usage examples.
lib/nomono/resolver.rb Implements alias parsing/validation and applies canonicalization to resolved gem paths.
CHANGELOG.md Notes the addition of opt-in alias normalization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/nomono/resolver.rb Outdated
Comment thread lib/nomono/resolver.rb Outdated
@pboling
pboling force-pushed the fix/path-alias-normalization branch from 2157f9a to 326134f Compare July 19, 2026 00:23
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Health
nomono 98% 87%
Summary 98% (120 / 123) 87% (39 / 45)

Minimum allowed line rate is 92%

@pboling
pboling merged commit 72c46cc into main Jul 19, 2026
25 checks passed
@pboling
pboling deleted the fix/path-alias-normalization branch July 19, 2026 00:28
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.

4 participants