Skip to content

Fail closed when wizard source_paths is not a string array - #131

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

cursor[bot] merged 2 commits into
mainfrom
cursor/wizard-source-paths-2ccd

Conversation

@jmjava

@jmjava jmjava commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

Problem

PR #129 required wizard bodies to be JSON objects. source_paths still used list(data.get("source_paths") or []). A string is iterable, so "README.md" became ['R','E','A',…] and looked like missing files. A list guidance / text later called .strip() and raised AttributeError. Focus paths items were str()-coerced.

Change

  • require_json_str_list / require_json_string
  • source_paths (when present) must be a JSON array of strings; missing / null still [] (hint-path fallback)
  • guidance, segment_name, revision_notes, current_narration, mode, topic_label, segment_id, PUT text must be JSON strings when present
  • Focus paths items must be strings

Tests

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

  • String source_paths → 400
  • Non-string list items → 400
  • List guidance / text → 400
  • Integer focus path → 400

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:21
list(source_paths) treated a JSON string as characters and looked like
missing files. Require a string array; type-check guidance/text/mode and
focus path items so list values cannot AttributeError on .strip().

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:22
@cursor
cursor Bot merged commit ab4d816 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