Feat v0.9.5 typed forms sdk (#79)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-frontend (push) Successful in 5s
CI/CD / test-go-pg (push) Successful in 2m44s
CI/CD / test-sqlite (push) Successful in 3m6s
CI/CD / build-and-deploy (push) Successful in 29s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #79.
This commit is contained in:
2026-04-03 17:04:29 +00:00
committed by xcaliber
parent 6b9ce92103
commit 75d7abc089
18 changed files with 1451 additions and 324 deletions

View File

@@ -2,6 +2,53 @@
All notable changes to Armature are documented here.
## v0.9.5 — Typed Forms → SDK Primitive
Promotes the typed form system from a workflow-only model to a reusable
SDK primitive. Any package can now declare and validate forms — not just
workflow stages.
**Backend — `server/forms/` package**
- Extracted `TypedFormTemplate`, `FormField`, `FormFieldset`, `FormOption`,
`FormValidation`, `FieldCondition`, `FormHooks`, `FieldError` from
`models/workflow.go` into standalone `forms` package.
- `ParseTypedFormTemplate()`, `ValidateFormData()`, `EvaluateFieldCondition()`
exported for use by any consumer.
- ~317 lines removed from `models/workflow.go` (no external imports existed).
**REST endpoint**
- `POST /api/v1/forms/validate` — authenticated endpoint. Accepts
`{template, data}`, returns `{valid: bool, errors: [{key, message}]}`.
**Starlark module**
- `forms.validate(template, data)` — gated by `forms.validate` permission.
Returns dict with `valid` (bool) and `errors` (list of dicts).
**Frontend SDK**
- `sw.forms.render(container, template, opts)` — Preact component rendering
flat and progressive (fieldset) forms. Returns `{getData, setErrors, destroy}`.
- `sw.forms.validate(template, data)` — client-side validation (mirrors Go logic).
- `sw.forms.validateRemote(template, data)` — server-side validation via REST.
- SDK version bumped to `0.9.5`.
**Manifest validation**
- `form_template` accepted at package level. Validated via
`forms.ParseTypedFormTemplate()` at install time.
- `ManifestInfo.HasFormTemplate` flag added.
**Tests**
- 16 new tests: 12 forms package unit tests (parse, validate by type,
conditions, fieldsets), 4 Starlark module tests (valid, required,
type errors, conditions).
---
## v0.9.4 — Package Adoption + Roles
Packages can now declare `adoptable: true` in their manifest. When a team