All checks were successful
Build + deploy releases / build-and-deploy (push) Successful in 8s
Schema-driven form renderer plus zddc-server endpoints that turn any
<name>.form.yaml into a working data-collection form at <path>/<name>.form.html.
Submissions land in <path>/<name>/<YYYY-MM-DD>-<email-sanitized>.yaml,
ACL-gated by the existing .zddc cascade. The form posts back to its own URL;
the server strips ".html" and routes by what's underneath, so create and
update use the same client-side code path.
Form spec dialect: JSON Schema 2020-12 + RJSF-style ui:* hints, written in
YAML. Chosen for LLM authorability — it's the canonical structured-output
target for OpenAI/Anthropic, and the ui:* convention is the most-trained UI
hint vocabulary. Supported subset for v0: type (string/number/integer/boolean/
array/object), enum, min/max, minLength/maxLength, required, additionalProperties:
false, properties, items, format (date, email). Round-trip mode is form-as-truth:
submission YAML is regenerated each save, comments are not preserved (the v1
file-as-truth mode for hand-edited files like .zddc itself is deferred).
New components:
* form/ — sixth single-file HTML tool, vanilla JS renderer (~760 LoC)
* zddc/internal/jsonschema/ — focused JSON Schema validator covering only
the v0 keyword subset. Match-implementation-cost-to-surface-used: a full
library brings 70%+ surface we don't use; revisit when v1 adds $ref +
oneOf + if/then/else.
* zddc/internal/handler/formhandler.go — RecognizeFormRequest / ServeForm,
capability-URL re-edit, atomic submission writes via the new
zddc.WriteAtomic helper extracted from writer.go.
* dispatch() in zddc-server/main.go now intercepts *.form.html and
*.yaml.html before the static-file path; spec existence is the trigger.
Build pipeline: form joins ZDDC_RELEASE_TOOLS in lockstep, gets its own
embedded copy in handler/form.html (separate from the apps cascade —
the form renderer is fixed, not subject to per-folder version overrides).
Tests: 5 new Playwright specs (form-safety) + 14 new Go tests across the
validator and handler. All 172 Playwright tests + 10 Go packages green.
End-to-end manual verification: GET empty → POST 201 + capability URL →
GET re-edit (pre-filled) → POST update → 200, raw YAML browsable, ACL
deny → 403.
Docs: form/ section added to AGENTS.md and ARCHITECTURE.md. AGENTS.md
also documents the implementation-vs-dependency policy. CLAUDE.md repo-shape
list extended.
Deferred (v1+): .zddc editor migration onto this system, file-as-truth
lossless YAML round-trip, ui:show-when conditional visibility, oneOf/anyOf,
apps-cascade preview hook, cascade-fetched form definitions.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
77 lines
2.4 KiB
YAML
77 lines
2.4 KiB
YAML
# Example form spec — daily safety check-in.
|
|
#
|
|
# Drop this file at any path under ZDDC_ROOT where users have write access via
|
|
# the .zddc cascade (e.g. /Working/Daily/safety.form.yaml). zddc-server then
|
|
# serves:
|
|
# GET <path>/safety.form.html empty form
|
|
# POST <path>/safety.form.html creates <path>/safety/<date>-<email>.yaml
|
|
# GET <path>/safety/<id>.yaml.html form pre-filled from <id>.yaml
|
|
# POST <path>/safety/<id>.yaml.html updates <id>.yaml
|
|
#
|
|
# Submissions are plain YAML files — readable in any editor, browsable via the
|
|
# existing archive tool. v0 round-trip is form-as-truth: comments in submissions
|
|
# are not preserved across edits. (File-as-truth mode for hand-edited files
|
|
# like .zddc itself is a v1 feature; see plan.)
|
|
|
|
title: Daily Safety Check-In
|
|
description: Brief end-of-shift safety report. Required daily on active sites.
|
|
|
|
schema:
|
|
type: object
|
|
required: [date, location, hazardsObserved]
|
|
additionalProperties: false
|
|
properties:
|
|
date:
|
|
type: string
|
|
format: date
|
|
title: Date
|
|
description: Date of the shift being reported.
|
|
location:
|
|
type: string
|
|
enum: [Site A, Site B, Site C, Office]
|
|
title: Location
|
|
hazardsObserved:
|
|
type: boolean
|
|
title: Hazards observed?
|
|
description: Check if anything noteworthy happened during this shift.
|
|
hazards:
|
|
type: array
|
|
title: Hazards
|
|
description: List each hazard observed. Leave empty if nothing to report.
|
|
items:
|
|
type: object
|
|
required: [kind, severity]
|
|
additionalProperties: false
|
|
properties:
|
|
kind:
|
|
type: string
|
|
title: Kind
|
|
description: Short label, e.g. "Loose handrail".
|
|
minLength: 1
|
|
maxLength: 80
|
|
severity:
|
|
type: integer
|
|
title: Severity
|
|
description: 1 = minor, 5 = stop-work.
|
|
minimum: 1
|
|
maximum: 5
|
|
notes:
|
|
type: string
|
|
title: Notes
|
|
description: Anything else worth recording.
|
|
additionalNotes:
|
|
type: string
|
|
title: Additional notes
|
|
|
|
ui:
|
|
date:
|
|
ui:autofocus: true
|
|
location:
|
|
ui:widget: radio
|
|
hazards:
|
|
ui:options:
|
|
addable: true
|
|
removable: true
|
|
additionalNotes:
|
|
ui:widget: textarea
|
|
ui:placeholder: Anything else worth flagging…
|