feat/go-task-slice-v1 #27
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/go-task-slice-v1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Rewire the Glasspane event-fold tests and the daemon RPC-completion tests onto the shared pack so the expectations live in one canonical place: - glasspane: the fixture_* tests load normalized-events.json and assert every (source type, normalized event, state) step plus the accumulated usage and cumulative consistency, instead of re-deriving them inline; - daemon: rpc_dispatched_task_{completes,fails} replay task-records.json — queued -> claimed -> started -> done|failed, the {agent_id}:{rpc_id} correlation, usage-delta billing, and a normalized terminal-record projection. Volatile ids/timestamps are asserted for presence and consistency, never by value. The provider/model route now comes from the fixture's agent block through a CLI-route AgentSpawnConfig. No production behavior change; the fixtures drive both suites. colibri-glasspane: 57 passed, 0 failed. colibri-daemon (rpc_dispatched): 2 passed, 0 failed. clippy -p colibri-glasspane -p colibri-daemon --all-targets: clean.Add the root Go module (code.clawdie.si/clawdie/colibri) and the minimal task/ledger/zot-RPC slice that replays the shared contract fixtures. This is the smallest Go replacement slice, not a daemon takeover: no cmd/, no socket, no scheduler, no provider credentials, temporary databases only. - internal/zotrpc: zot NDJSON normalization (zot_event_type/apply_pi_event parity, sticky error), per-turn usage accumulation, and cumulative recording without double-counting. - internal/ledger: task lifecycle over modernc.org/sqlite (pure Go, no CGO) with the same schema columns, guarded atomic claim, and set_task_cost semantics as crates/colibri-ledger. - internal/task: the RPC-completion correlation ({agent_id}:{rpc_id} -> task, usage baseline at the ack, delta billed at done/error) mirroring stream_agent_stdout_to_glasspane/finalize_rpc_task. - tests replay testdata/contracts/task-slice/v1/ exactly as the Rust suites do; parity is field-level, not SQLite byte identity. - scripts/check-go.sh: focused gofmt + vet + CGO_ENABLED=0 go test gate, kept separate from ci-checks.sh until the runner's Go toolchain is pinned. Driver proof (FreeBSD 15.1, go1.26.8, modernc.org/sqlite v1.36.3): - CGO_ENABLED=0 go test ./... ok (internal/task, internal/zotrpc) - go vet ./... clean - go build ./... freebsd/amd64 ok - GOOS=linux GOARCH=amd64/arm64 ok - file (test binary) statically linked - a Go-written DB re-read with the FreeBSD sqlite3 CLI shows the same tasks schema and the expected terminal row.zot reports reasoning tokens separately from output — a distinct billed count for reasoning models such as DeepSeek-R1. Both the Rust PaneUsage and the Go Usage projection dropped the `reasoning` field, so the token ledger undercounted by the full reasoning amount even though `cost_usd` stayed correct. An aborted turn (`turn_end{stop:"aborted"}` with no standalone error frame) was also finalized as success: both terminal readers keyed on `done`/`error` only. Map abort to error in the normalized event fold and close the task as failed with its partial usage billed, so the trailing bare `done` cannot flip it back to success. - Go: Usage/ledger/task slice gain reasoning_tokens; Normalized() maps stop:aborted -> error; Consume() finalizes aborted turns as failed. - Rust: PaneUsage/Task/TaskCost/schema/set_task_cost/row_to_task gain reasoning_tokens; zot_event_type maps stop:aborted -> error; the RPC completion reader finalizes aborted turns as failed. - Fixtures: reasoning_tokens expectations across normalized-events.json and task-records.json; new zot-abort.jsonl stream + abort case. Linux proof: check-go.sh green, cargo fmt/clippy clean, glasspane (58), ledger (31), daemon lib (197) all pass.