Skip to content

Keep the entry form's base version, stop rewriting untouched values, and say which draft the form shows #2630

Closed

Description

@pournasserian

Part of #2426 (F-FRM). Follow-up to #2613: findings from an independent review of the merged generated forms. The save path's unit of work and its choice between update and create held up.

Findings

  1. High: a stale form gets past the version check after any refused save. The hidden BaseVersion is rendered from the entry reloaded on every post. The person's old values are re-shown under the new base version.
    • A opens version 1, and B saves version 2.
    • A submits with bad JSON. The page comes back with base 2.
    • A's corrected submit stores version 3, and B's change is lost. This was reproduced against v2.
  2. Medium: an edit rewrites values the person did not touch.
    • The datetime-local widget drops seconds and fractions, and turns offsets into Z. A stored 09:30:45Z saves back as 09:30:00Z.
    • Browsers send textarea line breaks as CRLF, so LF text comes back as CRLF.
    • A title-only edit then shows other fields as changed, and the seconds are lost for good.
  3. Medium: rejected or reverted content is pre-filled as the entry's current values. The form starts from the latest version. After a rejection or a revert, that version is the rejected or reverted content, and nothing tells the person.
  4. Medium: Acceptance not fully tested.
    • No test that editing a published entry gives an update based on the published version.
    • No test of submitting the saved set and the checks running.
    • The unknown enum value is never asserted.
    • No keyboard test of the form.
    • The axe check covers only a single text field, with no other widgets and no error state.
  5. Low: EntryEdits finds a blank rationale only after writing the version. That breaks the "expected failures before the unit of work" rule. It is still correct, because the write rolls back.

Scope

  • The hidden BaseVersion comes from the form being shown, as in Keep the media details form's base version and stop refused uploads filtering the library #2629.
  • A posted value that shows the same as the stored one keeps the stored JSON, so untouched dates, numbers and texts are not rewritten. Text and rich text line breaks are normalized to LF.
  • When the latest draft is not the published version and no set is reviewing it, the form says which version it shows. It offers to start from the published version instead (?from=published), and the update is still based on the latest version, so the version check holds.
  • EntryEdits checks the rationale and sources before it writes.
  • Tests:
    • The stale-form scenario above ends in a conflict.
    • An edit that changes only the title proposes a diff with only the title.
    • Editing a published entry gives an update from the published version.
    • Saving, submitting and the checks running end to end.
    • The unknown enum value is reported.
    • A keyboard browser test fills and saves the form.
    • The axe check covers a form with every widget and a refused submit.

Acceptance

  • The overwrite scenario ends in a conflict message, and B's change stays.
  • A title-only edit of an entry with a date-time and multi-line text changes only the title.
  • After a revert, the form says it shows the reverted draft and offers the published version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugDefectv2FluentCMS v2 (v2 branch)

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions