Skip to content

Check schema references when a change set publishes #2604

Open

Description

@pournasserian

Part of #2415 (F-SCH). A follow-up from the review of #2520 (SCH-05).

A content type write checks its references against what each type is heading to: every draft an open set proposes, or the published version while there is none (SCH-04). Sets publish one at a time, though, so a write-time check cannot see the order they will publish in. Two cases still leave a live reference to a field the live target lacks:

  • Set A adds logo to brand. Set B adds a page field that references brand.logo, which is accepted because the open draft of brand has it. Then B publishes before A, or A is rejected.
  • A set that adds logo publishes, and a later set that references it publishes too. Reverting the first set takes logo away again (Add change set revert #2511).

Scope

  • When a set publishes, check the references against what will be live once it has: those of each schema item the set makes live, and those of every live type that points at an item the set changes. On a failure, nothing is published and the answer names each dangling reference, as the write-time checks do (reference_field_unknown, reference_target_not_entity, field_referenced).
  • A revert publishes like any other set, so it gets the same check.
  • Let a set drop a field together with the last reference to it. Today the write-time check (field_referenced) still counts the referencing type's published version when the same set's draft of that type removes the reference. With the check at publish in place, the write-time check can trust that draft.

Out of scope

Acceptance

  • In both cases above, the publish that would leave the reference dangling fails. Nothing is published, and the error names the field and the type that references it.
  • A set that adds a field and a reference to it publishes, and so does a set that drops a field together with the last reference to it.
  • All of the above passes on SQLite and PostgreSQL.
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

    area:schemaContent types and entity types (SCH)type:featureNew capabilityv2FluentCMS v2 (v2 branch)

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions