test: 282 new tests — agentic 44.1%, monitor 84.2% #18

Merged
Virgil merged 12 commits from feat/core-di-migration into dev 2026-03-25 00:00:02 +00:00

12 commits

Author SHA1 Message Date
Snider
4359b3d8d4 test(agentic): add status_extra_test.go — status, shutdown, brain, and lifecycle tests
Tests status tool (empty/mixed/deep/corrupt workspaces), shutdown tools
(start/graceful/now with queued cleanup), brainRecall (success/empty/error),
prepWorkspace validation, listPRs, Poke, OnShutdown, drainQueue.
23 tests pushing coverage from 39.4% to 44.1%.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 23:31:28 +00:00
Snider
27032d980f test(agentic): add pr_test.go — PR creation and listing tests
Tests forgeCreatePR, createPR (validation, dry-run, custom title),
listPRs validation, commentOnIssue via mock Forge API.
9 tests covering the PR creation pipeline.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 23:31:21 +00:00
Snider
64f3f3b060 test(agentic): add dispatch_test.go — dispatch validation, runQA, workspace tests
Tests dispatch input validation, DryRun flow with real git clone,
runQA with valid/broken Go projects, workspaceDir path resolution,
buildPRBody formatting, and canDispatchAgent concurrency checks.
17 tests covering the dispatch pipeline without Docker.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 23:31:14 +00:00
Snider
507bf55eb5 test(agentic): add scan_test.go — Forge issue scanning with mock API
Tests scan tool with mockScanServer (org repos, issue listing, dedup),
listRepoIssues (assignee extraction, URL rewriting, error handling).
11 tests covering filtering, limits, labels, and deduplication.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 23:31:07 +00:00
Snider
0008e269e4 test(agentic): add ingest_test.go — findings ingestion and issue creation tests
Tests ingestFindings pipeline (completed/not-completed/no-log/quota-exhausted),
createIssueViaAPI with mock Brain API, and security-specific countFileRefs cases.
13 tests covering the full ingest flow and edge cases.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 23:30:58 +00:00
Snider
ce682e42fe test(agentic): add verify_test.go — PR merge, labels, and verification tests
Tests forgeMergePR, ensureLabel, getLabelID, runVerification, flagForReview,
autoVerifyAndMerge, fileExists, truncate via mock Forge API.
33 tests covering merge success/conflict/error, label CRUD, and project detection.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 23:30:50 +00:00
Snider
805be3bf32 test(agentic): add epic_test.go — Forge API integration tests with httptest
Tests createIssue, resolveLabelIDs, createLabel, createEpic via mock Forge.
Shared mockForgeServer and newTestSubsystem helpers for reuse.
19 tests covering success, validation, and error paths.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 23:30:44 +00:00
Snider
f2b4eeb0fa test(agentic): add mirror_test.go — git helper integration tests
Tests hasRemote, commitsAhead, filesChanged with real temp git repos.
Tests extractJSONField, DefaultBranch, listLocalRepos, GitHubOrg.
35 tests using _Good/_Bad/_Ugly naming convention.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 23:30:38 +00:00
Snider
bd2eadc271 test(monitor): add logic_test.go — 26 tests for uncovered functions
Covers SetCore, handleAgentStarted, handleAgentCompleted, checkIdleAfterDelay,
countLiveWorkspaces, pidAlive, OnStartup, OnShutdown, and Register using
_Good/_Bad/_Ugly naming convention. Coverage: 76.1% → 84.2%.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 23:12:32 +00:00
Snider
42e558ed38 test(agentic): add queue/status/plan/register test files
Adds four new test files covering previously untested functions:
- queue_logic_test.go: countRunningByModel, drainQueue, Poke, StartRunner, DefaultBranch, LocalFs
- status_logic_test.go: ReadStatus/writeStatus field coverage + WorkspaceStatus JSON round-trip
- plan_logic_test.go: planPath sanitisation + readPlan/writePlan round-trips with phases
- register_test.go: Register (service discovery, core wiring, config loading), OnStartup, OnShutdown

All 56 new tests follow _Good/_Bad/_Ugly convention and pass with go test ./pkg/agentic/...

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 23:07:02 +00:00
Snider
36c29cd0af test: 66 _Good/_Bad/_Ugly tests for agentic pure logic functions
Coverage 9.5% → 14.1%. Tests for: agentCommand, containerCommand,
buildAutoPRBody, emitEvent, countFileRefs, modelVariant, baseAgent,
resolveWorkspace, findWorkspaceByPR, extractPRNumber.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 23:00:25 +00:00
Snider
80b827b7c8 test(agentic): add logic_test.go — 66 tests for 10 pure functions
Covers agentCommand, containerCommand, buildAutoPRBody, emitEvent,
countFileRefs, modelVariant, baseAgent, resolveWorkspace,
findWorkspaceByPR, and extractPRNumber with _Good/_Bad/_Ugly cases.
All 66 pass. Uses t.TempDir() + t.Setenv("CORE_WORKSPACE") for
filesystem-dependent tests.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 22:59:42 +00:00