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
+5
View File
@@ -1,5 +1,6 @@
import type { BasePayload } from 'payload'
import type { DraftRelations } from '../content/draftRelations.js'
import type { ContentOption } from '../content/index.js'
import type { I18nConfig } from '../i18n/index.js'
import type { SiteIndexEntry } from './siteIndex.js'
@@ -19,6 +20,8 @@ type BuildLlmsTxtArgs = {
* collection's own plural label. Usually the most quotable content on a site.
*/
content?: ContentOption
/** Related documents that are drafts (llms-full): `'hide'` (default since 1.18.0) leaves them out, `'keep'` as before. */
draftRelations?: DraftRelations
/**
* Full-content mode (llms-full.txt). When true, each page's full body is
* inlined as Markdown (via blocksToMarkdown) under its heading, so an agent
@@ -78,6 +81,7 @@ export async function buildLlmsTxt({
baseUrl,
config,
content,
draftRelations,
full = false,
include,
layoutField = 'layout',
@@ -105,6 +109,7 @@ export async function buildLlmsTxt({
config,
content,
depth: full ? 1 : 0,
draftRelations,
include,
locales,
pagesSlug,
+4
View File
@@ -1,5 +1,6 @@
import type { BasePayload } from 'payload'
import type { DraftRelations } from '../content/draftRelations.js'
import type { ContentOption } from '../content/index.js'
import type { I18nConfig } from '../i18n/index.js'
import type { SitemapEntry } from './buildSitemapEntries.js'
@@ -33,6 +34,8 @@ export function createLlmsTxtRoute(opts: {
config: I18nConfig
/** Archive-backed collections (blog…) — listed too. Same value as the plugin option. */
content?: ContentOption
/** Related documents that are drafts (llms-full): `'hide'` (default since 1.18.0) leaves them out, `'keep'` as before. */
draftRelations?: DraftRelations
/** Inline every page's full Markdown (llms-full.txt). Default false. */
full?: boolean
getCachedPayload: () => Promise<BasePayload>
@@ -55,6 +58,7 @@ export function createLlmsTxtRoute(opts: {
baseUrl: opts.baseUrl,
config: opts.config,
content: opts.content,
draftRelations: opts.draftRelations,
full: opts.full,
...(allowed ? { include: (path: string) => allowed.has(normalizePath(path)) } : {}),
pagesSlug: opts.pagesSlug,
+5 -1
View File
@@ -3,6 +3,7 @@ import type { BasePayload } from 'payload'
import type { ContentOption } from '../content/index.js'
import type { I18nConfig } from '../i18n/index.js'
import { applyDraftRelations, type DraftRelations } from '../content/draftRelations.js'
import { archiveFieldName } from '../content/index.js'
import { buildLocalizedPath, getLocaleCodes, isValidLocale } from '../i18n/index.js'
import { resolveLocalized } from '../i18n/resolveLocalized.js'
@@ -39,6 +40,8 @@ export type CollectSiteIndexArgs = {
content?: ContentOption
/** Population depth of `doc`. Default 0 (1 when you render blocks with images). */
depth?: number
/** Related documents in `doc` that are drafts: `'hide'` (default since 1.18.0) leaves them out, `'keep'` as before. */
draftRelations?: DraftRelations
/**
* Only paths this returns true for — e.g. the pages still open while the site
* is under construction. Default: every path.
@@ -128,6 +131,7 @@ export async function collectSiteIndex({
config,
content,
depth = 0,
draftRelations,
include,
limit,
locales,
@@ -162,7 +166,7 @@ export async function collectSiteIndex({
if (collection !== pagesSlug && !prefix?.[locale]) {continue}
let docs: Row[] = []
try {
docs = await readDocs(payload, collection, { depth, limit, locale })
docs = applyDraftRelations(await readDocs(payload, collection, { depth, limit, locale }), { draftRelations })
} catch {
continue
}