Skip to content

fix(export): an empty title or empty required ACF field no longer fails the export; the message names model.field (0.8.3) - #70

Merged
ABB65 merged 1 commit into
mainfrom
t2/empty-required
Oct 27, 2026
Merged

ABB65 merged 1 commit into
mainfrom
t2/empty-required

Conversation

@ABB65

@ABB65 ABB65 commented Oct 27, 2026

Copy link
Copy Markdown
Member

What

A remote export failed with Required content value is empty. and no model or field named. WordPress saves records this validator refused:

  • a post, attachment, menu link, term, author or ACF row with an empty title (every model's title field is required);
  • an ACF field marked required that is empty. ACF does not hold drafts, private posts, imports, or rows saved before the field was made required.

The fix is one place, Models::entry(), which every record passes through:

  1. Empty title → derived label. In order: source_slug → #<wp_id> → #<ref> → the model name. Counted per model in bridge/warnings.json (empty-title-derived: N record(s) …). The title field stays required.
  2. Any other empty required field → left out. The field stops being required in that model, and the export names it once in the warnings (model/<id>.<field>: required-value-empty …). Models::model() keeps a relaxed field optional for later records, so a re-declaration does not raise "Inconsistent field types".
  3. The validator's empty-value throw now names model.field (locale), like its sibling throws. It stays fail-closed for anything else.

No record is dropped: menu parents, ACF relations and post→author/term/media point at rows by id, and a dropped row would fail as a missing relation one step later.

GENERIC. The trigger is WordPress's own data shape: a title-less record, and ACF's unenforced required on drafts and private posts. It does not depend on any one site. Census: not counted. Only one stored Bridge export is on disk, with 6 attachments and 0 untitled; the goldens have no stored Bridge models with ACF required values.

Superseded / removed

  • The post title's '#' . id fallback in Models::post() moves into Models::entry(). An untitled post's label is now its slug when it has one, otherwise #id, matching the export screen's Jobs::name().

Migrate impact (none needed)

  • Schema: migrate's intake does not read required from Bridge models. packages/intake/src/bridge.ts only counts .contentrain/models/*.json, and migrate writes its own store fields. No migrate test pins a Bridge model's required.
  • Warnings: every bridge/warnings.json row becomes a string in intake-summary.json warnings, never a failure. This is already covered by packages/intake/tests/bridge.test.ts, the case "kök okuma notu kabul edilir ama alınmaz; uyarılar ve kapsam özete geçer". The new rows have the same {source, reason} shape.

Tests (functional)

tests/integration.php:

  • a private, untitled CPT post whose required ACF field is empty, plus an untitled attachment, export ready;
  • the attachment is kept as #<id>, and the derived labels are counted;
  • the title stays required, the ACF field is optional, and the warnings name it;
  • an empty required value names model.excerpt (locale).

Gate (local, clean stack)

  • composer lint 0/0 on 28 files.
  • test:wordpress: 427 checks (was 420) plus 11 WPML checks.
  • test:store 55-file byte parity, test:text, test:coverage, npm test (handoff): all pass.
  • Plugin Check 0 errors / 0 warnings; uninstall passes.

…ls the export; the message names model.field (0.8.3)

A title-less record gets a label from its slug or id, counted per model in
bridge/warnings.json. An empty required field (ACF does not hold drafts,
private posts or older rows to it) is left out, becomes optional in the model
and is named in the warnings. No record is dropped. The post title's '#id'
fallback moves into Models::entry().
@ABB65
ABB65 merged commit 620fb6d into main Oct 27, 2026
10 checks passed
@ABB65
ABB65 deleted the t2/empty-required branch October 27, 2026 09:28
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.

1 participant