readPublished on version history: readPublishedVersions, and the documented form works (1.17.2)

readVersions: readPublished(), as access.md showed, answered every version read with 500 on
MongoDB, Postgres and SQLite: the rule returns the document's `_status` path, a version query
runs on the versions collection where the status is `version._status` (SQL: "Cannot find field
for path at _status"; MongoDB: TypeError in sanitizeQueryValue). Reported by a client project
upgrading to 1.17.1.

- readPublishedVersions(minimum): the version form, for readVersions.
- readPublished() carries a symbol mark (READ_PUBLISHED); iapl() swaps it on readVersions of the
  collections and globals it sees (withVersionReadRules, exported for plugins listed after it).
- Tests on the three adapters: the version list (REST, depth 0/2, Local API, GraphQL), one version
  by id, the count, a global, an explicit role; the 1.17.1 HTTP test now checks the status too.
- access.md says where each rule goes; AGENT.md, iapl-collection and iapl-audit skills.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 10:39:41 +01:00
co-authored by Claude Opus 5.5
parent fc70a34f3e
commit 4b17254135
10 changed files with 252 additions and 12 deletions
+5 -1
View File
@@ -140,7 +140,11 @@ describe('idea 23: drafts over REST and GraphQL', () => {
expect(asked.status).toBe(404)
expect(await asked.text()).not.toContain('szkic')
// the version list: a visitor sees published versions only
expect(await (await api('/guarded-pages/versions?limit=50')).text()).not.toContain('szkic')
const versions = await api('/guarded-pages/versions?limit=50&locale=pl')
expect(versions.status).toBe(200) // 1.17.1 answered 500 here: the check below alone passed on an error page
const list = await versions.text()
expect(list).toContain('Cennik')
expect(list).not.toContain('szkic')
})
test('readPublished(): an editor still sees the draft', async () => {