Skip to content

Fail closed when wizard JSON bodies are not objects - #129

Merged
cursor[bot] merged 2 commits into
mainfrom
cursor/wizard-json-object-2ccd
Sep 7, 2026
Merged

cursor[bot] merged 2 commits into
mainfrom
cursor/wizard-json-object-2ccd

Conversation

@jmjava

@jmjava jmjava commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

Problem

PR #128 typed POST /api/state. Other wizard POST/PUT handlers still did request.json or {} then .get. A JSON array is truthy, so the default never applied and Flask raised AttributeError.

bool(data.get("with_manim", False)) treated the string "false" as true.

Change

  • request_json_object(): missing body is {}; list / scalar / null raise WizardError (400)
  • require_json_bool() for with_manim, update_requirements, also_manim, yaml_generate, llm_scene_spec

Tests

Local: ruff check src/ tests/ green; pytest tests/ 745 passed, 1 skipped; docgen benchmark meets src/docgen/benchmark_data/baseline.json (no --update-baseline).

  • List bodies on open-bundle, tool/update, generate-narration, run-from, put narration, put focus
  • String "false" / "true" for bool fields
  • Existing /api/state list-body test (message now includes not list)

Out of scope

  • Invalid JSON still becomes {} via get_json(silent=True)
  • Wizard except Exception around narration_topic_label
Open in Web Open in Cursor 

cursoragent and others added 2 commits September 7, 2026 23:12
POST/PUT handlers used request.json or {} then .get. A JSON array is
truthy, so Flask raised AttributeError. Require an object body and JSON
booleans for with_manim / yaml_generate / llm_scene_spec flags.

Co-authored-by: jmjava <jmjava@gmail.com>
Co-authored-by: jmjava <jmjava@gmail.com>
@jmjava
jmjava marked this pull request as ready for review September 7, 2026 23:13
@cursor
cursor Bot merged commit 41ed2cc into main Sep 7, 2026
6 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.

2 participants