Skip to content

Preserve declared Git source identity when insteadOf rewrites transport URLs #108

Closed

Description

@LunaStev

Problem

verify_origin() reads git remote get-url origin and compares the result directly with the dependency URL from vex.ws. Git expands url.<base>.insteadOf in remote get-url, so this compares an effective transport URL against a declared source URL.

A checkout can therefore have the correct stored remote.origin.url and exact locked commit but still be rejected as having the wrong origin. The diagnostic recommends removing the checkout even though cloning it again with the same configuration does not address the mismatch.

Code reference: src/resolver.rs — verify_origin, ensure_repository, require_local_repository, and require_checkout_at.

Git documents URL expansion in git remote get-url.

Reproduction scenario

Use temporary repositories and an isolated Git configuration rather than changing the developer's global configuration:

  1. Create a local Git library package named dep with vex.ws and src/lib.wave.
  2. Add an insteadOf rule mapping the exact declared URL https://vex-fixture.invalid/dep.git to that repository's local file: URL.
  3. Create an application with { name = "dep", git = "https://vex-fixture.invalid/dep.git" } in its dependencies and run vex fetch under that configuration.
  4. Inspect the managed checkout: git config --get remote.origin.url retains the declared URL, while git remote get-url origin returns the rewritten local URL.
  5. Repeat vex fetch --locked --offline, or use a dry-run path that calls require_checkout_at. The current origin comparison rejects the mismatch between those two representations.

The fixture requires no external network access because Git rewrites the declared URL to a local repository.

Expected behavior

Preserve declared source identity separately from Git's effective transport URL. Validate the configured origin against the declared dependency without disabling ordinary user URL rewriting or removing origin validation.

Acceptance criteria

  • Compare the stored origin source declaration, not the insteadOf-expanded transport URL, with the manifest/lockfile identity.
  • Continue rejecting a genuinely changed origin and handle missing or ambiguous origin configuration explicitly.
  • Keep the declared URL in vex.lock; do not persist machine-specific rewritten transport URLs.
  • Add local-Git integration coverage for first fetch, repeated reuse, --locked --offline, and the dry-run checkout verification path.
  • Verify that normal dependencies without rewrite rules retain existing behavior.
  • Keep credentials, SSH configuration, proxy settings, and Git URL rewriting available to clone/fetch; do not solve this by clearing all user Git configuration.
  • Run tests with isolated HOME/config paths and cargo test --locked.

Source aliases, broad URL canonicalization, and changing locked commit selection are outside this issue.

Activity

  1. added
    bug
    dependencies
    on Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdependencies

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions