Issue 676
Steps, Outcome fork and Diagram key blocks accept a number in place of their list
Back to our planOpen
bugcmspriority: medium
Summary
Payload's own array validator reads a number as a row count, so a request body such as { "blockType": "steps", "steps": 3 } is accepted and stored as an empty list. A post or event can then be published with an empty Steps, Outcome fork or Diagram key block. #673 closed this hole for Timeline and Key facts (and its own Fact tabs lists); these three blocks still have it.
Found by the independent review of #673 (pre-existing on main, not caused by that PR).
Details
- Blocks: Steps, Outcome fork, Diagram key (rich text blocks,
src/platform/richtext/editorial/). - Reproduce: Local API or REST create/update of a post or event with the count body above, as admin or editor; it saves and publishes with an empty list.
- Fix the way #673 did for Timeline and Key facts: the block checks its own row count (judged on submit, and on change when the value is a true count; no opinion for values that cannot be counted while Admin builds the form), shares its limits through
editorialLimits.ts, and gives every array field anadminkey (see Known gotchas indocs/project.md). - Tests first: real REST bodies must be 400 (posts and events, admin and editor), an invalid block must not be publishable by any route, and valid blocks still save.
Acceptance criteria
- Not done: A count in place of the list is refused (400) for all three blocks in posts and events.
- Not done: A block with too few or too many rows is refused on save and shows a reason under the field in Admin.
- Not done: Valid content still saves and renders as before.
- Not done: No limit is written twice.
Generated by Claude Code, opens in a new tab