Root cause: renderInfo called CheckGitHooks()/FormatHookWarnings() unconditionally, so setting doctor.suppress.git-hooks=true silenced the check in bd doctor but bd info kept printing "Git hooks not installed". Fix: split the config-map half of the doctor suppress reader out as doctor.SuppressedChecksFromConfig (the store-backed helper now delegates to it, same semantics), and have both bd info paths (direct and proxied-server) feed it the config map they already load. renderInfo skips the hook warning when the git-hooks slug is suppressed. bd info --json never carried the warning and is unchanged. Agent-Signature: claude-code-opus-5-5-unknown-reasoning on behalf of Harry Miller Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6c5f1b2954
commit
39b9ee1d81
5 changed files with 65 additions and 9 deletions
|
|
@ -133,6 +133,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
its backend's lifecycle — it starts on demand and `bd dolt stop` shuts it
|
||||
down. Direct-server and embedded workspaces are unaffected.
|
||||
|
||||
- **`bd info` honors `doctor.suppress.git-hooks`**
|
||||
([#6027](https://github.com/gastownhall/beads/issues/6027)). `bd info`
|
||||
printed the "Git hooks not installed" / "outdated" warning unconditionally,
|
||||
so suppressing the check for `bd doctor` left it nagging on every `bd info`.
|
||||
It now reads the same `doctor.suppress.*` config through the doctor helper
|
||||
and skips the warning when `git-hooks` is suppressed. `bd info --json` never
|
||||
carried the warning and is unchanged.
|
||||
|
||||
- **`bd dolt status` tells the truth on a proxied workspace.** It read the
|
||||
classic PID file, which proxied mode never writes, and so reported `Dolt
|
||||
server: not running` while the proxy was serving CRUD — the wrong answer
|
||||
|
|
|
|||
|
|
@ -45,14 +45,21 @@ func GetSuppressedChecksWithStore(ss *SharedStore) map[string]bool {
|
|||
}
|
||||
|
||||
func getSuppressedChecksFromStore(store *dolt.DoltStore) map[string]bool {
|
||||
suppressed := make(map[string]bool)
|
||||
|
||||
ctx := context.Background()
|
||||
allConfig, err := store.GetAllConfig(ctx)
|
||||
if err != nil {
|
||||
return suppressed
|
||||
return make(map[string]bool)
|
||||
}
|
||||
|
||||
return SuppressedChecksFromConfig(allConfig)
|
||||
}
|
||||
|
||||
// SuppressedChecksFromConfig extracts the suppressed check slugs from an
|
||||
// already-loaded config map, for callers outside bd doctor that hold their
|
||||
// own store (e.g. bd info, GH#6027).
|
||||
func SuppressedChecksFromConfig(allConfig map[string]string) map[string]bool {
|
||||
suppressed := make(map[string]bool)
|
||||
|
||||
for key, value := range allConfig {
|
||||
if strings.HasPrefix(key, SuppressConfigPrefix) && strings.ToLower(value) == "true" {
|
||||
slug := key[len(SuppressConfigPrefix):]
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/steveyegge/beads/cmd/bd/doctor"
|
||||
"github.com/steveyegge/beads/internal/metrics"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
"github.com/steveyegge/beads/internal/workapi"
|
||||
|
|
@ -64,6 +65,8 @@ Examples:
|
|||
"mode": "direct",
|
||||
}
|
||||
|
||||
suppressHookWarning := false
|
||||
|
||||
if store != nil {
|
||||
ctx := rootCtx
|
||||
|
||||
|
|
@ -86,6 +89,8 @@ Examples:
|
|||
if filtered := workapi.FilterSettingsEnumeration(configMap); len(filtered) > 0 {
|
||||
info["config"] = filtered
|
||||
}
|
||||
// GH#6027: honor the same doctor.suppress.git-hooks bd doctor does.
|
||||
suppressHookWarning = doctor.SuppressedChecksFromConfig(configMap)[doctor.CheckNameToSlug("Git Hooks")]
|
||||
}
|
||||
|
||||
if schemaFlag {
|
||||
|
|
@ -98,7 +103,7 @@ Examples:
|
|||
}
|
||||
}
|
||||
|
||||
return renderInfo(info, schemaFlag, absDBPath)
|
||||
return renderInfo(info, schemaFlag, absDBPath, suppressHookWarning)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +145,7 @@ func buildInfoSchema(schemaVersion, prefix string, issues []*types.Issue) map[st
|
|||
}
|
||||
}
|
||||
|
||||
func renderInfo(info map[string]interface{}, schemaFlag bool, absDBPath string) error {
|
||||
func renderInfo(info map[string]interface{}, schemaFlag bool, absDBPath string, suppressHookWarning bool) error {
|
||||
if jsonOutput {
|
||||
return outputJSON(info)
|
||||
}
|
||||
|
|
@ -172,9 +177,11 @@ func renderInfo(info map[string]interface{}, schemaFlag bool, absDBPath string)
|
|||
}
|
||||
}
|
||||
|
||||
hookStatuses := CheckGitHooks()
|
||||
if warning := FormatHookWarnings(hookStatuses); warning != "" {
|
||||
fmt.Printf("\n%s\n", warning)
|
||||
if !suppressHookWarning {
|
||||
hookStatuses := CheckGitHooks()
|
||||
if warning := FormatHookWarnings(hookStatuses); warning != "" {
|
||||
fmt.Printf("\n%s\n", warning)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
|
|
|
|||
|
|
@ -141,6 +141,35 @@ func TestEmbeddedInfo(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
// TestEmbeddedInfoSuppressGitHooks pins GH#6027: bd info must honor
|
||||
// doctor.suppress.git-hooks the same way bd doctor does, instead of printing
|
||||
// the missing-hooks warning unconditionally.
|
||||
func TestEmbeddedInfoSuppressGitHooks(t *testing.T) {
|
||||
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
|
||||
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
|
||||
}
|
||||
t.Parallel()
|
||||
|
||||
bd := buildEmbeddedBD(t)
|
||||
dir, _, _ := bdInit(t, bd, "--prefix", "ih")
|
||||
bdRunOK(t, bd, dir, "hooks", "uninstall")
|
||||
|
||||
const hookWarning = "Git hooks not installed"
|
||||
if out := bdInfo(t, bd, dir); !strings.Contains(out, hookWarning) {
|
||||
t.Fatalf("precondition: expected %q with hooks uninstalled:\n%s", hookWarning, out)
|
||||
}
|
||||
|
||||
bdConfig(t, bd, dir, "set", "doctor.suppress.git-hooks", "true")
|
||||
if out := bdInfo(t, bd, dir); strings.Contains(out, hookWarning) {
|
||||
t.Errorf("doctor.suppress.git-hooks=true should hide %q:\n%s", hookWarning, out)
|
||||
}
|
||||
|
||||
bdConfig(t, bd, dir, "set", "doctor.suppress.git-hooks", "false")
|
||||
if out := bdInfo(t, bd, dir); !strings.Contains(out, hookWarning) {
|
||||
t.Errorf("doctor.suppress.git-hooks=false should keep %q:\n%s", hookWarning, out)
|
||||
}
|
||||
}
|
||||
|
||||
// TestEmbeddedInfoConcurrent exercises info operations concurrently.
|
||||
func TestEmbeddedInfoConcurrent(t *testing.T) {
|
||||
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/steveyegge/beads/cmd/bd/doctor"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
"github.com/steveyegge/beads/internal/workapi"
|
||||
)
|
||||
|
|
@ -21,6 +22,8 @@ func runInfoProxiedServer(ctx context.Context, schemaFlag bool) error {
|
|||
"mode": "proxied-server",
|
||||
}
|
||||
|
||||
suppressHookWarning := false
|
||||
|
||||
page, err := uw.IssueUseCase().SearchIssues(ctx, "", types.IssueFilter{})
|
||||
var issues []*types.Issue
|
||||
if err == nil {
|
||||
|
|
@ -42,6 +45,8 @@ func runInfoProxiedServer(ctx context.Context, schemaFlag bool) error {
|
|||
if filtered := workapi.FilterSettingsEnumeration(configMap); len(filtered) > 0 {
|
||||
info["config"] = filtered
|
||||
}
|
||||
// GH#6027: honor the same doctor.suppress.git-hooks bd doctor does.
|
||||
suppressHookWarning = doctor.SuppressedChecksFromConfig(configMap)[doctor.CheckNameToSlug("Git Hooks")]
|
||||
}
|
||||
|
||||
if schemaFlag {
|
||||
|
|
@ -53,5 +58,5 @@ func runInfoProxiedServer(ctx context.Context, schemaFlag bool) error {
|
|||
info["schema"] = buildInfoSchema(schemaVersion, prefix, issues)
|
||||
}
|
||||
|
||||
return renderInfo(info, schemaFlag, absDBPath)
|
||||
return renderInfo(info, schemaFlag, absDBPath, suppressHookWarning)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue