Remove unreachable utility functions (bd-224, bd-214)
- Remove duplicate computeIssueContentHash from sqlite/hash.go - Remove FileUsed() from internal/config/config.go - Remove verifyIssueOpen() test helper from git_sync_test.go - Remove unimplemented SummarizeTier2 and all tier2 infrastructure from haiku.go Removes ~120 LOC of dead code identified by deadcode analyzer. Amp-Thread-ID: https://ampcode.com/threads/T-5f150c35-8d67-4dae-bb92-a7b5887d649d Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -2,41 +2,10 @@ package sqlite
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"database/sql"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
|
||||
// computeIssueContentHash computes a SHA256 hash of an issue's content, excluding timestamps.
|
||||
// This is used for detecting timestamp-only changes during export deduplication.
|
||||
func computeIssueContentHash(issue *types.Issue) (string, error) {
|
||||
// Clone issue and zero out timestamps to exclude them from hash
|
||||
normalized := *issue
|
||||
normalized.CreatedAt = time.Time{}
|
||||
normalized.UpdatedAt = time.Time{}
|
||||
|
||||
// Also zero out ClosedAt if present
|
||||
if normalized.ClosedAt != nil {
|
||||
zeroTime := time.Time{}
|
||||
normalized.ClosedAt = &zeroTime
|
||||
}
|
||||
|
||||
// Serialize to JSON
|
||||
data, err := json.Marshal(normalized)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// SHA256 hash
|
||||
hash := sha256.Sum256(data)
|
||||
return hex.EncodeToString(hash[:]), nil
|
||||
}
|
||||
|
||||
// GetExportHash retrieves the content hash of the last export for an issue.
|
||||
// Returns empty string if no hash is stored (first export).
|
||||
func (s *SQLiteStorage) GetExportHash(ctx context.Context, issueID string) (string, error) {
|
||||
|
||||
Reference in New Issue
Block a user