From f7442c3aea1a21b959602008f4cce806683d9078 Mon Sep 17 00:00:00 2001 From: kami Date: Fri, 31 Jul 2026 10:09:32 +0400 Subject: [PATCH 1/2] Run gofmt over the seven files that had drifted Formatting only: import order, and statements that were packed onto one line split out. `git diff -w` shows nothing but that. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01CGeSZxh1DCtRxmFVSYVGvJ --- cmd/mavend/main.go | 22 ++++++------ cmd/mavend/replier_llm_test.go | 5 ++- cmd/mavweb/ecosystem.go | 5 ++- internal/ipc/wire.go | 54 +++++++++++++++--------------- internal/llm/client_test.go | 2 +- internal/router/dateparser_test.go | 8 ++--- internal/ttsnorm/ttsnorm.go | 7 +++- 7 files changed, 57 insertions(+), 46 deletions(-) diff --git a/cmd/mavend/main.go b/cmd/mavend/main.go index 306691a..94bb51c 100644 --- a/cmd/mavend/main.go +++ b/cmd/mavend/main.go @@ -57,10 +57,10 @@ import ( "github.com/kami/maven/internal/delivery/ntfysink" "github.com/kami/maven/internal/delivery/telegramsink" "github.com/kami/maven/internal/ipc" + "github.com/kami/maven/internal/loop" "github.com/kami/maven/internal/phraser" "github.com/kami/maven/internal/store" "github.com/kami/maven/internal/webauthn" - "github.com/kami/maven/internal/loop" ) var errLocked = errors.New("mavend: daemon locked — complete passkey assertion first") @@ -161,7 +161,7 @@ func (l *lockedAPI) EnableTool(ctx context.Context, name string, cmd []string, d return errLocked } func (l *lockedAPI) DisableTool(ctx context.Context, name string) error { return errLocked } -func (l *lockedAPI) DeleteTool(ctx context.Context, name string) error { return errLocked } +func (l *lockedAPI) DeleteTool(ctx context.Context, name string) error { return errLocked } func (l *lockedAPI) ListProposedRoutines(ctx context.Context) ([]ipc.ProposedRoutine, error) { return nil, errLocked } @@ -247,15 +247,15 @@ func run(args []string) error { // ----- daemon components (only wired when unlocked) ----- // Pre-declare so the unlock path can wire them later. var ( - gatherer *loop.Gatherer - rules []loop.Rule - phr phraser.Phraser - voiceW *voiceWiring - dispatcher *delivery.Dispatcher - tl *tickLoop - coreAPI ipc.CoreAPI - eco *ecosystemWiring - factWorker *factEnrichmentWorker + gatherer *loop.Gatherer + rules []loop.Rule + phr phraser.Phraser + voiceW *voiceWiring + dispatcher *delivery.Dispatcher + tl *tickLoop + coreAPI ipc.CoreAPI + eco *ecosystemWiring + factWorker *factEnrichmentWorker ) if !locked { diff --git a/cmd/mavend/replier_llm_test.go b/cmd/mavend/replier_llm_test.go index b16dd0e..b2d132d 100644 --- a/cmd/mavend/replier_llm_test.go +++ b/cmd/mavend/replier_llm_test.go @@ -9,7 +9,10 @@ import ( "github.com/kami/maven/internal/voice" ) -type mockCompleter struct{ out string; err error } +type mockCompleter struct { + out string + err error +} func (m mockCompleter) Complete(_ context.Context, _ llm.Req) (string, error) { return m.out, m.err } diff --git a/cmd/mavweb/ecosystem.go b/cmd/mavweb/ecosystem.go index b5b5208..7198853 100644 --- a/cmd/mavweb/ecosystem.go +++ b/cmd/mavweb/ecosystem.go @@ -91,7 +91,10 @@ func handleEcosystem(w http.ResponseWriter, r *http.Request, urls ecoURLs) { var d ecoData var wg sync.WaitGroup wg.Add(3) - go func() { defer wg.Done(); d.Nexus.Err = getEco(ctx, urls.nexus, "/api/v1/entities?limit=50", &d.Nexus.Rows) }() + go func() { + defer wg.Done() + d.Nexus.Err = getEco(ctx, urls.nexus, "/api/v1/entities?limit=50", &d.Nexus.Rows) + }() go func() { defer wg.Done() d.Praxis.Err = getEco(ctx, urls.praxis, "/api/v1/items?limit=50", &d.Praxis.Rows) diff --git a/internal/ipc/wire.go b/internal/ipc/wire.go index a30e304..c67cec1 100644 --- a/internal/ipc/wire.go +++ b/internal/ipc/wire.go @@ -13,39 +13,39 @@ import ( type Method string const ( - MethodWriteFact Method = "write_fact" - MethodLatestFact Method = "latest_fact" - MethodLatestFactBySource Method = "latest_fact_by_source" - MethodSince Method = "since" - MethodPresence Method = "presence" - MethodCreateReminder Method = "create_reminder" - MethodMarkReminder Method = "mark_reminder" - MethodListReminders Method = "list_reminders" - MethodRecordNudge Method = "record_nudge" - MethodResolveNudge Method = "resolve_nudge" - MethodRecentOutcomes Method = "recent_outcomes" - MethodRecentFacts Method = "recent_facts" - MethodCalendarEvents Method = "calendar_events" - MethodRecentNudges Method = "recent_nudges" - MethodWriteNote Method = "write_note" - MethodQueryNotes Method = "query_notes" - MethodRecentNotes Method = "recent_notes" - MethodProposeTool Method = "propose_tool" - MethodEnableTool Method = "enable_tool" - MethodDisableTool Method = "disable_tool" - MethodAssertStepUp Method = "assert_stepup" - MethodStoreEncryptionKey Method = "store_encryption_key" - MethodUnlock Method = "unlock" - MethodLookupTool Method = "lookup_tool" + MethodWriteFact Method = "write_fact" + MethodLatestFact Method = "latest_fact" + MethodLatestFactBySource Method = "latest_fact_by_source" + MethodSince Method = "since" + MethodPresence Method = "presence" + MethodCreateReminder Method = "create_reminder" + MethodMarkReminder Method = "mark_reminder" + MethodListReminders Method = "list_reminders" + MethodRecordNudge Method = "record_nudge" + MethodResolveNudge Method = "resolve_nudge" + MethodRecentOutcomes Method = "recent_outcomes" + MethodRecentFacts Method = "recent_facts" + MethodCalendarEvents Method = "calendar_events" + MethodRecentNudges Method = "recent_nudges" + MethodWriteNote Method = "write_note" + MethodQueryNotes Method = "query_notes" + MethodRecentNotes Method = "recent_notes" + MethodProposeTool Method = "propose_tool" + MethodEnableTool Method = "enable_tool" + MethodDisableTool Method = "disable_tool" + MethodAssertStepUp Method = "assert_stepup" + MethodStoreEncryptionKey Method = "store_encryption_key" + MethodUnlock Method = "unlock" + MethodLookupTool Method = "lookup_tool" MethodListTools Method = "list_tools" MethodDeleteTool Method = "delete_tool" MethodListProposedRoutines Method = "list_proposed_routines" MethodDismissProposedRoutine Method = "dismiss_proposed_routine" MethodAcceptProposedRoutine Method = "accept_proposed_routine" MethodRevertFact Method = "revert_fact" - MethodTickTrace Method = "tick_trace" - MethodMorningStatus Method = "morning_status" - MethodChat Method = "chat" + MethodTickTrace Method = "tick_trace" + MethodMorningStatus Method = "morning_status" + MethodChat Method = "chat" ) // Request — one frame from module to core. Params is the JSON-encoded argument diff --git a/internal/llm/client_test.go b/internal/llm/client_test.go index 9353442..68f174d 100644 --- a/internal/llm/client_test.go +++ b/internal/llm/client_test.go @@ -19,7 +19,7 @@ func TestComplete(t *testing.T) { t.Errorf("path = %q, want /v1/chat/completions", r.URL.Path) } var reqBody struct { - Messages []struct { + Messages []struct { Role string `json:"role"` Content string `json:"content"` } `json:"messages"` diff --git a/internal/router/dateparser_test.go b/internal/router/dateparser_test.go index cb98073..b5f8141 100644 --- a/internal/router/dateparser_test.go +++ b/internal/router/dateparser_test.go @@ -26,10 +26,10 @@ func TestPythonDateParser(t *testing.T) { ctx := context.Background() tests := []struct { - name string - text string - wantOK bool - checkT func(t *testing.T, got, now time.Time) + name string + text string + wantOK bool + checkT func(t *testing.T, got, now time.Time) }{ { name: "ru relative — через час", diff --git a/internal/ttsnorm/ttsnorm.go b/internal/ttsnorm/ttsnorm.go index f88d2c5..99e83e9 100644 --- a/internal/ttsnorm/ttsnorm.go +++ b/internal/ttsnorm/ttsnorm.go @@ -55,4 +55,9 @@ func spokenDate(dd, mm, yyyy string) string { } func mustInt(s string) int { n, _ := strconv.Atoi(s); return n } -func gap(y string) string { if y == "" { return "" }; return " " + y } +func gap(y string) string { + if y == "" { + return "" + } + return " " + y +} -- 2.52.0 From c860808528e45751f059a4b1122a4fbeea99849b Mon Sep 17 00:00:00 2001 From: kami Date: Fri, 31 Jul 2026 10:10:27 +0400 Subject: [PATCH 2/2] Make make test actually gate on gofmt and vet DESIGN.md has always said `make test` is "gofmt + vet + -race, no exceptions". It only ever ran the tests, which is how nine files drifted out of format without anyone noticing. `test` now depends on `fmt-check` and `vet`. Checked that fmt-check does fail when a file is unformatted, so the gate is real and not decorative. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01CGeSZxh1DCtRxmFVSYVGvJ --- Makefile | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6c4f8e6..c4d2395 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ PIPER_BIN := $(shell pwd)/deps/piper/piper PIPER_MODEL := $(shell pwd)/models/tts/ru_RU-irina-medium.onnx PIPER_ESPEAK := $(shell pwd)/deps/piper/espeak-ng-data -.PHONY: all build build-stt build-tts build-daemon build-client build-waked build-web build-poll build-caldav clean test run-stt run-tts run-web download-embedder deps-go eval-router eval-recall +.PHONY: all build build-stt build-tts build-daemon build-client build-waked build-web build-poll build-caldav clean test fmt-check vet run-stt run-tts run-web download-embedder deps-go eval-router eval-recall all: build @@ -69,7 +69,20 @@ deps-go: done $(GO) version -test: +# fmt-check fails if any file needs gofmt. DESIGN.md has always said `make +# test` gates on gofmt and vet; it did not, so nine files quietly drifted. +# Run `gofmt -w` on whatever this prints. +fmt-check: + @bad=$$(gofmt -l internal cmd); \ + if [ -n "$$bad" ]; then \ + echo "these files need gofmt:"; echo "$$bad"; exit 1; \ + fi + +vet: + CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" LD_LIBRARY_PATH="$(shell pwd)/deps/lib" \ + $(GO) vet ./internal/... ./cmd/... + +test: fmt-check vet CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" LD_LIBRARY_PATH="$(shell pwd)/deps/lib" \ $(GO) test -race -coverprofile=coverage.out ./internal/... ./cmd/... -- 2.52.0