* /{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>
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/steveyegge/beads/internal/beads"
|
|
"github.com/steveyegge/beads/internal/metrics"
|
|
"github.com/steveyegge/beads/internal/storage/domain"
|
|
"github.com/steveyegge/beads/internal/storage/uow"
|
|
"github.com/steveyegge/beads/internal/ui"
|
|
)
|
|
|
|
func runPingProxiedServer(ctx context.Context) error {
|
|
evt := metrics.NewCommandEvent("ping")
|
|
defer func() {
|
|
if c := metrics.Global(); c != nil {
|
|
c.CloseEventAndAdd(evt)
|
|
}
|
|
}()
|
|
|
|
start := time.Now()
|
|
|
|
beadsDir := beads.FindBeadsDir()
|
|
if beadsDir == "" {
|
|
return pingFail(start, "no .beads directory found")
|
|
}
|
|
resolveMs := time.Since(start).Milliseconds()
|
|
|
|
if uowProvider == nil {
|
|
return pingFail(start, "proxied-server UOW provider not initialized")
|
|
}
|
|
storeMs := time.Since(start).Milliseconds()
|
|
|
|
_, err := uow.RunTxRead(ctx, uowProvider, func(ctx context.Context, uw uow.UnitOfWork) (*domain.RawSQLResult, error) {
|
|
return uw.RawSQLUseCase().Query(ctx, "SELECT 1")
|
|
})
|
|
if err != nil {
|
|
return pingFail(start, fmt.Sprintf("query failed: %v", err))
|
|
}
|
|
totalMs := time.Since(start).Milliseconds()
|
|
queryMs := totalMs - storeMs
|
|
|
|
if jsonOutput {
|
|
return outputJSON(map[string]interface{}{
|
|
"status": "ok",
|
|
"resolve_ms": resolveMs,
|
|
"store_ms": storeMs - resolveMs,
|
|
"query_ms": queryMs,
|
|
"total_ms": totalMs,
|
|
})
|
|
}
|
|
|
|
fmt.Fprintf(os.Stdout, "%s bd ping: ok (%dms)\n", ui.RenderPass("✓"), totalMs)
|
|
return nil
|
|
}
|