Commit graph

19 commits

Author SHA1 Message Date
beads/crew/jane
3962285726 chore: clean up stale SQLite references in comments (bd-nlw2m)
Update ~20 stale comments across the Dolt storage layer that still
referenced SQLite after the migration to Dolt-only storage. Rename
LargeSQLite/XLargeSQLite fixture functions to LargeDolt/XLargeDolt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 11:50:52 -08:00
obsidian
304c6846e1 fix: gofmt formatting across 24 files and 2 lint warnings (bd-i4o4e)
Run make fmt to fix all gofmt issues. Add nolint directives for:
- G204 (gosec) in cmd/bd/stubs.go: git args are internal, not user-supplied
- unparam in internal/syncbranch/worktree.go: error return kept for callers

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

Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
2026-02-16 01:17:23 -08:00
emma
03a1415419 cleanup: remove stale golangci suppressions and dead compact methods
- Remove 13 deleted-file references from .golangci.yml gosec suppressions
  (G304, G306, G204, G115 patterns referencing removed daemon/autoflush files)
- Remove deprecated CompactTier1Single (unused outside tests, replaced by CompactTier1)
- Remove placeholder CompactTier2 (unused outside tests, never implemented)
- Remove corresponding test cases for both removed methods

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-16 00:53:15 -08:00
lydia
4be0f382b7 refactor: strip dirty tracking from Storage interface (woho.4)
Phase 2 of Dolt transition: remove JSONL dirty tracking methods from
the Storage interface and all implementations.

Removed from Storage interface:
- GetDirtyIssues, GetDirtyIssueHash, ClearDirtyIssuesByID
- GetExportHash, SetExportHash, ClearAllExportHashes
- GetJSONLFileHash, SetJSONLFileHash

Removed from CompactableStorage interface:
- MarkIssueDirty

Deleted implementation files:
- internal/storage/dolt/dirty.go
- internal/storage/sqlite/dirty.go
- internal/storage/sqlite/dirty_test.go
- internal/storage/sqlite/hash.go

Cleaned up all callers in cmd/bd/, internal/compact/, internal/importer/,
internal/rpc/, and internal/storage/ packages. Removed or stubbed dead
code paths (incremental export thresholds, JSONL integrity validation).

Note: Internal SQLite markDirty() helpers that INSERT INTO dirty_issues
remain as harmless side effects - follow-up cleanup tracked separately.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 12:21:14 -08:00
beads/crew/lizzy
2bb827facb style: run gofmt across entire codebase (bd-nmk12)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:35:20 -08:00
beads/crew/lizzy
4a69d7286e chore: unexport 4 dead symbols in internal/compact
Unexport package-internal symbols with no external callers:
- CompactableStore interface
- HaikuClient type, newHaikuClient constructor
- ErrAPIKeyRequired sentinel error

Kept BatchResult exported (used by internal/rpc/server_compact.go).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 18:00:22 -08:00
collins
9c96517d01 test(compact): improve internal/compact coverage from 54.9% to 87.9%
Add comprehensive unit tests for New constructor, CompactTier1 error
paths, CompactTier1Single, CompactTier2, and SummarizeTier1 with audit.
Fix nil pointer dereference in New when API key is missing (typed nil
*HaikuClient assigned to summarizer interface caused panic in type
assertion).

Closes bd-thgk

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 18:41:47 -08:00
Joseph Turian
e48e94e248 fix(compact): restore safety logic accidentally removed in cb1e3555
Commit cb1e3555 ("refactor(rpc): fix leaky abstraction") accidentally
rewrote CompactTier1() and removed critical safety features:

Restored:
- CheckEligibility() call before GetIssue() (fail fast on ineligible)
- DryRun returns error with details, not silent nil
- Size check: skip compaction if summary >= original size
- Git commit hash capture via GetCurrentCommitHash()
- Proper warning comment when compaction is skipped

Also fixed data race in test:
- Add mutex to stubSummarizer.calls for thread-safe access in batch test

The tests were correct - they defined the original intended behavior
that was working before the accidental regression.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 01:55:48 -08:00
opal
cb1e355511 refactor(rpc): fix leaky abstraction - remove direct sqlite imports (bd-oslm)
The RPC layer was directly importing storage/sqlite and doing type
assertions to *sqlite.SQLiteStorage, which broke abstraction and
prevented Dolt backend from using certain features.

Changes:
- Add CompactableStorage and BatchDeleter interfaces to storage package
- Move CompactionCandidate and DeleteIssuesResult types to internal/types
- Update RPC handlers to use interface type assertions instead of concrete types
- Update compact package to accept interface instead of concrete type
- Remove unnecessary type assertions where methods exist on Storage interface

This enables Dolt (and future backends) to implement optional features
like compaction and batch delete through proper interface extension.

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

Executed-By: beads/opal
Rig: beads
Role: polecat
2026-01-26 20:28:27 -08:00
onyx
6a9de49478 refactor(compact): accept interface instead of concrete SQLiteStorage (bd-oa45)
The compact.New constructor was tightly coupled to *sqlite.SQLiteStorage,
preventing other storage backends (like Dolt) from using the compaction
feature even if they implemented the required methods.

Changes:
- Export issueStore as CompactableStore interface
- Change New() to accept CompactableStore instead of *sqlite.SQLiteStorage
- Remove unused sqlite import

The struct already used the interface internally; this change simply
fixes the constructor signature to accept any compliant implementation.

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

Executed-By: beads/onyx
Rig: beads
Role: polecat
2026-01-26 20:25:03 -08:00
Jordan Hubbard
c9fa7af04c test: expand compact and ui coverage 2025-12-29 16:01:11 -08:00
Steve Yegge
7b758271ed feat(audit): add append-only agent audit trail (.beads/interactions.jsonl)
Implements audit logging for agent interactions to support auditing and
dataset generation (fixes #649).

New features:
- .beads/interactions.jsonl (append-only audit log)
- bd audit record: log LLM calls, tool calls, or pipe JSON via stdin
- bd audit label <id>: append labels (good/bad) for dataset curation
- bd compact --audit: optionally log LLM prompt/response during compaction
- bd init: creates empty interactions.jsonl
- bd sync: includes interactions.jsonl in staging

Audit entries are append-only - labeling creates new entries that
reference parent entries by ID.

Closes #649

Co-authored-by: Dmitry Chichkov <dchichkov@nvidia.com>

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 03:24:51 -08:00
Steve Yegge
c2c7eda14f Fix 15 lint errors: dupl, gosec, revive, staticcheck, unparam
Reduced golangci-lint issues from 56 to 41:

Fixed:
- dupl (2→0): Extracted parseLabelArgs helper, added nolint for cobra commands
- gosec G104 (4→0): Handle unhandled errors with _ = assignments
- gosec G302/G306 (4→0): Fixed file permissions from 0644 to 0600
- revive exported (4→0): Added proper godoc comments for all exported types
- staticcheck SA1019 (1→0): Removed deprecated netErr.Temporary() call
- staticcheck SA4003 (1→0): Removed impossible uint64 < 0 check
- unparam (8→0): Removed unused params/returns, added nolint where needed

Renamed types in compact package to avoid stuttering:
- CompactConfig → Config
- CompactResult → Result

Remaining 41 issues are documented baseline:
- gocyclo (24): High complexity in large functions
- gosec G204/G115 (17): False positives for subprocess/conversions

Closes bd-92

Amp-Thread-ID: https://ampcode.com/threads/T-1c136506-d703-4781-bcfa-eb605999545a
Co-authored-by: Amp <amp@ampcode.com>
2025-10-24 12:40:56 -07:00
Steve Yegge
9dcb86ebfb Fix lint errors: handle errors, use fmt.Fprintf, apply De Morgan's law, use switch statements
Amp-Thread-ID: https://ampcode.com/threads/T-afcf56b0-a8bc-4310-bb59-1b63e1d70c89
Co-authored-by: Amp <amp@ampcode.com>
2025-10-24 12:27:07 -07:00
Steve Yegge
a86f3e139e Add native Windows support (#91)
- Native Windows daemon using TCP loopback endpoints
- Direct-mode fallback for CLI/daemon compatibility
- Comment operations over RPC
- PowerShell installer script
- Go 1.24 requirement
- Cross-OS testing documented

Co-authored-by: danshapiro <danshapiro@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-c6230265-055f-4af1-9712-4481061886db
Co-authored-by: Amp <amp@ampcode.com>
2025-10-20 21:08:49 -07:00
Steve Yegge
65f59e6b01 Add compacted_at_commit field and git commit capture during compaction
- Add compacted_at_commit field to Issue type (bd-405)
- Add database schema and migration for new field
- Create GetCurrentCommitHash() helper function
- Update ApplyCompaction to store git commit hash (bd-395)
- Update compaction calls to capture current commit
- Update tests to verify commit hash storage
- All tests passing

Amp-Thread-ID: https://ampcode.com/threads/T-5518cccb-7fc9-4dcd-ba5a-e22cd10e45d7
Co-authored-by: Amp <amp@ampcode.com>
2025-10-16 17:43:38 -07:00
Steve Yegge
e99de1b5e3 Add EventCompacted to event system (bd-262)
- Add EventCompacted event type constant
- Add compaction fields to Issue struct (CompactionLevel, CompactedAt, OriginalSize)
- Update ApplyCompaction to record compaction events with JSON metadata
- Update bd show to display compaction status with emoji indicators
- Update GetIssue query to load compaction fields
- All tests passing

Amp-Thread-ID: https://ampcode.com/threads/T-3f7946c6-8f5e-4a81-9527-1217041c7b39
Co-authored-by: Amp <amp@ampcode.com>
2025-10-16 01:00:27 -07:00
Steve Yegge
da5493bac0 Remove snapshot/restore functionality from compaction
Snapshots defeated the entire purpose of compaction - if we're keeping
the original content, we're not actually saving any space. Compaction
is about graceful memory decay for agentic databases, not reversible
compression.

Removed:
- CreateSnapshot/GetSnapshots/RestoreFromSnapshot from storage
- --restore flag and functionality from bd compact command
- All snapshot-related tests
- Snapshot struct and related code

The database is ephemeral and meant to decay over time. Compaction
actually reduces database size now.

Closes bd-260 (won't fix - conceptually wrong)
Closes bd-261 (already done in bd-259)
2025-10-16 00:26:42 -07:00
Steve Yegge
0da81371b4 Implement Tier 1 compaction logic (bd-257)
- Add Compactor with CompactTier1 and CompactTier1Batch methods
- Single issue and batch compaction with 5 concurrent workers
- Dry-run mode for testing without API calls
- Smart size checking: keeps original if summary is longer
- Improved Haiku prompts to emphasize compression
- Add ApplyCompaction method for setting compaction metadata
- Comprehensive tests including API integration tests
- All tests passing
2025-10-15 23:31:43 -07:00