go-agentic/FINDINGS.md
Claude 23aa635c91
test: achieve 85.6% coverage with 7 new test files
Phase 1 complete: coverage from 70.1% to 85.6% (130+ tests, all passing).

New test files:
- lifecycle_test.go: full claim -> process -> complete integration flows
- allowance_edge_test.go: boundary conditions for token/job/concurrent limits
- allowance_error_test.go: mock errorStore covering all RecordUsage error paths
- embed_test.go: Prompt() hit/miss and content trimming
- service_test.go: DefaultServiceOptions, TaskPrompt, TaskCommit type coverage
- completion_git_test.go: real git repos for AutoCommit, CreateBranch, CommitAndSync
- context_git_test.go: findRelatedCode with keyword search, file limits, truncation

Updated config_test.go with YAML fallback, env override, and empty-dir paths.

Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 00:59:58 +00:00

2.4 KiB

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.