Skip to content

fix(forms,checkin): require at least one question at create (questions_required)#36

Merged
xergioalex merged 1 commit into
mainfrom
fix/require-questions-on-create
Jul 6, 2026
Merged

fix(forms,checkin): require at least one question at create (questions_required)#36
xergioalex merged 1 commit into
mainfrom
fix/require-questions-on-create

Conversation

@xergioalex

Copy link
Copy Markdown
Member

Summary

The API made questions mandatory on create — POST /v1/forms/ and POST /v1/checkins/ now return 400 {"code": "questions_required"} when the questions array is missing or empty (it previously created a template-less form/check-in, which broke the webapp). This PR aligns the CLI.

Changes

  • form create / checkin create require at least one question client-side — fail fast with a clear message ("A form/check-in must have at least one question. Seed questions with --questions-file or --interactive.") instead of a server round-trip. Consistent with the existing participant requirement.
  • Error mapping for the new codes: questions_required, invalid_question_data.
  • Docs: create docstrings/help and docs/API_REFERENCE.md updated — questions are required at create; removed the now-incorrect "may have zero questions (by design)" note.
  • Tests: +2 rejection tests (form + check-in); existing create tests seed a minimal one-question file.

Verification

Live-tested against a real org: form create -n X and checkin create -n X --team Y without questions now fail fast; create with --questions-file succeeds. Full gate green (ruff + format + mypy + 694 tests).

Risks

Behavior change — creating a form/check-in now requires ≥1 question. Intentional and matches the server (which rejects it anyway); the CLI just fails earlier with guidance. Questions can still be added/removed/reordered after creation.

🤖 Generated with Claude Code

…s_required)

## Summary
The API now rejects `POST /v1/forms/` and `POST /v1/checkins/` without a non-empty
`questions` array (`400 questions_required`). Align the CLI: require at least one
question client-side on create, and map the new error codes.

## Change Log
- authoring_helpers.require_questions(): fail fast on create with no questions
  (seed with --questions-file or --interactive)
- form create + checkin create call it after building questions
- error mapping: questions_required, invalid_question_data
- docstrings/help + API_REFERENCE updated (questions are required at create; drop the
  "may have zero questions" note)
- tests: +2 rejection tests; existing create tests seed a minimal questions file

## Verification
Live-tested against a local org: `form create -n X` / `checkin create -n X --team Y`
without questions now fail fast with a clear message; create with --questions-file
succeeds. Full gate green (694 tests).

## Risks
- Behavior change: creating a form/check-in now requires >= 1 question. Intentional —
  the server enforces it; the CLI just fails earlier with guidance.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@xergioalex xergioalex merged commit 8f6f66a into main Jul 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant