Follow-up to #3929 (GitHub tracker fix by @sealocal). The same bug
existed in jira, gitlab, ado, and notion trackers: their getConfig()
methods read every key from the Dolt store, but secret keys (API
tokens, PATs) should never be in the database because it gets pushed
to remotes, triggering secret-scanning blocks.
Changes:
- Add jira.api_token, gitlab.token, ado.pat to the yaml-only key
list so they are stored in config.yaml (not the Dolt database),
consistent with github.token and linear.api_key.
- Add IsYamlOnlyKey guard to getConfig() in all four trackers,
mirroring the pattern in linear/tracker.go and the merged GitHub
tracker fix.
- Add regression tests (nil-store bypass + yaml-read) for jira,
gitlab, and ado; defensive yaml-only path test for notion.
- Update existing tests that put secret keys in mock stores to use
t.Setenv instead, matching the new yaml-only behavior.
Co-Authored-By: sealocal <4951910+sealocal@users.noreply.github.com>
- Query Task work item type ID dynamically via GraphQL instead of
hardcoding gid://gitlab/WorkItems::Type/5 (varies by GitLab instance).
Result is cached per session with fallback for older GitLab versions.
- Add FetchMilestoneByIID using the iids[] API parameter to fetch a
single milestone directly, replacing the O(n) FetchMilestones scan
in findParentEpicMilestone.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Executed-By: beads/crew/emma
- Fix pull dedup: check wisps table and match work_items URLs
- Add type-based filtering to GitLab sync CLI
- Default-exclude molecule/message/event types from push
- Fix source_system update that breaks external_ref persistence
- Map all beads statuses to GitLab scoped labels for board columns
- Handle status::review and status::done labels on pull
- Map epic beads to GitLab milestones instead of issues
- Create task beads as GitLab Task work items with parent hierarchy
- Walk parent chain to find epic milestone, use API ID not IID
Co-authored-by: ktoulgaridis <ktoulg@gmail.com>
Executed-By: beads/crew/emma
* fix: recognize ado:NNNNN shorthand in IsExternalRef and ExtractIdentifier
IsExternalRef and ExtractIdentifier only matched full ADO URLs
(/_workitems/edit/\d+), but BuildExternalRef produces ado:NNNNN
shorthand when org/project config is unavailable. This caused the
sync engine to treat existing beads as new, creating duplicate ADO
work items instead of updating existing ones.
Fixes harry-miller-trimble/beads#28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: add shorthand ref support to GitHub/GitLab trackers, tighten ado:0
Address PR #2966 review feedback:
- GitHub tracker: add ghShorthandPattern (github:{id}) to IsExternalRef
and ExtractIdentifier, fixing the same duplicate-creation bug as ADO
- GitLab tracker: add glShorthandPattern (gitlab:{id}) to IsExternalRef
and ExtractIdentifier, fixing the same duplicate-creation bug as ADO
- ADO tracker: tighten regex from ^ado:(\d+)$ to ^ado:([1-9]\d*)$ to
reject ado:0 which is invalid in practice
- Add test cases for shorthand format in all three trackers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: add optional group-level GitLab issue sync (be-711)
When gitlab.group_id is configured, FetchIssues and FetchIssuesSince
use the /groups/:id/issues API endpoint to aggregate issues across all
projects in the group. Issue creation still uses the project endpoint
(via gitlab.project_id or gitlab.default_project_id).
New config keys:
- gitlab.group_id / GITLAB_GROUP_ID
- gitlab.default_project_id / GITLAB_DEFAULT_PROJECT_ID
Backward compatible: existing project-level sync is unchanged when
group_id is not set.
* feat: add filtering support to GitLab group sync (be-4js)
Add optional filters for labels, project, milestone, and assignee to
the GitLab issue sync. Filters work on both project and group endpoints.
Filters can be set via config (gitlab.filter_labels, etc.), environment
variables (GITLAB_FILTER_LABELS, etc.), or CLI flags (--label, --project,
--milestone, --assignee). CLI flags override config defaults.
Labels, milestone, and assignee are passed as GitLab API query params.
Project filtering within a group is done client-side since the GitLab
group issues API doesn't support it natively.
- TestServerErrorRetry: verifies 500/502/503/504 are retried with backoff
- TestNonRetriableError: verifies 403 is NOT retried
- TestDeleteIssue_InvalidatesBlockedCache: verifies single delete clears cache
- TestDeleteIssues_InvalidatesBlockedCache: verifies batch delete clears cache
- Update TestFetchIssuesSince_Error with short timeout (500s now retried)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extend the existing 429 rate-limit retry logic to also cover transient
server errors (500, 502, 503, 504) with the same exponential backoff.
GitLab occasionally returns 5xx during maintenance or load spikes; these
are safe to retry.
Co-Authored-By: iliev01 <31753916+iliev01@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Strip out the multi-backend storage layer: factory pattern, memory/in-memory
provider, connection string parsing, local provider, and associated tests.
Inline Dolt as the sole storage backend. Part of Dolt-Native Beads v2 epic.
WIP - SQLite removal in progress, more cleanup phases to follow.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Code health review found 30+ instances of error suppression using blank
identifier without explanation. Added comments to 82 files explaining WHY
each error is safely ignored (best-effort cleanup, advisory operations,
safe defaults, etc.) to improve code maintainability.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/jasper
Rig: beads
Role: polecats
Move IssueTracker implementations from internal/tracker/adapters/{linear,gitlab}/
directly into internal/{linear,gitlab}/ and create a new minimal Jira tracker.
Each package now registers itself via init(), eliminating the adapter indirection
layer. Delete the adapters/ directory entirely.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
- daemon_autostart.go: Add stubbable function variables for isDoltBackend
and singleProcessOnlyBackend to allow tests to bypass backend checks
when testing env var behavior
- autostart_test.go: Stub out backend checks in TestDaemonAutoStart
- daemon_autostart_unit_test.go: Stub out backend checks in
TestDaemonAutostart_StartDaemonProcess_Stubbed
- client_test.go: Update context cancellation tests to accept either
context.Canceled or pagination limit exceeded as valid loop termination
(both prevent infinite loops which is what the tests verify)
- ensure_worktree_test.go: Resolve symlinks before comparing paths in
TestFreshCloneScenario (fixes macOS /var -> /private/var symlink issue)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Same data race fix as the other gitlab test - requestCount is accessed
from both the HTTP handler goroutine and the test goroutine.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
TestFetchIssuesSince_ContextCancellation had a data race where
requestCount was written by the HTTP handler goroutine and read
by the test goroutine without synchronization.
Use sync/atomic.Int64 to make the counter thread-safe.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add explicit error suppression (`_ =`) for unchecked resp.Body.Close()
in internal/gitlab/client.go and unchecked json.NewEncoder, w.Write,
json.NewDecoder, and os.Setenv/Unsetenv calls in gitlab test files.
Replace os.Setenv/Unsetenv with t.Setenv in gitlab_test.go for
automatic cleanup.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
- 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
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
- Fix swallowed json.Marshal error during retry (client.go line 114)
Now logs the error and continues to next retry attempt instead of
silently ignoring with _.
- Add GetIssue() helper to IssueConversion for type-safe access
Returns *types.Issue from interface{} field, nil if wrong type.
Avoids import cycle by keeping interface{} but providing safe accessor.
- Eliminate duplicate mapping definitions between types.go and mapping.go
Export PriorityMapping, StatusMapping, TypeMapping from types.go as
single source of truth. DefaultMappingConfig now uses these exports.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Add safeguards to prevent infinite loops in FetchIssues and FetchIssuesSince:
1. MaxPages constant (1000) prevents runaway pagination from malformed
X-Next-Page headers that never return empty
2. Context cancellation check at start of each pagination loop iteration
allows graceful shutdown and returns partial results when cancelled
between requests
Fixes potential DoS from malformed GitLab responses and improves
responsiveness to cancellation signals.
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
Code review identified these issues:
- ProjectID now URL-encoded via projectPath() helper for path-based IDs
- Added WithEndpoint() builder for custom API endpoints
- Added FetchIssueByIID() for fetching single issues
- Added CreateIssueLink() for creating issue dependencies
All 15 client tests pass. Ready for sync implementation.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Add bidirectional mapping between GitLab issues and beads issues:
- MappingConfig for configurable field mappings (priority, status, type, relations)
- GitLabIssueToBeads for import/pull operations
- BeadsIssueToGitLabFields for export/push operations
- IssueLinksToDependencies for dependency conversion
- Support for scoped labels (priority::*, status::*, type::*)
- FilterNonScopedLabels to preserve custom labels
All 11 mapping tests passing (30 total in gitlab package).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
TDD implementation of GitLab client for beads integration:
- NewClient constructor with builder pattern (WithHTTPClient)
- FetchIssues with pagination support via X-Next-Page header
- FetchIssuesSince for incremental sync with updated_after param
- CreateIssue for POST /projects/:id/issues
- UpdateIssue for PUT /projects/:id/issues/:iid
- GetIssueLinks for GET /projects/:id/issues/:iid/links
- Retry logic with exponential backoff for rate limiting (429)
- Proper error handling with status code context
All 11 new tests pass (19 total in gitlab package).
Closes#5
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew