AX Quality Gates (RFC-025):
- Eliminate os/exec from all test + production code (12+ files)
- Eliminate encoding/json from all test files (15 files, 66 occurrences)
- Eliminate os from all test files except TestMain (Go runtime contract)
- Eliminate path/filepath, net/url from all files
- String concat: 39 violations replaced with core.Concat()
- Test naming AX-7: 264 test functions renamed across all 6 packages
- Example test 1:1 coverage complete
Core Features Adopted:
- Task Composition: agent.completion pipeline (QA → PR → Verify → Ingest → Poke)
- PerformAsync: completion pipeline runs with WaitGroup + progress tracking
- Config: agents.yaml loaded once, feature flags (auto-qa/pr/merge/ingest)
- Named Locks: c.Lock("drain") for queue serialisation
- Registry: workspace state with cross-package QUERY access
- QUERY: c.QUERY(WorkspaceQuery{Status: "running"}) for cross-service queries
- Action descriptions: 25+ Actions self-documenting
- Data mounts: prompts/tasks/flows/personas/workspaces via c.Data()
- Content Actions: agentic.prompt/task/flow/persona callable via IPC
- Drive endpoints: forge + brain registered with tokens
- Drive REST helpers: DriveGet/DrivePost/DriveDo for Drive-aware HTTP
- HandleIPCEvents: auto-discovered by WithService (no manual wiring)
- Entitlement: frozen-queue gate on write Actions
- CLI dispatch: workspace dispatch wired to real dispatch method
- CLI: --quiet/-q and --debug/-d global flags
- CLI: banner, version, check (with service/action/command counts), env
- main.go: minimal — 5 services + c.Run(), no os import
- cmd tests: 84.2% coverage (was 0%)
Co-Authored-By: Virgil <virgil@lethean.io>
52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
package agentic
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// --- countFindings (extended beyond paths_test.go) ---
|
|
|
|
func TestReviewqueue_CountFindings_Good_BulletFindings(t *testing.T) {
|
|
output := `Review:
|
|
- Missing error check in handler.go:42
|
|
- Unused import in config.go
|
|
* Race condition in worker pool`
|
|
assert.Equal(t, 3, countFindings(output))
|
|
}
|
|
|
|
func TestReviewqueue_CountFindings_Good_IssueKeyword(t *testing.T) {
|
|
output := `Line 10: Issue: variable shadowing
|
|
Line 25: Finding: unchecked return value`
|
|
assert.Equal(t, 2, countFindings(output))
|
|
}
|
|
|
|
func TestReviewqueue_CountFindings_Good_DefaultOneIfNotClean(t *testing.T) {
|
|
output := "Some output without markers but also not explicitly clean"
|
|
assert.Equal(t, 1, countFindings(output))
|
|
}
|
|
|
|
func TestReviewqueue_CountFindings_Good_MixedContent(t *testing.T) {
|
|
output := `Summary of review:
|
|
The code is generally well structured.
|
|
- Missing nil check
|
|
Some commentary here
|
|
* Redundant allocation`
|
|
assert.Equal(t, 2, countFindings(output))
|
|
}
|
|
|
|
// --- parseRetryAfter (extended) ---
|
|
|
|
func TestReviewqueue_ParseRetryAfter_Good_SingleMinuteAndSeconds(t *testing.T) {
|
|
d := parseRetryAfter("try after 1 minute and 30 seconds")
|
|
assert.Equal(t, 1*time.Minute+30*time.Second, d)
|
|
}
|
|
|
|
func TestReviewqueue_ParseRetryAfter_Bad_EmptyMessage(t *testing.T) {
|
|
d := parseRetryAfter("")
|
|
assert.Equal(t, 5*time.Minute, d)
|
|
}
|