[agent/claude] Write tests for /pkg/brain/ to reach 80% coverage. Current c... #3

Merged
Virgil merged 1 commit from agent/write-tests-for--pkg-brain--to-reach-80 into main 2026-03-22 00:45:08 +00:00
Member

Task

Write tests for /pkg/brain/ to reach 80% coverage. Current coverage is 5.3%.

Rules:

  • Use Go testing + testify (assert/require)
  • Test naming: _Good (happy path), _Bad (expected errors), _Ugly (panics/edge cases)
  • Focus on testable functions — API client construction, request building, response parsing
  • Skip functions that need live API endpoints — mark those with t.Skip("requires live API")
  • Mock HTTP calls with httptest.NewServer where needed
  • Use t.TempDir() for any file operations
  • After writing tests, run: go test ./pkg/brain/ -cover to verify coverage
  • Commit with message: test(brain): add unit tests for recall, remember, messaging

Co-Authored-By: Virgil virgil@lethean.io

Agent: claude
Commits: 1
Branch: agent/write-tests-for--pkg-brain--to-reach-80


Auto-created by core-agent dispatch system.
Co-Authored-By: Virgil virgil@lethean.io

## Task Write tests for /pkg/brain/ to reach 80% coverage. Current coverage is 5.3%. Rules: - Use Go testing + testify (assert/require) - Test naming: _Good (happy path), _Bad (expected errors), _Ugly (panics/edge cases) - Focus on testable functions — API client construction, request building, response parsing - Skip functions that need live API endpoints — mark those with t.Skip("requires live API") - Mock HTTP calls with httptest.NewServer where needed - Use t.TempDir() for any file operations - After writing tests, run: go test ./pkg/brain/ -cover to verify coverage - Commit with message: test(brain): add unit tests for recall, remember, messaging Co-Authored-By: Virgil <virgil@lethean.io> **Agent:** claude **Commits:** 1 **Branch:** `agent/write-tests-for--pkg-brain--to-reach-80` --- Auto-created by core-agent dispatch system. Co-Authored-By: Virgil <virgil@lethean.io>
Virgil added 5 commits 2026-03-21 13:40:35 +00:00
- Module path: dappco.re/go/agent
- Core import: dappco.re/go/core v0.4.7
- Process service re-enabled with new Core API
- Plugin bumped to v0.11.0
- Directory flattened from go/ to root

Co-Authored-By: Virgil <virgil@lethean.io>
- Monitor pushes agent.complete, inbox.message, harvest.complete
  events via ChannelSend instead of temp files
- Remove /tmp/claude-inbox-notify file write (channels replace it)
- Update mcp.New() to use Options{} struct
- Wire mcpSvc as ChannelNotifier after creation

Co-Authored-By: Virgil <virgil@lethean.io>
15 tests covering:
- Branch detection, unpushed commit counting, file counting
- Safety checks: binary rejection, large file rejection
- Workspace harvesting: happy path, skip running, skip main, reject binary
- Channel event emission via mock notifier
- Status file updates

Co-Authored-By: Virgil <virgil@lethean.io>
Coverage: 5.3% → 92.8%. Tests cover DirectSubsystem (apiCall, remember,
recall, forget via httptest), messaging (sendMessage, inbox, conversation,
parseMessages, toInt), BrainProvider (gin handlers, routes, describe,
status), Subsystem bridge-backed handlers, and RegisterTools.

Also fixes build error in dispatch.go (removed KillGroup, Timeout,
GracePeriod fields no longer in process.RunOptions).

Co-Authored-By: Virgil <virgil@lethean.io>
Author
Member

Verification Failed

Command: go test ./...

# dappco.re/go/agent/pkg/setup
pkg/setup/config.go:88:13: undefined: lib.RenderFile
pkg/setup/config.go:131:13: undefined: lib.RenderFile
pkg/setup/setup.go:120:16: undefined: lib.ListDirTemplates
pkg/setup/setup.go:129:13: undefined: lib.ExtractDir
# dappco.re/go/agent/cmd
cmd/main.go:32:34: cannot use c (variable of type *"dappco.re/go/core".Core) as *"forge.lthn.ai/core/go/pkg/core".Core value in argument to procFactory
cmd/main.go:44:30: undefined: mcp.Options
cmd/main.go:52:19: cannot use mcpSvc (variable of type *"forge.lthn.ai/core/mcp/pkg/mcp".Service) as monitor.ChannelNotifier value in argument to mon.SetNotifier: *"forge.lthn.ai/core/mcp/pkg/mcp".Service does not implement monitor.ChannelNotifier (missing method ChannelSend)
FAIL	dappco.re/go/agent/cmd [build failed]
ok  	dappco.re/go/agent/pkg/agentic	0.298s
ok  	dappco.re/go/agent/pkg/brain	0.899s
?   	dappco.re/go/agent/pkg/lib	[no test files]
ok  	dappco.re/go/agent/pkg/monitor	2.354s
FAIL	dappco.re/go/agent/pkg/setup [build failed]
FAIL

Exit code: 1

## Verification Failed **Command:** `go test ./...` ``` # dappco.re/go/agent/pkg/setup pkg/setup/config.go:88:13: undefined: lib.RenderFile pkg/setup/config.go:131:13: undefined: lib.RenderFile pkg/setup/setup.go:120:16: undefined: lib.ListDirTemplates pkg/setup/setup.go:129:13: undefined: lib.ExtractDir # dappco.re/go/agent/cmd cmd/main.go:32:34: cannot use c (variable of type *"dappco.re/go/core".Core) as *"forge.lthn.ai/core/go/pkg/core".Core value in argument to procFactory cmd/main.go:44:30: undefined: mcp.Options cmd/main.go:52:19: cannot use mcpSvc (variable of type *"forge.lthn.ai/core/mcp/pkg/mcp".Service) as monitor.ChannelNotifier value in argument to mon.SetNotifier: *"forge.lthn.ai/core/mcp/pkg/mcp".Service does not implement monitor.ChannelNotifier (missing method ChannelSend) FAIL dappco.re/go/agent/cmd [build failed] ok dappco.re/go/agent/pkg/agentic 0.298s ok dappco.re/go/agent/pkg/brain 0.899s ? dappco.re/go/agent/pkg/lib [no test files] ok dappco.re/go/agent/pkg/monitor 2.354s FAIL dappco.re/go/agent/pkg/setup [build failed] FAIL ``` **Exit code:** 1
Virgil added the
needs-review
label 2026-03-21 13:40:40 +00:00
Author
Member

Needs Review

Tests failed after rebase. Auto-merge gave up after retry.

Labelled needs-review for human attention.

## Needs Review Tests failed after rebase. Auto-merge gave up after retry. Labelled `needs-review` for human attention.
Virgil merged commit e2d26dccc1 into main 2026-03-22 00:45:08 +00:00
Sign in to join this conversation.
No description provided.