Skip to content

v2.10.0

Choose a tag to compare

@sylvesterdamgaard sylvesterdamgaard released this 10 Sep 07:08
· 42 commits to main since this release

Minor release. New entry, blueprint and extensibility features, two format-spec fixes, and a quadratic write path in the file token store made linear.

One behaviour change to be aware of on upgrade — see the note under reject_unknown_fields.

Added

localize action on statamic-entries (#48) — Creates an entry's localization in another site through Statamic's makeLocalization(), so the origin is set and untranslated fields keep falling back to it. Only the fields actually sent are stored; writing an explicit null for every untouched field would defeat that fallback. Gated as a write action throughout: entries:write, a write-mode resource policy check, and the create {collection} entries permission.

merge_sets on statamic-entries update (#47) — Merges a top-level replicator field into the stored array by item id rather than replacing it, so changing one section of a page builder no longer means resending every other. Opt-in, off by default.

field path on statamic-blueprints get (#51) — Scopes the response to one field or set with a dot path (page_builder.ContentSection.media). A page builder's format spec is proportional to every set it can hold, so on a real blueprint the full response could not be returned at any useful depth.

FieldtypeExtensions registry (#46) — Lets a site or addon describe the wire format of a fieldtype this package does not ship support for, and coerce or reject incoming values for it. Without a registration nothing changes. See Extending fieldtypes.

Icon field format spec (#43) — Icon names live in the set's directory on disk, not in the blueprint, so icon used to report only "this is a string" and a plausible-looking guess rendered nothing. Sets are now listed once per response rather than inlined per field.

Configurable response size limit (#49) — STATAMIC_MCP_MAX_RESPONSE_SIZE, default unchanged at 100000 bytes, 0 disables.

reject_unknown_fields (#45) — Refuses a write carrying a key that is not a field handle inside a replicator set, grid row, bard set or group. processRow() merges the raw row back over the processed one, so such a key is written to the content file as inert data no template reads — and the write reports success.

This changes write behaviour and is on by default. A caller that has been sending a stray key inside a set was silently writing junk and being told it succeeded; it now gets an error naming the valid handles. That is the point, but it surfaces on upgrade rather than when the junk was written. Set STATAMIC_MCP_REJECT_UNKNOWN_FIELDS=false to restore the old behaviour while you fix the caller.

The check does not apply at the top level of a record, where non-blueprint keys such as template, layout and parent are legitimate.

Fixed

Select options are read in every shape Statamic accepts (#50) — selectSpec() dropped the list of ['key' => ..., 'value' => ...] maps that the Control Panel actually writes, so any select, radio, button_group or checkboxes field configured through the CP reported allowed_values: [].

The link fieldtype spec described references that do not resolve (#44) — It advertised statamic://entry/<uuid>, which is Bard link-mark syntax. ResolveRedirect does not understand it and stores the value verbatim as a dead link. The spec now describes what actually resolves: plain URLs, entry::<id>, asset::<container>::<path> and @child.

pruneExpired() and deleteForUser() were quadratic — Both removed tokens from the hash index one at a time, and each removal re-read, re-encoded and rewrote the whole index under an exclusive lock. Pruning n tokens wrote on the order of n² bytes; at 500 tokens that was megabytes of index writes. Batched into a single locked read-modify-write, roughly halving prune time at 500 tokens.

Thanks

Seven of the nine changes in this release came from @JorisOrangeStudio, including the two format-spec fixes and the silent-corruption case behind reject_unknown_fields.

Full changelog: v2.9.1...v2.10.0