- Mark unused forceUpdateIDs parameter with blank identifier
- Mark unused syncCtx parameter in detectGitLabConflictsWithContext
- Add nolint directive for resolveGitLabConflictsWithContext
(error return always nil is intentional - logs warnings but continues)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add wrapper functions (doPullFromGitLab, doPushToGitLab,
detectGitLabConflicts) so integration tests compile
- Change IssueConversion.Issue from interface{} to *types.Issue
(new package, no backwards compat needed); remove GetIssue() helper
- Replace raw http.Client in runGitLabProjects with gitlab.Client
method (ListProjects), getting retry/auth logic for free
- Add HTTPS validation on GitLab URL to prevent sending tokens
in cleartext (allows localhost for dev/testing)
- Add io.LimitReader (50MB) to client.go doRequest to prevent OOM
- Improve token masking: show only first 4 chars, not first+last 4
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Changes based on PR #1290 code review:
1. Wire up SyncContext in runGitLabSync - SyncContext was created
but not actually used in the main entry point
2. Delete legacy non-WithContext functions - removes code duplication
and eliminates dead code maintenance burden. All sync operations
now use WithContext variants exclusively
3. Fix --prefer-local behavior - conflicting issues now go to
forceUpdateIDs (to force push) instead of skipUpdateIDs. This
ensures local changes actually win when that strategy is selected
4. Document conflict detection 1-second tolerance - explains the
timestamp comparison window and its limitations for clock skew
5. Document UUID alternative for ID generation - notes that
distributed deployments may need UUIDs instead of the current
timestamp+counter+random approach
Test updates:
- All tests now use WithContext functions
- Removed global store manipulation from tests
- All 18 GitLab tests pass
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
P2 Issue #9: Remove deprecated resolveGitLabConflictsByTimestamp function
- Delete unused function that was superseded by resolveGitLabConflicts
- Remove associated tests that tested the deprecated function
P3 Issue #10: Document cross-project link limitation
- Add doc comment to CreateIssueLink clarifying same-project constraint
- Note that cross-project links will error at GitLab API level
P3 Issue #11: Fix ID collision on restart
- Add 4 random bytes to generateIssueID to prevent collisions
- Counter resets on process restart, random component ensures uniqueness
- Add test to verify random component is present
P3 Issue #12: Document error handling philosophy
- Add Error Handling Contract comment at top of gitlab_sync.go
- Documents fatal vs non-fatal error handling approach
- Clarifies that stats track error counts for reporting
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Add --prefer-local, --prefer-gitlab, and --prefer-newer flags to bd gitlab sync:
- --prefer-local: Always keep local beads version on conflict
- --prefer-gitlab: Always use GitLab version on conflict
- --prefer-newer: Use most recently updated version (default)
Features:
- Unified resolveGitLabConflicts() function with strategy parameter
- Flag validation (only one conflict strategy allowed)
- Automatic conflict detection and resolution in bidirectional sync
- 7 new tests for conflict resolution
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
- Fix path-based project ID comparison in doPushToGitLab (skip numeric
comparison when client.ProjectID contains "/" since we can't reliably
compare "group/project" with numeric 789)
- Add atomic counter to generateIssueID() to prevent collisions when
generating multiple IDs rapidly
- Add Warnings field to PullStats to track non-fatal issues like failed
gitlab.last_sync saves
- Add tests for conflict resolution (resolveGitLabConflictsByTimestamp)
All 4 code review issues addressed with TDD.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Added gitlab_sync.go with full sync implementation:
- doPullFromGitLab: imports GitLab issues to beads with incremental sync
- doPushToGitLab: creates/updates GitLab issues from local beads issues
- detectGitLabConflicts: finds issues modified on both sides since last sync
- resolveGitLabConflictsByTimestamp: resolves conflicts using newer-wins
- parseGitLabSourceSystem: parses "gitlab:projectID:iid" format
Updated gitlab.go:
- runGitLabSync now uses sync functions with --pull-only/--push-only flags
- Added proper error handling and progress output
8 new tests in gitlab_sync_test.go, all passing.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew