beads/internal/storage/batch.go
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

25 lines
1 KiB
Go

// Package storage defines the interface for issue storage backends.
package storage
// OrphanHandling specifies how to handle issues with missing parent references.
type OrphanHandling string
const (
// OrphanStrict fails import on missing parent (safest)
OrphanStrict OrphanHandling = "strict"
// OrphanResurrect auto-resurrects missing parents from JSONL history
OrphanResurrect OrphanHandling = "resurrect"
// OrphanSkip skips orphaned issues with warning
OrphanSkip OrphanHandling = "skip"
// OrphanAllow imports orphans without validation (default, works around bugs)
OrphanAllow OrphanHandling = "allow"
)
// BatchCreateOptions contains options for batch issue creation.
// This is a backend-agnostic type that can be used by any storage implementation.
type BatchCreateOptions struct {
// OrphanHandling specifies how to handle issues with missing parent references
OrphanHandling OrphanHandling
// SkipPrefixValidation skips prefix validation for existing IDs (used during import)
SkipPrefixValidation bool
}