Commit graph

9 commits

Author SHA1 Message Date
coffeegoddd☕️✨
50f715b124 /{cmd,internal}: move local only state to dolt ignored tables 2026-04-14 14:47:30 -07:00
Jim Wordelman
677f7bcd3d
feat: add SlotSet/SlotGet/SlotClear to Storage interface (#2870)
* feat: add SlotSet/SlotGet/SlotClear to Storage interface

Metadata slot operations for key-value pairs stored in issue metadata
JSON. Used by gt for delegation tracking, hook state, and other
per-issue data.

- SlotSet: set or overwrite a metadata key
- SlotGet: read a metadata key (error if not found)
- SlotClear: remove a metadata key (no-op if absent)

Implemented in DoltStore, EmbeddedDoltStore, and InstrumentedStorage.

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

* fix: add SlotSet/SlotGet/SlotClear stubs to configStore test mock

The configStore mock in jira/tracker_test.go was missing the three new
Storage interface methods, causing go vet to fail.

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

---------

Co-authored-by: mayor <jim@wordelman.name>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: beads/crew/emma <steve.yegge@gmail.com>
2026-04-02 19:25:18 -07:00
emma
169f357cbb feat: add MergeSlot methods to Storage interface (fix-merge PR #2787)
Co-Authored-By: Jim Wordelman <jim@wordelman.name>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 19:34:21 -07:00
emma
46c8f13c57 feat: add ListWisps method to Storage interface (fix-merge PR #2783)
Co-Authored-By: Jim Wordelman <jim@wordelman.name>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 19:33:28 -07:00
emma
dc96e34812 feat: add ReopenIssue and UpdateIssueType to Storage interface (fix-merge PR #2782)
Co-Authored-By: Jim Wordelman <jim@wordelman.name>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 19:33:14 -07:00
mayor
1ce765eef8 feat: UUID primary keys for federation-safe events
Replace BIGINT AUTO_INCREMENT with CHAR(36) UUID primary keys on 6 tables
(events, comments, issue_snapshots, compaction_snapshots, wisp_events,
wisp_comments) to eliminate duplicate PK collisions during Dolt federation.

- Change Event.ID and Comment.ID from int64 to string
- Change GetAllEventsSince to use time.Time instead of int64 high-water marks
- Add migration 010 to convert existing BIGINT PKs to UUID
- Remove resetAutoIncrements band-aid (no longer needed)
- Generate UUIDs in Go before INSERT for comments (ImportIssueComment)
- Schema version bumped from 6 to 7
2026-03-13 19:02:50 -07:00
beads/crew/collins
6219b8692d fix: CI formatting, lint, and test failures blocking release
1. FORMATTING: gofmt 14 files.

2. LINT:
   - Delete dead code cmd/bd/bootstrap.go (unused bootstrapEmbeddedDolt)
   - Prefix unused 'actor' param in wisps.go updateWisp with _
   - Prefix unused 'ctx' param in telemetry.go buildTraceProvider with _

3. TESTS: Add skipIfNoDolt to test helpers that call dolt.New() without
   a running test server. In CI (no dolt installed), these tests now skip
   instead of failing with "server unreachable at 127.0.0.1:3307".
   Delete TestOpenFromConfig_Embedded and TestOpenFromConfig_DefaultsToEmbedded
   which tested removed embedded Dolt functionality.

   Fixed packages: beads_test, cmd/bd, cmd/bd/doctor, cmd/bd/doctor/fix,
   internal/tracker, internal/utils

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 18:53:35 -08:00
obsidian
2e425d0692 fix: isolate test suite from production Dolt server (bd-2lf6)
Add beforeTestsHook implementation that starts a dedicated Dolt
sql-server in a temp directory on a dynamic port. Tests now create
testdb_* databases on this isolated server instead of the production
one, preventing lock contention and server crashes.

Also fix telemetry/storage.go RunInTransaction signature to match
the updated Storage interface (commitMsg parameter).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
2026-02-22 16:25:03 -08:00
Pierre-Alexandre Entraygues
6e4ad9b283
feat(otel): opt-in OpenTelemetry instrumentation (#1940)
* feat(otel): comprehensive OpenTelemetry instrumentation

Phase 1 (telemetry foundation + SQL + CLI + AI):
- Add internal/telemetry package: Init/Shutdown, Tracer/Meter helpers,
  stdout + OTLP/gRPC exporters, noop providers when disabled
- Add internal/telemetry/storage.go: InstrumentedStorage decorator for
  SDK consumers with bd.storage.* counters and duration histograms
- Instrument DoltStore SQL layer (execContext, queryContext, queryRowContext)
  with dolt.exec / dolt.query / dolt.query_row spans
- Instrument Anthropic API calls in compact/haiku.go and find_duplicates.go
  with bd.ai.input_tokens, bd.ai.output_tokens, bd.ai.request.duration
- Add bd.command.<name> span in PersistentPreRun/PostRun with actor attribute

Phase 2 (VC ops, hooks, sync, metrics):
- Add dolt.commit / dolt.push / dolt.force_push / dolt.pull / dolt.branch /
  dolt.checkout / dolt.merge spans for Dolt version-control procedures
  (these bypass execContext so needed dedicated spans)
- Add bd.db.retry_count counter in withRetry (server mode retries)
- Add bd.db.lock_wait_ms histogram in AcquireAccessLock (flock contention)
- Add ephemeral.count / ephemeral.nuke spans for SQLite ephemeral store
- Add hook.exec spans in hooks_unix/windows runHook (background root spans)
- Add tracker.sync / tracker.pull / tracker.push / tracker.detect_conflicts
  spans with per-phase stats attributes in tracker/engine.go
- Add bd.issue.count gauge (by status) in InstrumentedStorage.GetStatistics
- Fix: call initAIMetrics via sync.Once in newHaikuClient so ai metrics
  are actually registered

Configuration:
  BD_OTEL_ENABLED=true              enable (default: off, zero overhead)
  BD_OTEL_STDOUT=true               write to stdout for dev/debug
  OTEL_EXPORTER_OTLP_ENDPOINT=...  ship to Jaeger/Grafana/Honeycomb/etc.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(otel): align with VictoriaMetrics HTTP stack

- Switch metric exporter: gRPC → HTTP (otlpmetrichttp)
- Activation: BD_OTEL_METRICS_URL presence (no more BD_OTEL_ENABLED flag)
  matches GT_OTEL_METRICS_URL convention from the local observability stack
- BD_OTEL_METRICS_URL=http://localhost:8428/opentelemetry/api/v1/push
- BD_OTEL_LOGS_URL=http://localhost:9428/insert/opentelemetry/v1/logs (reserved)
- Traces: stdout only (BD_OTEL_STDOUT=true); noop otherwise since VictoriaMetrics
  is a metrics-only backend — no trace overhead in production
- Remove: otlptracegrpc, otlpmetricgrpc
- Update docs/OBSERVABILITY.md to match the diffusiontown README style

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(otel): capture hook stdout/stderr and bd.args in spans

- hook.exec span now records stdout and stderr as span events after
  the hook process exits (including partial output on timeout)
- Output is truncated to 1024 bytes; the event carries both the text
  (output) and the original size (bytes) as attributes
- bd.command.<name> span now includes bd.args with the raw CLI
  arguments (e.g. "create 'title' -p 2")

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(otel): address review feedback — stale comment, span leak, hot-path alloc

1. Fix stale BD_OTEL_ENABLED comment in main.go (actual env vars are
   BD_OTEL_METRICS_URL and BD_OTEL_STDOUT)
2. Use defer+named returns in Merge() to prevent span leaks
3. Cache doltSpanAttrs() via sync.Once to avoid per-call allocation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: beads/crew/emma <steve.yegge@gmail.com>
2026-02-22 15:36:57 -08:00