fix(forms,checkin): require at least one question at create (questions_required)#36
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The API made
questionsmandatory on create —POST /v1/forms/andPOST /v1/checkins/now return400 {"code": "questions_required"}when thequestionsarray 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 createrequire 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.questions_required,invalid_question_data.docs/API_REFERENCE.mdupdated — questions are required at create; removed the now-incorrect "may have zero questions (by design)" note.Verification
Live-tested against a real org:
form create -n Xandcheckin create -n X --team Ywithout questions now fail fast; create with--questions-filesucceeds. 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