[agent/claude] Write tests for /pkg/monitor/ to reach 80% coverage. Current... #2

Merged
Virgil merged 1 commit from agent/write-tests-for--pkg-monitor--to-reach-8 into main 2026-03-22 00:46:00 +00:00
Member

Task

Write tests for /pkg/monitor/ to reach 80% coverage. Current coverage is 23.2%. There are already tests in harvest_test.go — don't duplicate those.

Rules:

  • Use Go testing + testify (assert/require)
  • Test naming: _Good (happy path), _Bad (expected errors), _Ugly (panics/edge cases)
  • Focus on: checkCompletions, checkInbox, the monitor loop, Poke, New, Start/Shutdown
  • Mock HTTP calls to the inbox API with httptest.NewServer
  • Use t.TempDir() for workspace scanning
  • Create fake status.json files to test checkCompletions
  • Skip live API tests with t.Skip
  • After writing tests, run: go test ./pkg/monitor/ -cover to verify coverage
  • Commit with message: test(monitor): add unit tests for completions, inbox, lifecycle

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

Agent: claude
Commits: 1
Branch: agent/write-tests-for--pkg-monitor--to-reach-8


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

## Task Write tests for /pkg/monitor/ to reach 80% coverage. Current coverage is 23.2%. There are already tests in harvest_test.go — don't duplicate those. Rules: - Use Go testing + testify (assert/require) - Test naming: _Good (happy path), _Bad (expected errors), _Ugly (panics/edge cases) - Focus on: checkCompletions, checkInbox, the monitor loop, Poke, New, Start/Shutdown - Mock HTTP calls to the inbox API with httptest.NewServer - Use t.TempDir() for workspace scanning - Create fake status.json files to test checkCompletions - Skip live API tests with t.Skip - After writing tests, run: go test ./pkg/monitor/ -cover to verify coverage - Commit with message: test(monitor): add unit tests for completions, inbox, lifecycle Co-Authored-By: Virgil <virgil@lethean.io> **Agent:** claude **Commits:** 1 **Branch:** `agent/write-tests-for--pkg-monitor--to-reach-8` --- Auto-created by core-agent dispatch system. Co-Authored-By: Virgil <virgil@lethean.io>
Virgil added 5 commits 2026-03-21 13:39:46 +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>
Cover checkCompletions, checkInbox, syncRepos, loop, Poke,
Start/Shutdown, New, initSyncTimestamp, and agentStatusResource.
Mock HTTP endpoints with httptest, use t.TempDir for workspace
scanning, and create fake status.json files for completions.

Also fix dispatch.go build error (removed unsupported RunOptions
fields: KillGroup, Timeout, GracePeriod).

Coverage: 23.2% → 86.5%

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.343s
ok  	dappco.re/go/agent/pkg/brain	0.578s
?   	dappco.re/go/agent/pkg/lib	[no test files]
ok  	dappco.re/go/agent/pkg/monitor	11.638s
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.343s ok dappco.re/go/agent/pkg/brain 0.578s ? dappco.re/go/agent/pkg/lib [no test files] ok dappco.re/go/agent/pkg/monitor 11.638s FAIL dappco.re/go/agent/pkg/setup [build failed] FAIL ``` **Exit code:** 1
Virgil added the
needs-review
label 2026-03-21 13:40:00 +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 force-pushed agent/write-tests-for--pkg-monitor--to-reach-8 from 456430e85b to 2d58145e65 2026-03-22 00:45:50 +00:00 Compare
Virgil merged commit 94af637411 into main 2026-03-22 00:46:00 +00:00
Sign in to join this conversation.
No description provided.