1.18.0 (owner's decisions Q3, Q4, Q5): writes that keep others' saves, access answers announced, drafts out of related documents

- Q3: the integration status (emailStatus, turnstileStatus) is written alone through the
  database adapter (writeGlobalFields, exported): a visitor's form submit no longer puts back an
  admin's SMTP or Turnstile change saved at the same moment. addToCookieList reads the list again
  right before writing and works the change out again when an editor's save changed it (up to 5
  times). Both races reproduced exactly in test/statusWrites.test.ts, on the three adapters.
- Q4: cookieScanner.access and the doctor's access go through accessAllowed: any truthy answer
  still allows, an answer that is not a boolean is reported once per option; strict (only true)
  is announced for 1.19.0.
- Q5: related documents that are drafts are left out of what the public helpers answer
  (resolveRoute, getSettings, getArchiveEntries, the 404 page, llms-full; Markdown and MCP through
  resolveRoute): null alone, removed from a list, value null in a polymorphic one. A preview keeps
  them; draftRelations: 'keep' keeps the old behaviour. withoutDraftRelations,
  applyDraftRelations exported.
- Docs: content.md, frontend.md, integrations.md, cookie-scanner.md, security.md, AGENT.md;
  iapl-nav and iapl-doctor skills.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 11:15:13 +01:00
co-authored by Claude Opus 5.5
parent fc70a34f3e
commit 21ef0fdeb0
29 changed files with 555 additions and 48 deletions
+27
View File
@@ -108,6 +108,33 @@ ambiguous (the same entry under many URLs), so `/a/b/c` → null.
**Slug collision:** two collections with an archive with the same slug → the first one
in the `collections` list wins. A configuration error; the router does not warn.
## Drafts as related documents (1.18.0)
A page is read at depth 2, Site settings and archive entries at depth 1, and Payload fills in every related document
whatever its status. Before 1.18.0 a block, a menu or a System pages link that pointed at a page never published
brought that page's title, slug and text into what the helpers answered (and llms-full printed it). Now the helpers
leave such a related document out, as if it did not exist:
| Shape | Becomes |
|---|---|
| a single relationship | `null` — a link resolves to nothing, a menu item drops out |
| a list of relationships | the draft is removed from it |
| a polymorphic one `{ relationTo, value }` | `value: null` |
A related document counts as a draft when it carries `_status` other than `'published'` (a never-published or
unpublished document of a collection with drafts). Documents without `_status` (collections without drafts, media)
are never touched; the document itself is judged as before (only published pages are served). Applies to
`createContentHelpers` (`getSettings`, `resolveRoute`, `getEntries`, `getNotFoundPage`, the page route, Markdown,
MCP, llms-full), `resolveRoute`, `getArchiveEntries`, `resolveNotFoundPage`, `collectSiteIndex` and
`buildLlmsTxt` / `createLlmsTxtRoute`. A preview (`draft: true`) keeps them.
- **What an existing site sees:** a menu item, a card or a link whose page was never published disappears for
visitors instead of showing a title that leads to a 404. Publish the page, or point the link elsewhere.
- **Keep the old behaviour:** `createContentHelpers({ draftRelations: 'keep' })`, or `draftRelations: 'keep'` on
`resolveRoute` / `getArchiveEntries` / `resolveNotFoundPage` / `collectSiteIndex` / `buildLlmsTxt`.
- **Building blocks:** `withoutDraftRelations(value)` (returns the same object when nothing changes, copies only
the changed path), `applyDraftRelations(value, { draft, draftRelations })`, type `DraftRelations`.
## Front-end helpers — createContentHelpers
Instead of writing cached wrappers in every project: