Skip to content

bug(sync): normalize GitLab blob SHA and commit revision semantics #101

Description

@ClaudiaFang

Priority

P0 — sync correctness

Problem

GitLab exposes multiple identifiers with different meanings, including blob IDs and commit revisions. The current sync model may treat last_commit_id, tree entry id, and lastSyncedSha as interchangeable.

This can produce false remote-conflict detection across workflows, for example:

single pull stores commit SHA
→ local file changes
→ batch push compares against blob SHA
→ identifiers differ even when the remote blob is unchanged

Plan

  • Define GitFile.sha as the remote blob/content identity across all providers.
  • Use GitLab blob_id for file content identity.
  • Store commit revision / optimistic-lock identity in a separate field when required.
  • Audit single push/pull, batch push/pull, move, delete, and conflict detection for mixed SHA semantics.
  • Add migration handling for existing metadata if stored identifiers cannot be reused safely.
  • Add cross-flow regression tests.

Required regression scenario

single pull
→ local edit
→ batch push
→ no false remote conflict

Acceptance criteria

  • Blob identity and commit revision have explicit, separate types and fields.
  • GitLab behavior is consistent between getFile, tree listing, and batch operations.
  • Cross-flow tests cover single/batch transitions.
  • Existing GitHub and Gitea behavior remains unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions