From a174227a6207e7f339585a05785634f2c5ecb99e Mon Sep 17 00:00:00 2001 From: Snider Date: Thu, 26 Mar 2026 13:21:59 +0000 Subject: [PATCH] feat(flow): add v0.8.0 upgrade flow YAMLs + fix runner queue drain - flow/upgrade/v080-plan.yaml: structured audit for banned imports, tests, comments - flow/upgrade/v080-implement.yaml: step-by-step implementation with per-step commits - fix(runner): update workspace Registry on AgentCompleted so concurrency count drops and queue drains Co-Authored-By: Virgil --- pkg/lib/flow/upgrade/README.md | 33 +++++++++++++ pkg/lib/flow/upgrade/v080-implement.yaml | 54 ++++++++++++++++++++ pkg/lib/flow/upgrade/v080-plan.yaml | 63 ++++++++++++++++++++++++ pkg/runner/runner.go | 7 +++ 4 files changed, 157 insertions(+) create mode 100644 pkg/lib/flow/upgrade/README.md create mode 100644 pkg/lib/flow/upgrade/v080-implement.yaml create mode 100644 pkg/lib/flow/upgrade/v080-plan.yaml diff --git a/pkg/lib/flow/upgrade/README.md b/pkg/lib/flow/upgrade/README.md new file mode 100644 index 0000000..64c5776 --- /dev/null +++ b/pkg/lib/flow/upgrade/README.md @@ -0,0 +1,33 @@ +# v0.8.0 Upgrade Flow + +Two-stage flow for upgrading Go packages to Core v0.8.0 AX compliance. + +## Stage 1: Plan (`v080-plan.yaml`) +Dispatched with: `agentic_dispatch repo=X task="plan" template=upgrade/v080-plan` + +Produces UPGRADE.md with: +- Dependency audit (current version → v0.8.0-alpha.1) +- Banned import findings (file:line → Core replacement) +- Test naming violations (file:line → suggested rename) +- Missing usage-example comments (file:line) + +## Stage 2: Implement (`v080-implement.yaml`) +Dispatched with: `agentic_dispatch repo=X task="implement" template=upgrade/v080-implement` + +Reads UPGRADE.md and implements changes in order: +1. Upgrade deps → verify build +2. Fix production imports → verify build +3. Fix test imports → verify tests +4. Rename tests → verify tests +5. Add comments → verify vet + +Each step commits separately with conventional commit format. + +## Usage +``` +# Plan first +agentic_dispatch repo=go-cache task="Create v0.8.0 upgrade plan" agent=codex branch=dev + +# Then implement +agentic_dispatch repo=go-cache task="Implement v0.8.0 upgrade from UPGRADE.md" agent=codex branch=dev +``` diff --git a/pkg/lib/flow/upgrade/v080-implement.yaml b/pkg/lib/flow/upgrade/v080-implement.yaml new file mode 100644 index 0000000..5d09761 --- /dev/null +++ b/pkg/lib/flow/upgrade/v080-implement.yaml @@ -0,0 +1,54 @@ +name: v0.8.0 Upgrade Implementation +description: Implement the upgrade plan from UPGRADE.md — deps, imports, tests, comments +agent: codex +requires: UPGRADE.md +template: coding + +steps: + - name: upgrade-deps + description: Update go.mod to core v0.8.0-alpha.1 + commands: + - go get dappco.re/go/core@v0.8.0-alpha.1 + - go mod tidy + verify: go build ./... + commit: "deps({{repo}}): upgrade to core v0.8.0-alpha.1" + + - name: fix-imports-prod + description: Replace banned imports in production files per UPGRADE.md section 2 + source: UPGRADE.md + section: "Banned Imports" + scope: "*.go excluding *_test.go" + verify: go build ./... + commit: "fix({{repo}}): replace banned imports with Core primitives" + + - name: fix-imports-test + description: Replace banned imports in test files per UPGRADE.md section 2 + source: UPGRADE.md + section: "Banned Imports" + scope: "*_test.go" + verify: go test ./... -count=1 -timeout 120s + commit: "test({{repo}}): replace banned imports in tests" + + - name: rename-tests + description: Rename tests to TestFile_Function_{Good,Bad,Ugly} per UPGRADE.md section 3 + source: UPGRADE.md + section: "Test Naming" + verify: go test ./... -count=1 -timeout 120s + commit: "test({{repo}}): rename to AX-7 convention" + + - name: add-comments + description: Add usage-example comments to exported functions per UPGRADE.md section 4 + source: UPGRADE.md + section: "Missing Usage Comments" + verify: go vet ./... + commit: "docs({{repo}}): add usage-example comments" + +verify: + - go build ./... + - go vet ./... + - go test ./... -count=1 -timeout 120s + - go test -cover ./... + - go mod tidy + +commit: + co_author: "Virgil " diff --git a/pkg/lib/flow/upgrade/v080-plan.yaml b/pkg/lib/flow/upgrade/v080-plan.yaml new file mode 100644 index 0000000..838f9f3 --- /dev/null +++ b/pkg/lib/flow/upgrade/v080-plan.yaml @@ -0,0 +1,63 @@ +name: v0.8.0 Upgrade Plan +description: Generate UPGRADE.md for a Go package — audit banned imports, test naming, usage comments +agent: codex +template: coding + +steps: + - name: audit-deps + description: Check go.mod for core dependency version + check: "grep dappco.re/go/core go.mod" + + - name: audit-imports + description: Find all banned stdlib imports with file:line + banned: + - import: os + replace: "core.Env() for env vars, core.Fs for file ops" + - import: os/exec + replace: "go-process package" + - import: encoding/json + replace: "core.JSONMarshalString(), core.JSONUnmarshalString()" + - import: fmt + replace: "core.Sprintf(), core.Concat(), core.E() for errors" + - import: errors + replace: "core.E(), core.Is()" + - import: strings + replace: "core.Contains(), core.HasPrefix(), core.Split(), core.Trim(), core.Replace(), core.Lower(), core.SplitN()" + - import: path/filepath + replace: "core.JoinPath(), core.PathBase(), core.PathDir(), core.PathGlob()" + + - name: audit-tests + description: Find tests not matching TestFile_Function_{Good,Bad,Ugly} + pattern: "^func Test[A-Z]" + convention: "TestFilename_FunctionName_{Good,Bad,Ugly}" + categories: + Good: happy path — proves the contract works + Bad: expected errors — proves error handling works + Ugly: edge cases, panics — proves it doesn't blow up + + - name: audit-comments + description: Find exported functions missing usage-example comments + pattern: "^func [A-Z]|^func \\(.*\\) [A-Z]" + required: | + // FunctionName does X. + // + // result := pkg.FunctionName("input") + + - name: write-plan + description: Write UPGRADE.md with all findings + output: UPGRADE.md + sections: + - "1. Dependency Upgrade" + - "2. Banned Imports (file:line → replacement)" + - "3. Test Naming Violations (file:line → suggested rename)" + - "4. Missing Usage Comments (file:line)" + +verify: + - go build ./... + - go vet ./... + - go test ./... -count=1 -timeout 120s + - go mod tidy + +commit: + message: "docs({{repo}}): add v0.8.0 AX upgrade plan" + co_author: "Virgil " diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index 12a2afc..774a76e 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -134,6 +134,13 @@ func (s *Service) HandleIPCEvents(c *core.Core, msg core.Message) core.Result { }) case messages.AgentCompleted: + // Update workspace status in Registry so concurrency count drops + s.workspaces.Each(func(name string, st *WorkspaceStatus) { + if st.Repo == ev.Repo && st.Status == "running" { + st.Status = ev.Status + st.PID = 0 + } + }) c.ACTION(coremcp.ChannelPush{ Channel: "agent.status", Data: map[string]any{