Fix CI test failures (bd-1231)

- Always recompute content_hash in importer to avoid stale hashes from JSONL
- Add .gitignore to test repos to prevent database files from being tracked
- Fix daemon auto-import test to use correct RPC operation ('show' not 'get_issue')
- Set last_import_time metadata in test helper to enable staleness check
- Add filesystem settle delay after git pull in tests

Root cause: CloseIssue updates status but not content_hash, so importer
thought issues were unchanged. Always recomputing content_hash fixes this.

Amp-Thread-ID: https://ampcode.com/threads/T-63ef3a7d-8efe-472d-97ed-6ac95bd8318b
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-11-02 08:55:25 -08:00
parent defc90deeb
commit 09bd4d3462
4 changed files with 28 additions and 5 deletions

View File

@@ -131,6 +131,9 @@ func TestDaemonAutoImportAfterGitPull(t *testing.T) {
// Agent B does git pull (updates JSONL on disk)
runGitCmd(t, clone2Dir, "pull")
// Wait for filesystem to settle after git operations
time.Sleep(50 * time.Millisecond)
// Start daemon server in clone2
socketPath := filepath.Join(clone2BeadsDir, "bd.sock")
os.Remove(socketPath) // Ensure clean state
@@ -329,6 +332,9 @@ func TestDaemonAutoImportDataCorruption(t *testing.T) {
// 2. Agent B does git pull (JSONL updated on disk)
runGitCmd(t, clone2Dir, "pull")
// Wait for filesystem to settle after git operations
time.Sleep(50 * time.Millisecond)
// 3. Agent B daemon exports STALE data (if auto-import doesn't work)
// This would overwrite Agent A's closure with old "open" status
@@ -364,7 +370,7 @@ func TestDaemonAutoImportDataCorruption(t *testing.T) {
client.SetDatabasePath(clone2DBPath)
resp, err := client.Execute("get_issue", map[string]string{"id": issueID})
resp, err := client.Execute("show", map[string]string{"id": issueID})
if err != nil {
t.Fatalf("Failed to get issue: %v", err)
}