Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions PR_INVESTIGATION_FINDINGS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Investigation Findings: Missing PRs in Main Branch

## Executive Summary

**Issue**: When examining the repository with a shallow clone, it appeared that some merged PRs were missing from the main branch history.

**Root Cause**: The repository was cloned with `--depth=1` (shallow clone), which only fetched the most recent commit, making the full history appear to be missing.

**Resolution**: After running `git fetch --unshallow`, all merged PRs were confirmed to be present in the repository history.

## Detailed Analysis

### Last 6 Merged PRs (by merge date)

1. **PR #77** - "Update dockerfile and add workflow"
- Merged: 2025-03-26T20:22:16Z
- Commit SHA: bc7d41cf98b83766b7a223b6f1b90a7b909fc820
- Status: ✅ Present in git history

2. **PR #78** - "adding hack for lco bug fix"
- Merged: 2025-04-03T19:31:41Z
- Commit SHA: b829883da6faf53b3bdf3d25103f14df18b5a16a
- Status: ✅ Present in git history

3. **PR #79** - "Adds new endpoint for bulk query by altid"
- Merged: 2025-04-18T14:51:06Z
- Commit SHA: fbe64d36d12a2756c29cd1cee754c03fb35c2bd7
- Status: ✅ Present in git history

4. **PR #80** - "Updates the default release to DR19"
- Merged: 2025-06-26T20:41:27Z
- Commit SHA: 56a793dcc31381c64105b66895459a40a6f59dab
- Status: ✅ Present in git history

5. **PR #83** - "Adds new route for legacy data lookup"
- Merged: 2025-09-19T18:35:30Z
- Commit SHA: abe4a4a9212c9f50a90ca2358c1d80d01a2bd6ed
- Status: ✅ Present in git history

6. **PR #84** - "Move to uv and bumps to Python 12"
- Merged: 2025-10-10T20:19:07Z
- Commit SHA: 13bcc87a7b9f6b86aa10c2c135a7a36490ec450a
- Status: ✅ Present in git history

Most recent (7th):
- **PR #85** - "Adds support for IPL-4"
- Merged: 2025-11-05T16:18:23Z
- Commit SHA: f081ff4bfe9da55b4c7c49ba693201bb5c6045ad
- Status: ✅ Present in git history

### Missing PR Numbers

**PR #81** and **PR #82** were never created. These PR numbers do not exist in the GitHub repository (confirmed with 404 responses from GitHub API).

## Technical Details

### Initial State
```bash
$ git log --oneline -20
c93f129 (HEAD -> copilot/investigate-missing-prs) Initial plan
f081ff4 (grafted) Adds support for IPL-4 (#85)
```

The presence of "(grafted)" indicated a shallow clone. Verification:
```bash
$ cat .git/shallow
f081ff4bfe9da55b4c7c49ba693201bb5c6045ad
```

### Resolution
```bash
$ git fetch --unshallow
```

This command fetched the complete history (1,459 objects) and removed the shallow file.

### Verification
After unshallowing, all merge commits for PRs #77, #78, #79, #80, #83, #84, and #85 were verified to exist in the repository:

```bash
$ git cat-file -t <sha>
commit # for all 7 PRs
```

## Conclusion

**No PRs are actually missing from the main branch.** All merged pull requests are present in the complete git history. The issue was caused by:

1. A shallow clone that only included the most recent commit
2. This made it appear that historical commits (and their associated PRs) were missing

## Recommendations

### For CI/CD Systems
1. **Avoid shallow clones for analysis tasks**: When examining git history, relationships between commits, or PR verification, always use a full clone or unshallow the repository first.

2. **Use appropriate clone depth**: If shallow clones are necessary for performance:
- Use `--depth=N` where N is sufficient for your needs
- Document that history analysis requires unshallowing
- Add a step to unshallow when needed

### For Developers
1. **Check for shallow clones**: Before analyzing git history, check if the repository is shallow:
```bash
[ -f .git/shallow ] && echo "Shallow clone detected"
```

2. **Unshallow when needed**: If you need full history:
```bash
git fetch --unshallow
```

3. **Use GitHub API for PR verification**: When verifying merged PRs, the GitHub API is authoritative and not affected by local git clone depth.

### For Repository Maintainers
1. **No action needed**: The repository history is intact and correct.
2. **Consider adding documentation**: If CI/CD commonly uses shallow clones, document the need to unshallow for certain operations.

## Summary Table

| PR # | Status | In Git History | Notes |
|------|--------|----------------|-------|
| 77 | Merged | ✅ Yes | |
| 78 | Merged | ✅ Yes | |
| 79 | Merged | ✅ Yes | |
| 80 | Merged | ✅ Yes | |
| 81 | N/A | N/A | PR never created |
| 82 | N/A | N/A | PR never created |
| 83 | Merged | ✅ Yes | |
| 84 | Merged | ✅ Yes | |
| 85 | Merged | ✅ Yes | Most recent |

**Result**: All merged PRs are accounted for. No data loss or git history issues detected.
43 changes: 43 additions & 0 deletions SHALLOW_CLONE_ISSUE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Quick Guide: Shallow Clone Issue

## TL;DR

**Problem**: Git history appears incomplete, merged PRs seem missing.
**Cause**: Repository was cloned with `--depth=1` (shallow clone).
**Solution**: Run `git fetch --unshallow` to get full history.

## How to Fix

```bash
# Check if you have a shallow clone
[ -f .git/shallow ] && echo "Shallow clone detected"

# Unshallow to get full history
git fetch --unshallow

# Verify history is complete
git log --oneline | wc -l # Should show many more commits
```

## Quick Verification

Use the provided script to verify PRs are in history:

```bash
./scripts/verify_pr_history.sh
```

## Full Details

See [PR_INVESTIGATION_FINDINGS.md](./PR_INVESTIGATION_FINDINGS.md) for complete investigation details, findings, and recommendations.

## Summary of Findings

✅ **All merged PRs are present in git history**
- Last 6 merged PRs (77, 78, 79, 80, 83, 84) - all verified
- Most recent PR #85 - verified
- PR #81 and #82 never existed (were never created)

❌ **No data loss or corruption detected**

⚠️ **Root cause**: Shallow clone made history appear incomplete
64 changes: 64 additions & 0 deletions scripts/verify_pr_history.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
# Script to verify that merged PRs are present in git history
# Usage: ./verify_pr_history.sh [number_of_prs_to_check]

set -e

# Default to checking last 10 PRs
NUM_PRS=${1:-10}

echo "PR History Verification Script"
echo "==============================="
echo ""

# Check if this is a shallow clone
if [ -f .git/shallow ]; then
echo "⚠️ WARNING: This is a shallow clone!"
echo " Some history may not be available."
echo " Run 'git fetch --unshallow' to get full history."
echo ""
read -p "Would you like to unshallow now? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Unshallowing repository..."
git fetch --unshallow
echo "✅ Repository unshallowed successfully"
echo ""
fi
fi

# Get the repo info from git remote
REMOTE_URL=$(git remote get-url origin)
REPO_PATH=$(echo $REMOTE_URL | sed -E 's/.*github\.com[:/]([^/]+\/[^/.]+)(\.git)?/\1/')

echo "Repository: $REPO_PATH"
echo "Checking last $NUM_PRS merged PRs..."
echo ""

# Note: This script requires gh CLI or manual API calls
# For simplicity, we'll just check git history for PR references

echo "Searching for PR merge commits in git history..."
echo ""

# Find commits with PR references in the last 50 commits
git log --oneline -50 --grep="#[0-9]" | while read -r commit; do
# Extract PR number
pr_num=$(echo "$commit" | grep -oE '#[0-9]+' | head -1 | tr -d '#')
commit_sha=$(echo "$commit" | awk '{print $1}')

if [ -n "$pr_num" ]; then
# Verify commit exists
if git cat-file -e "$commit_sha" 2>/dev/null; then
echo "✅ PR #$pr_num - Commit $commit_sha exists"
else
echo "❌ PR #$pr_num - Commit $commit_sha MISSING"
fi
fi
done

echo ""
echo "Verification complete!"
echo ""
echo "Note: This script only checks commits that reference PRs in their message."
echo " For comprehensive verification, use the GitHub API to list all merged PRs."