Plan 1: Critical bug fixes (v0.7.1, zero breakage) - ACTION chain, panic recovery, defer shutdown, stale code removal Plan 2: Registry[T] primitive (Section 20) - Foundation brick, migration of 5 internal registries Plan 3: Action/Task system (Section 18) - Named callables, task composition, cascade fix Plan 4: c.Process() primitive (Section 17) - go-process v0.7.0, proc.go migration, atomic writes Plan 5: Missing primitives + AX-7 - core.ID(), ValidateName, WriteAtomic, RunE(), test coverage Plan 6: Ecosystem sweep (Phase 3) - 44 repos in 5 batches, Codex dispatch with RFC as spec Each plan lists: files to change, code examples, what it resolves, dependencies on other plans, and migration strategy. Co-Authored-By: Virgil <virgil@lethean.io>
78 lines
1.8 KiB
Markdown
78 lines
1.8 KiB
Markdown
# Implementation Plan 1 — Critical Bug Fixes (Phase 1)
|
|
|
|
> Ship as v0.7.1. Zero consumer breakage. Fix the 3 critical bugs.
|
|
|
|
## P4-3: ACTION !OK Stops Broadcast Chain
|
|
|
|
**File:** `ipc.go`
|
|
**Change:** ACTION dispatch must call ALL handlers regardless of individual results.
|
|
|
|
```go
|
|
// Current (broken):
|
|
for _, h := range handlers {
|
|
if r := h(c, msg); !r.OK {
|
|
return r // STOPS — remaining handlers never called
|
|
}
|
|
}
|
|
|
|
// Fix:
|
|
for _, h := range handlers {
|
|
h(c, msg) // call all, ignore individual results for broadcast
|
|
}
|
|
```
|
|
|
|
**Test:** `TestIpc_Action_Ugly` — register 3 handlers, second returns !OK, verify third still fires.
|
|
|
|
## P7-2: No Cleanup on Startup Failure
|
|
|
|
**File:** `core.go` — `Run()`
|
|
**Change:** Call ServiceShutdown before exit on startup failure.
|
|
|
|
```go
|
|
// Current:
|
|
if !r.OK { os.Exit(1) }
|
|
|
|
// Fix:
|
|
if !r.OK {
|
|
c.ServiceShutdown(context.Background())
|
|
os.Exit(1)
|
|
}
|
|
```
|
|
|
|
## P7-3: ACTION Handlers No Panic Recovery
|
|
|
|
**File:** `ipc.go`
|
|
**Change:** Wrap each handler in defer/recover.
|
|
|
|
```go
|
|
for _, h := range handlers {
|
|
func() {
|
|
defer func() {
|
|
if r := recover(); r != nil {
|
|
Error("ACTION handler panicked", "panic", r)
|
|
}
|
|
}()
|
|
h(c, msg)
|
|
}()
|
|
}
|
|
```
|
|
|
|
**Test:** `TestIpc_Action_Ugly` — handler that panics, verify other handlers still execute.
|
|
|
|
## P7-4: Run() Needs defer ServiceShutdown
|
|
|
|
**File:** `core.go`
|
|
**Change:** Add defer as first line of Run.
|
|
|
|
```go
|
|
func (c *Core) Run() {
|
|
defer c.ServiceShutdown(context.Background())
|
|
// ... rest unchanged, but remove os.Exit calls
|
|
}
|
|
```
|
|
|
|
## Additional Phase 1 (safe)
|
|
|
|
- **I3:** Remove `Embed()` accessor (0 consumers)
|
|
- **I15:** Fix stale comment on `New()` — update to show `*Core` return
|
|
- **P9-1:** Remove `os/exec` import from `app.go` — move `App.Find()` to go-process
|