Commit graph

10 commits

Author SHA1 Message Date
maxinflection
16b1dd0a71
feat(gitlab): sync issue dependency links on push (#4294)
* feat(gitlab): sync issue dependency links on push

After issue content syncs, mirror local beads dependency edges as GitLab
issue links: blocks -> GitLab blocks/is_blocked_by (direction-normalized),
related/relates-to -> a single relates_to link per unordered pair (deduped).
Children of synced epics also keep the epic's milestone during a
dependency-only sync. Reports links_pushed in --json.

Additive only (never deletes remote links). License-aware: blocks/
is_blocked_by needs GitLab Premium/Ultimate; on instances without it the
link is reported as a single curated, non-fatal message (links_license_skipped
in JSON) while relates_to and milestones still apply. Genuine (non-license)
link failures remain real warnings, kept distinct from the license case.

Feature: max-efe

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(gitlab): address review — drop dead RelationMap, add push link parity

Follow-up to maphew's review on #4294.

- Delete the dead GitLab RelationMap: issueLinksToDependencies maps link
  types via hardcoded constants and ignores MappingConfig, so the field, its
  default, and the test assertion were dead config surface implying a
  configurability that does not exist. (Linear's RelationMap is untouched.)

- Give `bd gitlab push` dependency-link + epic-milestone parity with
  `bd gitlab sync`: extract the shared pushGitLabDependencyLinks helper from
  runGitLabSync's inline block and call it from runGitLabPush, scoped to the
  requested IssueIDs. Render push output natively so the link pass runs
  before the summary, dry-run ordering is correct, and the --json payload
  carries links_pushed / links_license_skipped / milestones_updated, matching
  sync in all output modes; also guard OnMessage under !jsonOutput.

Reviewed with /code-review + /codex (dry-run "Synced" line, output ordering,
and --json link-stat omission all caught and fixed here).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(gitlab): check outputJSON error in runGitLabSync (errcheck)

CI lint (first run on this branch, only-new-issues=false) flagged the
unchecked outputJSON return in the sync --json path. Return it, matching
runGitLabPush. Fixes the Lint / Build Artifacts / PR Lint failures.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(gitlab): carry closed state on push; surface failed-close in sync result

GitLab's POST /issues (and milestone/work-item creation) cannot set state,
so closed beads were pushed as opened issues and closed epics as active
milestones — milestone progress read 0/X even when all children were done.

- Close after create on all three paths (CreateIssue, createMilestone,
  createTaskWorkItem) via a best-effort follow-up state_event=close.
- BeadsIssueToGitLabFields emits state_event close/reopen so the update path
  flips both directions (reopening a bead reopens the GitLab issue). deferred
  stays open — only "done" work counts toward milestone completion.
- A failed best-effort close now records a warning on TrackerIssue.Warnings,
  which the engine drains into the sync result (visible in --json) instead of
  a bare stderr print that left --json reporting errors:0 while the issue was
  left open.

On close failure the created issue and its external_ref are still returned so
the next push doesn't create a duplicate (the push skip-guard means it won't
retry the close until the bead is next modified — hence the surfaced warning).

Reviewed via /code-review + Codex.

bd: max-9t6

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 08:00:41 -07:00
Eddie the Engineer
05b29caf55 fix(metrics): maintainer adoption fixes for usage-metrics + RunE refactor
Maintainer fixups for PR #4419 folded into one commit on top of the
contributor branch.

Security (blocker): metrics consent and endpoint are resolved from the
user-global config only (config.MetricsDisabledByUserConfig /
UserMetricsEndpoint). A project/BEADS_DIR config — highest viper precedence —
can no longer re-enable metrics or redirect the endpoint for a user who ran
`bd metrics off`.

First-run notice (major): the consent notice runs after the config-derived
json/quiet rebind and command classification, and is suppressed in
JSON/quiet/hook-json, BD_GIT_HOOK, hook/codex-hook/completion/shell-init/
version/prime, the metrics command, `init --stealth`, and the root
`bd --version` / `bd -V` probe, so it can never corrupt machine-readable or
hook/protocol output.

One cli_command event per invocation (major): delegating commands no longer
double-count. `bd ready --gated` and `bd mol wisp <proto>` record only their
own event by delegating to non-emitting cores (runMolReadyGatedCore /
runWispCreateCore), matching the existing runTodoListCore/runListCore pattern;
cardinality regression tests cover both aliases.

config get/show honor user-global metrics state (major): `bd config get
metrics.*` and `bd config show` report the user-global value (via
config.GetUserYamlConfig) that actually governs runtime behavior, with the
user-global path as the location, instead of a project value that has no
runtime effect.

Metrics cleanup on os.Exit paths (major): CheckReadonly and the reachable
pre-run gates (no-DB, fresh-clone, schema-skew, remote-migrate-gate, identity
mismatch) call the shared metrics.CloseAndFlush before exiting, so events
queued earlier in the run are still written and scheduled for upload instead
of stranded until the next clean exit. main()'s post-command tail uses the
same helper. `bd q` now creates its event before the readonly guard and labels
the readonly operation "q".

Telemetry coverage (major): recompute-blocked converted to RunE + HandleError
and emits a cli_command event; `metrics on/off/example` and `version` emit
cli_command events.

Consistency / minor cleanups: added SilenceUsage/SilenceErrors to the
ADO/GitHub/GitLab/Notion push/pull commands to match the jira/linear siblings
in the same file; corrected the inverted env-override "saved config" status
text; preserved 0600 when unsetting user-global config keys.

Pre-review CI repair (earlier in this commit): lint, stealth-init
cleanliness, proxied-server error handling, and regenerated CLI docs.

Tests: user-global opt-out vs project override at the config readers, runtime
resolvers, and `config get`; first-run notice suppression across
hook/protocol/json/quiet/stealth/root-version contexts; event cardinality for
the todo/ready-gated/wisp aliases; and CloseAndFlush persistence.

Original contributor commits preserved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 20:44:48 +00:00
coffeegoddd☕️✨
d7d7a34607 : refactor to use RunE, emit usage metrics, skip metrics in CI
(cherry picked from commit 9596c7233d)
2026-06-22 20:44:43 +00:00
Jozef Izso
42064c46fe
Sync Linear milestones as local epics (#3528) 2026-05-05 07:45:30 -07:00
maphew
cb1a0700b0 fix(linear): clean sync lock lint 2026-05-02 18:38:36 -07:00
kev
989d0f9496 feat(linear): add per-workspace concurrency lock on sync
Acquires .beads/.linear-sync.lock at start of bd linear sync to
serialize concurrent invocations. Stale lock detection via PID
check. Clean release on SIGTERM via defer. Prevents duplicate
creates and conflict thrash from overlapping sync runs.
2026-05-02 01:02:55 -04:00
matt wilkie
3e56f0b214
Document Linear external_ref pre-linking (#3517)
* Document Linear external ref prelinking (bd-ly3)
* Fix Linear sync dependency graph handling
* Fix init remote clone routing
* Fix stale gate help text
* Fix init remote cherry-pick integration
* Fix init remote flag handling
* Fix Linear prelink hydration blockers
* Fix Linear relation dependency gating
* Fix ready list parent filtering
* Deduplicate dry-run dependency previews by stored identity
2026-04-27 06:05:30 -07:00
matt wilkie
2f60a10fc5
Import Linear relations as dependencies (#3519)
* Fix gate and cook regressions (bd-r2l)

* Import Linear relations as dependencies (bd-ly3)
2026-04-26 20:30:02 -07:00
matt wilkie
c446a2ef09
fix(linear): harden push against data clobbering (#3328)
Closes #3289, #3309, #3252, #3253 — hardens Linear push: requires explicit linear.state_map.* config, rejects ambiguous state resolution, narrows push dedup to pushable fields, blocks unscoped project-filtered push from creating unlinked beads, and adds regression test for the orphan-ownership rule (parent-filtered push must not update external issues Beads hasn't claimed via external_ref).
2026-04-18 08:36:13 -07:00
Harry Miller
d802687869
feat: add --issues flag, push pull subcommands, and --parent port (#2975)
Adds CLI layer for selective sync on top of #2957:
- --issues flag registered on all 6 tracker sync commands via shared helpers
- New push/pull subcommands with --dry-run support
- --parent flag ported from Linear-only to ADO, Jira, GitHub, GitLab

Co-authored-by: Harry <harry_miller@trimble.com>
2026-04-05 22:27:46 -07:00