* /{cmd,internal}: wip, missing compact
* /cmd/bd: add compact support
* /cmd/bd: add tests
* address Copilot review feedback on proxied maintenance commands
- gc: track Dolt GC failure; report "GC completed with errors", set
JSON success=false, and exit non-zero instead of always printing "GC complete"
- gc: scalarCount handles []byte/uint64/float64 in addition to string/int64
- proxied_maintenance: use HandleErrorRespectJSON so --json callers get JSON errors
- clean-databases: fail loudly on rows.Scan error instead of silently skipping
- test: check fmt.Sscanf error in proxiedCommitCount
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(proxied): readonly guard + JSON parity for compact --dolt
Maintainer follow-ups to the proxied maintenance commands:
- runCompactDoltProxiedServer: enforce CheckReadonly("compact") on the
non-dry-run path, matching the embedded dispatch in compact.go and the
other proxied handlers (gc, admin compact).
- runCompactDoltProxiedServer: route the Dolt GC failure through
HandleErrorRespectJSON so --json callers get a structured error,
consistent with the rest of this PR's proxied paths.
- runCompactProxiedServer: emit remote_refs_pruned / tags_anchoring as
arrays in --json output, matching the embedded compact_dolt.go schema
instead of emitting counts under the same keys.
Agent-Signature: claude-fable-5-high on behalf of maphew
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/steveyegge/beads/internal/storage/versioncontrolops"
|
|
)
|
|
|
|
func runCompactDoltProxiedServer(ctx context.Context) error {
|
|
start := time.Now()
|
|
|
|
if !compactDryRun {
|
|
CheckReadonly("compact")
|
|
}
|
|
|
|
if compactDryRun {
|
|
if jsonOutput {
|
|
return outputJSON(map[string]interface{}{
|
|
"dry_run": true,
|
|
})
|
|
}
|
|
fmt.Printf("DRY RUN - Dolt garbage collection\n\n")
|
|
fmt.Printf("Run without --dry-run to perform garbage collection.\n")
|
|
return nil
|
|
}
|
|
|
|
if !jsonOutput {
|
|
fmt.Printf("Running Dolt garbage collection...\n")
|
|
}
|
|
|
|
err := runProxiedNonTx(ctx, func(ctx context.Context, conn *sql.Conn) error {
|
|
return versioncontrolops.DoltGC(ctx, conn)
|
|
})
|
|
if err != nil {
|
|
return HandleErrorRespectJSON("dolt gc failed: %v", err)
|
|
}
|
|
|
|
elapsed := time.Since(start)
|
|
|
|
if jsonOutput {
|
|
return outputJSON(map[string]interface{}{
|
|
"success": true,
|
|
"elapsed_ms": elapsed.Milliseconds(),
|
|
})
|
|
}
|
|
|
|
fmt.Printf("✓ Dolt garbage collection complete\n")
|
|
fmt.Printf(" Time: %v\n", elapsed)
|
|
return nil
|
|
}
|