test(ax): add workspace command example coverage

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-03-30 18:09:32 +00:00
parent d737e2c29e
commit 553d149d47
3 changed files with 37 additions and 0 deletions

View file

@ -423,6 +423,7 @@ Every exported function MUST have a usage-example comment:
## Changelog
- 2026-03-30: `pkg/agentic/commands_workspace.go` now has a matching example companion, closing the last agentic source file without example coverage.
- 2026-03-30: plan files and review queue rate-limit state now use `WriteAtomic`, keeping JSON state writes aligned with the AX safe-write convention.
- 2026-03-30: transport helpers preserve request and read causes, brain direct API calls surface upstream bodies, and review queue retry parsing no longer uses `MustCompile`.
- 2026-03-30: direct Core process calls replaced the `proc.go` wrapper layer; PID helpers now live in `pid.go` and the workspace template documents `c.Process()` directly.

View file

@ -423,6 +423,7 @@ Every exported function MUST have a usage-example comment:
## Changelog
- 2026-03-30: `pkg/agentic/commands_workspace.go` now has a matching example companion, closing the last agentic source file without example coverage.
- 2026-03-30: plan files and review queue rate-limit state now use `WriteAtomic`, keeping JSON state writes aligned with the AX safe-write convention.
- 2026-03-30: plan create tests now assert the documented `core.ID()` shape and repeated plan creation produces unique IDs, keeping the plan contract aligned with the simplified generator.
- 2026-03-30: dispatch completion monitoring now uses a named helper instead of an inline Action closure, keeping the spawned-process finaliser AX-native.

View file

@ -0,0 +1,35 @@
// SPDX-License-Identifier: EUPL-1.2
package agentic
import (
"os"
core "dappco.re/go/core"
)
func ExamplePrepSubsystem_cmdWorkspaceClean() {
fsys := (&core.Fs{}).NewUnrestricted()
root := fsys.TempDir("agentic-workspace-clean-example")
defer fsys.DeleteAll(root)
previous, hadPrevious := os.LookupEnv("CORE_WORKSPACE")
_ = os.Setenv("CORE_WORKSPACE", root)
defer func() {
if hadPrevious {
_ = os.Setenv("CORE_WORKSPACE", previous)
return
}
_ = os.Unsetenv("CORE_WORKSPACE")
}()
s := &PrepSubsystem{
ServiceRuntime: core.NewServiceRuntime(core.New(), AgentOptions{}),
}
result := s.cmdWorkspaceClean(core.NewOptions())
core.Println(result.OK)
// Output:
// nothing to clean
// true
}