go/docs/RFC.plan.2.md
Snider 2dff772a40 feat: implement RFC plans 1-5 — Registry[T], Action/Task, Process, primitives
Plans 1-5 complete for core/go scope. 456 tests, 84.4% coverage, 100% AX-7 naming.

Critical bugs (Plan 1):
- P4-3+P7-3: ACTION broadcast calls all handlers with panic recovery
- P7-2+P7-4: RunE() with defer ServiceShutdown, Run() delegates
- P3-1: Startable/Stoppable return Result (breaking, clean)
- P9-1: Zero os/exec — App.Find() rewritten with os.Stat+PATH
- I3: Embed() removed, I15: New() comment fixed
- I9: CommandLifecycle removed → Command.Managed field

Registry[T] (Plan 2):
- Universal thread-safe named collection with 3 lock modes
- All 5 registries migrated: services, commands, drive, data, lock
- Insertion order preserved (fixes P4-1)
- c.RegistryOf("name") cross-cutting accessor

Action/Task system (Plan 3):
- Action type with Run()/Exists(), ActionHandler signature
- c.Action("name") dual-purpose accessor (register/invoke)
- TaskDef with Steps — sequential chain, async dispatch, previous-input piping
- Panic recovery on all Action execution
- broadcast() internal, ACTION() sugar

Process primitive (Plan 4):
- c.Process() returns Action sugar — Run/RunIn/RunWithEnv/Start/Kill/Exists
- No deps added — delegates to c.Action("process.*")
- Permission-by-registration: no handler = no capability

Missing primitives (Plan 5):
- core.ID() — atomic counter + crypto/rand suffix
- ValidateName() / SanitisePath() — reusable validation
- Fs.WriteAtomic() — write-to-temp-then-rename
- Fs.NewUnrestricted() / Fs.Root() — legitimate sandbox bypass
- AX-7: 456/456 tests renamed to TestFile_Function_{Good,Bad,Ugly}

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-25 15:18:25 +00:00

43 lines
1.5 KiB
Markdown

# RFC Plan 2 — Registry + Actions Sessions (COMPLETED 2026-03-25)
> All core/go items shipped. core/agent migration and go-process v0.7.0 are separate repo scope.
## Session Goal: Registry[T] + First Migration
1. Build `registry.go` with full AX-7 tests
2. Migrate `serviceRegistry``ServiceRegistry` embedding `Registry[*Service]`
3. Verify all existing tests still pass
4. Commit + push
## Session Goal: Action System
1. Rename `task.go``action.go`
2. Move `RegisterAction`/`RegisterActions`/`RegisterTask` to `ipc.go`
3. Build `ActionDef` type with `Run()`, `Exists()`, `Def()`
4. Wire `c.Action("name")` dual-purpose accessor
5. Full AX-7 tests
6. Commit + push
## Session Goal: Migrate core/agent Handlers
1. Register named Actions in `agentic.Register()`
2. Replace nested `c.ACTION()` cascade with Task pipeline
3. Test that queue drains properly after agent completion
4. This is the P6-1 fix — the queue starvation bug
## Session Goal: c.Process() + go-process v0.7.0
1. Update go-process factory to return `core.Result`
2. Add `process.Register` direct factory
3. Remove `agentic.ProcessRegister` bridge
4. Add `Process` primitive to core/go (sugar over Actions)
5. Migrate core/agent `proc.go``s.core.Process()` calls
6. Delete `proc.go` and `ensureProcess()`
## Between Sessions
Each session should produce:
- Working code (all tests pass)
- A commit with conventional message
- Updated coverage numbers
- Any new findings added to RFC.md passes