Skip to content

Normalize accepted Git object IDs before checkout identity comparisons #111

Closed

Description

@LunaStev

Problem

validate_commit accepts full 40- or 64-character hexadecimal object IDs using is_ascii_hexdigit, including uppercase A through F. The lockfile parser then preserves the original spelling.

require_checkout_at compares that spelling directly with the output of git rev-parse HEAD. Git reports the canonical lowercase object ID, so an uppercase or mixed-case lock entry can be accepted by the parser and Git's object lookup but rejected by Vex as a different checkout.

checkout_commit uses the same case-sensitive comparison and can attempt an unnecessary checkout when HEAD already identifies the requested commit.

Code references:

Regression scenario

Use a temporary application and a local Git library dependency with valid manifests and canonical source entries.

  1. Run vex fetch to create a lockfile and managed checkout.
  2. Confirm vex check --dry-run --locked --offline reaches the compiler planning path with an installed compatible wavec or the existing fake-wavec test setup.
  3. Change only the hexadecimal letters in the dependency's commit field in vex.lock to uppercase or mixed case. Keep the full ID length, all other fields, and the clean checkout unchanged.
  4. Repeat the same dry-run command.

The current source accepts the edited lock entry but takes the checkout-mismatch error path because the two textual spellings differ. Expected: the same commit is recognized, planning proceeds, and the lockfile remains byte-for-byte unchanged.

The fixture's object ID must contain at least one hexadecimal letter so changing case actually exercises the comparison. This describes the Vex regression to execute; it does not claim a recorded end-to-end Vex result.

Expected behavior

Normalize validated object IDs in memory, preferably when parsing lockfile commit fields, and use a consistent representation for lookup, equality, and checkout decisions. Preserve the currently accepted uppercase and mixed-case input rather than introducing a new rejection rule.

Do not rewrite the lockfile merely to normalize its spelling during --locked or dry-run operations. Case-only changes must not be confused with a different selected commit.

Acceptance criteria

  • Parser tests cover lowercase, uppercase, and mixed-case full IDs for both SHA-1 and SHA-256 lengths and produce one canonical internal representation.
  • Invalid characters, abbreviated IDs, and unsupported lengths remain rejected.
  • A local-Git integration test verifies dry-run locked/offline reuse with an uppercase or mixed-case lock entry and the same clean checkout.
  • Normal locked/offline reuse does not request a checkout solely because of hexadecimal letter case.
  • A genuinely different commit still triggers the existing mismatch or checkout behavior as appropriate.
  • --locked and dry-run leave the original lockfile bytes unchanged and do not fetch from the network.
  • Preserve checkout-integrity checks and source-URL comparison semantics; only object IDs are normalized.
  • Run cargo test --locked. SHA-256 parsing coverage must not depend on local Git supporting SHA-256 repository creation.

Difficulty: easy. Related #79 covers broader lockfile compatibility fixtures; #19 covers dirty managed checkouts. This issue owns case normalization of otherwise valid full object IDs.

Activity

  1. added
    bug
    good first issue
    dependencies
    on Sep 21, 2026
  2. isaim0011 commented on Sep 21, 2026

    @isaim0011
    Contributor

    Hey @LunaStev, I'd like to take this up!

    The approach is clear: normalize validated object IDs to lowercase in memory during lockfile parsing in src/lockfile.rs so identity checks in require_checkout_at and checkout_commit match Git's canonical lowercase representation, without rewriting the lockfile during --locked or dry-run.

    I'll add the parser unit tests for SHA-1 and SHA-256 case variations and the local Git integration test covering the locked/offline dry-run scenario.

  3. LunaStev commented on Sep 21, 2026

    @LunaStev
    MemberAuthor

    Hey @LunaStev, I'd like to take this up!

    The approach is clear: normalize validated object IDs to lowercase in memory during lockfile parsing in src/lockfile.rs so identity checks in require_checkout_at and checkout_commit match Git's canonical lowercase representation, without rewriting the lockfile during --locked or dry-run.

    I'll add the parser unit tests for SHA-1 and SHA-256 case variations and the local Git integration test covering the locked/offline dry-run scenario.

    Sounds good! Please go ahead and take this up. Thanks!

  4. LunaStev commented on Sep 21, 2026

    @LunaStev
    MemberAuthor

    We will assign it to you.

    Hey @LunaStev, I'd like to take this up!
    The approach is clear: normalize validated object IDs to lowercase in memory during lockfile parsing in src/lockfile.rs so identity checks in require_checkout_at and checkout_commit match Git's canonical lowercase representation, without rewriting the lockfile during --locked or dry-run.
    I'll add the parser unit tests for SHA-1 and SHA-256 case variations and the local Git integration test covering the locked/offline dry-run scenario.

    Sounds good! Please go ahead and take this up. Thanks!

    We will assign it to you.

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

Metadata

Metadata

Assignees

Labels

bugdependenciesgood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions