Commit graph

13 commits

Author SHA1 Message Date
coffeegoddd☕️✨
58915b13e7 /{cmd,internal}: update global store to be interface 2026-03-17 13:26:17 -07:00
obsidian
3872308568 refactor(tests): migrate all test files from StartTestDoltServer to container-native API
Migrate 12 TestMain files to use EnsureDoltContainerForTestMain/TerminateDoltContainer
instead of the removed StartTestDoltServer/TestDoltServer API.

Replace testServer.IsCrashed()/CrashError() crash detection with standalone
testutil.DoltContainerCrashed()/DoltContainerCrashError() in 6 test files.

(bd-m7sy)
2026-03-03 10:07:32 -08:00
Xexr
376122ba46
fix: prevent test suite from leaking databases onto production Dolt server (#2089)
Set BEADS_TEST_MODE=1 unconditionally in all 9 TestMain functions that
interact with Dolt, before the test server nil check. Previously, test
mode was only set when the test Dolt server started successfully — if it
failed, tests silently connected to production on port 3307 and created
testdb_/beads_* databases that were never cleaned up.

Also:
- Fix doctorTestServerPort() fallback from 3307 (production) to 0
- Add dolt_purge_dropped_databases() to both cleanup functions
- Add isolated test Dolt server to integration test TestMain which had
  no server at all, causing bd init subprocess to hit production

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: beads/crew/lydia <steve.yegge@gmail.com>
2026-02-24 22:26:30 -08:00
beads/crew/emma
11f5f432ed feat(testutil): branch-per-test isolation for dolt, tracker, molecules (L2)
Replace database-per-test with Dolt branch-per-test using COW snapshots
for three internal packages. Each TestMain creates one shared database
with committed schema; each test branches from main via DOLT_CHECKOUT
with MaxOpenConns=1 for session-level isolation.

New infrastructure:
- testutil.StartTestBranch / CleanTestBranches / SetupSharedTestDB
- dolt.Config.MaxOpenConns field wired into openServerConnection
- dolt.CreateIgnoredTables for wisps tables (not in commits)

cmd/bd and doctor packages stay on database-per-test because they
reopen stores from metadata.json via NewFromConfig, which creates new
connections on main branch.

Closes: bd--6tf4

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-24 16:16:56 -08:00
mayor
efdd6f73dc fix: prevent tests from connecting to prod Dolt server
- Add TestMain wrappers for molecules and tracker packages to spin up
  isolated test Dolt servers instead of hitting prod on port 3307
- Harden applyConfigDefaults: in test mode, BEADS_DOLT_PORT always
  overrides cfg.ServerPort (even if set from metadata.json)
- Add hard panic guard in dolt.New() if test mode tries to use prod port
- Clear GT_ROOT in TestDoltServerIsRunning to avoid finding daemon PID
- Set BEADS_DOLT_PORT in cmd/bd test server setup for bd init path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 22:54:26 -08:00
beads/crew/emma
68be32ac65 fix: CI formatting, lint, and test failures blocking release
- Fix gofmt alignment in cmd/bd/repo.go
- Replace panic with sentinel port (port 1) in applyConfigDefaults when
  BEADS_TEST_MODE=1 without BEADS_DOLT_PORT, preventing CI crashes while
  still guarding against accidental production connections
- Add dolt availability skip in protocol_test.go newWorkspace
- Remove stale //go:build cgo tag from molecules_test.go
- Change Fatalf to Skipf for Dolt connection failures in molecule loader tests
- Update store_unit_test.go to match sentinel port behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:10:38 -08:00
beads/crew/emma
a5da57e39b refactor: remove storage factory, memory backend, and provider abstraction (Phase 7)
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
2026-02-15 11:27:39 -08:00
collins
237f47ba7e feat: delete SQLite storage backend (Phase 2 of Dolt transition)
Remove the entire internal/storage/sqlite/ package (~43K lines) and update
all 80+ files that imported it to use either the Dolt backend directly
(test files) or the storage factory (production files).

Key changes:
- Delete internal/storage/sqlite/ directory (150+ files)
- Update factory to make Dolt the sole backend, treating "sqlite" as alias for "dolt"
- Replace sqlite.New() calls with dolt.New() in tests, factory.New() in production
- Replace *sqlite.SQLiteStorage with storage.Storage interface throughout
- Replace :memory: SQLite URIs with t.TempDir() for Dolt compatibility
- Inline sqlite.GenerateIssueID() as SHA-256 content hashing where needed
- Fix import cycle in routing/routes.go (routing→factory→dolt→routing)
- Preserve backward-compatible beads.NewSQLiteStorage() wrapper in public API

228 files changed, 605 insertions, 43,821 deletions.
go vet ./... passes clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 12:23:15 -08:00
jasper
aa663c40d7 fix(storage): move BatchCreateOptions to storage package for backend-agnostic batch creation
Fixes the leaky abstraction where molecules and importer packages directly used
sqlite.BatchCreateOptions and type-asserted to *sqlite.SQLiteStorage.

Changes:
- Add storage.BatchCreateOptions and storage.OrphanHandling as backend-agnostic types
- Add CreateIssuesWithFullOptions to Storage interface
- Implement for SQLite, Dolt, and Memory backends
- Update molecules.go to use Storage interface method instead of sqlite type assertion
- Update importer.go to use storage types instead of sqlite-specific interface
- Update cook.go to use storage interface method
- Add deprecated aliases in sqlite package for backward compatibility

This enables batch create optimizations for all backends including Dolt.

Closes: bd-nrcp

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

Executed-By: beads/jasper
Rig: beads
Role: polecat
2026-01-26 20:21:53 -08:00
collins
7cf67153de refactor(types): remove Gas Town type constants from beads core (bd-w2zz4)
Remove Gas Town-specific type constants (TypeMolecule, TypeGate, TypeConvoy,
TypeMergeRequest, TypeSlot, TypeAgent, TypeRole, TypeRig, TypeEvent, TypeMessage)
from internal/types/types.go.

Beads now only has core work types built-in:
- bug, feature, task, epic, chore

All Gas Town types are now purely custom types with no special handling in beads.
Use string literals like "gate" or "molecule" when needed, and configure
types.custom in config.yaml for validation.

Changes:
- Remove Gas Town type constants from types.go
- Remove mr/mol aliases from Normalize()
- Update bd types command to only show core types
- Replace all constant usages with string literals throughout codebase
- Update tests to use string literals

This decouples beads from Gas Town, making it a generic issue tracker.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 10:36:59 -08:00
beads/crew/emma
4f0f5744a6 feat(types): remove Gas Town types from core built-in types
Core beads built-in types now only include work types:
- bug, feature, task, epic, chore

Gas Town types (molecule, gate, convoy, merge-request, slot, agent,
role, rig, event, message) are now "well-known custom types":
- Constants still exist for code convenience
- Require types.custom configuration for validation
- bd types command shows core types and configured custom types

Changes:
- types.go: Separate core work types from well-known custom types
- IsValid(): Only accepts core work types
- bd types: Updated to show core types and custom types from config
- memory.go: Use ValidateWithCustom for custom type support
- multirepo.go: Only check core types as built-in
- Updated all tests to configure custom types

This allows Gas Town (and other projects) to define their own types
via config while keeping beads core focused on work tracking.

Closes: bd-find4

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 05:07:11 -08:00
Steve Yegge
5f3cb0fdf3 refactor: remove Gas Town references from codebase
Replace Gas Town-specific terminology with generic orchestrator concepts:
- "Gas Town" → "orchestrator" or "multi-clone"
- Hardcoded ~/gt/ paths → GT_ROOT environment variable
- signalGasTownActivity → signalOrchestratorActivity
- GUPP → hook-based work assignment

Updated 21 files across CHANGELOG, cmd/bd/, internal/, docs/, scripts.

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

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

Executed-By: beads/crew/dave
Rig: beads
Role: crew
2025-12-30 14:13:32 -08:00
Steve Yegge
f6392efd07 feat(molecules): Add molecules.jsonl as separate catalog file for templates
Implements gt-0ei3: Template molecules now live in a separate molecules.jsonl
file, distinct from work items in issues.jsonl.

Key changes:
- Add internal/molecules package for loading molecule catalogs
- Implement hierarchical loading: built-in → town → user → project
- Molecules use their own ID namespace (mol-*) with prefix validation skipped
- Templates are marked with is_template: true and are read-only
- bd list excludes templates by default (existing functionality)

The hierarchical loading allows:
- Built-in molecules shipped with bd binary (placeholder for future)
- Town-level: ~/gt/.beads/molecules.jsonl (Gas Town)
- User-level: ~/.beads/molecules.jsonl
- Project-level: .beads/molecules.jsonl

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 09:27:41 -08:00