-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_fix.py
More file actions
68 lines (53 loc) · 2.13 KB
/
test_fix.py
File metadata and controls
68 lines (53 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""
Test that pushed_at fix works for ink-and-memory repo.
"""
import asyncio
from github_client import GitHubClient
from commit_agent import CommitAgent
from datetime import datetime
async def test_fix():
"""Test that using pushed_at allows detecting feature branch commits."""
client = GitHubClient()
agent = CommitAgent(client, as_of=datetime.now())
# Get repos
repos = await client.get_repos(limit=15)
# Find ink-and-memory
ink_repo = next((r for r in repos if r['name'] == 'ink-and-memory'), None)
if not ink_repo:
print("ERROR: ink-and-memory repo not found")
return
print("=" * 80)
print("TESTING FIX: Using pushed_at instead of updated_at")
print("=" * 80)
print(f"Repo: {ink_repo['name']}")
print(f"Timestamp field being used (via 'updated_at' key): {ink_repo['updated_at']}")
print()
# Sync repos to fetch commits
print("Syncing commits...")
await agent.sync_repos([ink_repo])
print()
# Get commit counts
commits = agent.get_commits(ink_repo['id'])
print(f"Total commits fetched (last 30 days): {len(commits)}")
if commits:
print(f"\nLatest 5 commits:")
for i, commit in enumerate(commits[:5], 1):
print(f" {i}. {commit['date']} - {commit['message'][:60]}")
# Count recent commits
now = datetime.now()
from datetime import timedelta, timezone
three_days_ago = now - timedelta(days=3)
commits_3d = sum(1 for c in commits
if datetime.fromisoformat(c['date'].replace('Z', '+00:00')) >= three_days_ago.replace(tzinfo=timezone.utc))
print(f"\nCommits in last 3 days: {commits_3d}")
print()
if commits_3d >= 6:
print("✓ SUCCESS: Detected feature branch commits!")
print(" The fix is working - pushed_at field triggered a refresh")
elif commits_3d == 1:
print("✗ FAILURE: Only detected main branch commit")
print(" The fix didn't work - feature branch commits not detected")
else:
print(f"? PARTIAL: Detected {commits_3d} commits (expected 6 from feature branch)")
if __name__ == "__main__":
asyncio.run(test_fix())