Fix TestAddCommentUpdatesTimestamp timing flake on Windows

The test was failing on Windows CI because of insufficient time resolution
between creating an issue and adding a comment. Both operations could
complete within the same time unit, causing identical timestamps.

Added a 2ms sleep between operations to ensure updated_at is strictly
after the original timestamp, even on systems with lower time resolution.

Fixes: bd-pi7u

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-23 10:57:29 -08:00
parent c50695b3d4
commit 5b77ddb215
2 changed files with 6 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"strings"
"testing"
"time"
"github.com/steveyegge/beads/internal/types"
)
@@ -253,6 +254,10 @@ func TestAddCommentUpdatesTimestamp(t *testing.T) {
originalUpdatedAt := issue.UpdatedAt
// Sleep briefly to ensure timestamp difference on systems with low time resolution (e.g., Windows)
// This prevents flaky test failures when both operations complete in the same millisecond
time.Sleep(2 * time.Millisecond)
// Add comment
err = store.AddComment(ctx, issue.ID, "alice", "Test comment")
if err != nil {