Feat v0.9.7 workflow starlark write ops
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 3s
CI/CD / test-frontend (pull_request) Has been skipped
CI/CD / test-runners (pull_request) Has been skipped
CI/CD / e2e-smoke (pull_request) Has been skipped
CI/CD / test-go-pg (pull_request) Successful in 2m44s
CI/CD / test-sqlite (pull_request) Successful in 3m4s
CI/CD / build-and-deploy (pull_request) Successful in 1m23s

Add workflow.start(), workflow.advance(), workflow.cancel(), and
workflow.submit_signoff() to the Starlark workflow module. Extract
WorkflowEngine interface in sandbox package to break the circular
import between workflow and sandbox packages.

- WorkflowEngine interface (Start/Advance/Cancel/SubmitSignoff)
- instanceToDict/signoffToDict/dictToJSON shared helpers
- Runner.SetWorkflowEngine setter + main.go wiring
- 6 new unit tests with mock engine

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 18:20:03 +00:00
parent ac7286f83b
commit e4bec9c18c
7 changed files with 490 additions and 46 deletions

View File

@@ -2,6 +2,37 @@
All notable changes to Armature are documented here.
## v0.9.7 — Full Read/Write Workflow Starlark Module
Extensions with `workflow.access` permission can now start, advance,
cancel, and signoff workflow instances directly from Starlark scripts.
**WorkflowEngine interface**
- Defined in `sandbox` package to break the `workflow ↔ sandbox` circular
import (follows `NotificationSender` / `ConnectionResolver` pattern)
- 4 methods: `Start`, `Advance`, `Cancel`, `SubmitSignoff`
- `workflow.Engine` satisfies the interface implicitly — zero changes to
the engine package
**New Starlark builtins**
- `workflow.start(workflow_id, data={})` → instance dict
- `workflow.advance(instance_id, data={})` → instance dict
- `workflow.cancel(instance_id)` → None
- `workflow.submit_signoff(instance_id, decision, comment="")` → signoff dict
- All write ops require authenticated user context (`RunContext.UserID`)
- Graceful errors when engine or user context unavailable
**Refactors**
- `instanceToDict` helper extracted — shared by `get_instance`, `start`,
`advance`
- `signoffToDict` helper for signoff return values
- `dictToJSON` helper for Starlark dict → `json.RawMessage` conversion
**Tests:** 6 new unit tests (mock engine, happy path + error guards)
## v0.9.6 — Deprecate stage_type, Collapse stage_mode
Simplifies the workflow stage classification model by removing