go-agentic/FINDINGS.md

59 lines
2.4 KiB
Markdown
Raw Normal View History

# FINDINGS.md — go-agentic Research & Discovery
## 2026-02-19: Split from go-ai (Virgil)
### Origin
Extracted from `forge.lthn.ai/core/go-ai/agentic/`. Zero internal go-ai dependencies — cleanest split candidate.
### What Was Extracted
- 14 Go files (~1,968 LOC excluding tests)
- 5 test files (allowance, client, completion, config, context)
- 1 embedded prompt template (commit.md)
### Key Finding: Completely Independent
agentic/ imports only:
- `forge.lthn.ai/core/go` (framework, io, log)
- `gopkg.in/yaml.v3`
- Standard library
No coupling to ml/, rag/, mcp/, or any other go-ai package. This is a pure CLI service that spawns claude subprocess and manages task/allowance state.
## 2026-02-20: Phase 1 Test Coverage (Charon)
### Coverage: 70.1% -> 85.6%
Added 7 new test files (130+ tests total, all passing):
| File | Purpose |
|------|---------|
| `lifecycle_test.go` | Full claim -> process -> complete integration; fail/cancel flows; concurrent agents |
| `allowance_edge_test.go` | Boundary tests: exact limit, one-over, zero allowance, warning threshold table |
| `allowance_error_test.go` | Mock `errorStore` to cover all error paths in RecordUsage/Check/ResetAgent |
| `embed_test.go` | Prompt() hit/miss + trimming |
| `service_test.go` | DefaultServiceOptions, TaskPrompt Set/GetTaskID, TaskCommit fields |
| `completion_git_test.go` | Real git repos: AutoCommit, CreateBranch, CommitAndSync, GetDiff, HasUncommittedChanges |
| `context_git_test.go` | findRelatedCode in git repos: keyword search, 10-file limit, truncation |
### Remaining uncovered (intentionally skipped)
- `service.go` (NewService, OnStartup, handleTask, doCommit, doPrompt) — 0%
These require `framework.Core` DI container and spawn a `claude` subprocess.
Testing would need either a full Core bootstrap or an interface extraction.
Recommended for Phase 4 when CLI integration lands.
- `completion.go` CreatePR — 14.3%
Requires `gh` CLI installed and authenticated. Not suitable for unit tests.
### Key Discovery: MemoryStore Copy Semantics
MemoryStore correctly copies values on Set/Get (defensive copies prevent aliasing).
Tests confirm mutations to the original struct after SetAllowance do not affect stored data.
### Key Discovery: AllowanceService Check Priority
The check order is: model allowlist -> daily tokens -> daily jobs -> concurrent jobs -> global model budget.
When multiple limits are exceeded simultaneously, the first in this order is reported as the reason.