[PR #200] Add E2E Test for Rebase Scenario with Mixed Authorship #318

Closed
opened 2026-03-02 04:13:17 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/200

State: closed
Merged: Yes


Overview

This PR adds a comprehensive end-to-end test that verifies git-ai correctly preserves AI and human authorship attribution when rebasing a feature branch with mixed authorship onto a diverged main branch.

What This Test Covers

The test simulates a realistic development workflow:

  1. Initial Setup: Creates a common ancestor commit with an app.py file containing clearly separated sections
  2. Feature Branch Development:
    • Creates a feature branch from the common ancestor
    • Adds a commit with mixed authorship (human adds function signature, AI adds implementation logic)
    • Uses git-ai checkpoint to track both human and AI contributions
  3. Main Branch Divergence:
    • Main branch moves forward with 3 new commits
    • All commits modify the same app.py file in different sections
    • Adds utility functions in the "Utility functions section"
  4. Rebase Operation: Rebases the feature branch onto the updated main branch
  5. Verification: Ensures authorship attribution is preserved after rebase

Key Verifications

The test validates:

  • Stats Preservation: AI and human contribution stats match before and after rebase
  • Blame Integrity: git-ai blame correctly shows both AI (mock_ai) and human (Test User) authorship after rebase
  • Content Preservation: All changes from both branches are present in the final file
  • Branch Structure: Feature branch is properly rebased on top of main's commits
  • Line-level Attribution: Fine-grained authorship tracking at the line level survives the rebase

Why This Matters

Rebasing is a common Git operation that can be problematic for authorship tracking systems. This test ensures that git-ai's authorship attribution:

  • Survives complex Git operations like rebase
  • Correctly handles conflicts and file modifications in the same file across branches
  • Maintains accurate AI vs. human contribution metrics through branch operations
  • Provides reliable data for AI usage analytics and attribution

Run the test with:

bats tests/e2e/user-scenarios.bats -f "rebase feature branch with mixed authorship"

Or run the full E2E test suite:

task test:e2e
**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/200 **State:** closed **Merged:** Yes --- ## Overview This PR adds a comprehensive end-to-end test that verifies git-ai correctly preserves AI and human authorship attribution when rebasing a feature branch with mixed authorship onto a diverged main branch. ## What This Test Covers The test simulates a realistic development workflow: 1. **Initial Setup**: Creates a common ancestor commit with an `app.py` file containing clearly separated sections 2. **Feature Branch Development**: - Creates a feature branch from the common ancestor - Adds a commit with mixed authorship (human adds function signature, AI adds implementation logic) - Uses `git-ai checkpoint` to track both human and AI contributions 3. **Main Branch Divergence**: - Main branch moves forward with 3 new commits - All commits modify the same `app.py` file in different sections - Adds utility functions in the "Utility functions section" 4. **Rebase Operation**: Rebases the feature branch onto the updated main branch 5. **Verification**: Ensures authorship attribution is preserved after rebase ## Key Verifications The test validates: - ✅ **Stats Preservation**: AI and human contribution stats match before and after rebase - ✅ **Blame Integrity**: `git-ai blame` correctly shows both AI (`mock_ai`) and human (`Test User`) authorship after rebase - ✅ **Content Preservation**: All changes from both branches are present in the final file - ✅ **Branch Structure**: Feature branch is properly rebased on top of main's commits - ✅ **Line-level Attribution**: Fine-grained authorship tracking at the line level survives the rebase ## Why This Matters Rebasing is a common Git operation that can be problematic for authorship tracking systems. This test ensures that git-ai's authorship attribution: - Survives complex Git operations like rebase - Correctly handles conflicts and file modifications in the same file across branches - Maintains accurate AI vs. human contribution metrics through branch operations - Provides reliable data for AI usage analytics and attribution Run the test with: ```bash bats tests/e2e/user-scenarios.bats -f "rebase feature branch with mixed authorship" ``` Or run the full E2E test suite: ```bash task test:e2e ```
kerem 2026-03-02 04:13:17 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#318
No description provided.