Consent compliance: docs, agent guide, skills, changelog, shared behaviour spec, browser check, reference e2e
- docs/consent.md: compliance defaults, Global Privacy Control, withdrawal, consent log on by default and the SQL migration; no more "UODO requirement" or "GPC not needed". docs/analytics.md: what Consent Mode advanced sends. - docs/consent-behaviour-spec.md: the behaviour IAPL and IAWL share, with the 13-item test list. - CHANGELOG 1.17.0: the SQL migration first, a before → after table for an existing site. - AGENT.md, iapl-setup / iapl-upgrade / iapl-reference / iapl-consent-check, PROGRAMISTA item 78; reference skills copy. - iapl-consent-check: Global Privacy Control, equal prominence and withdrawal runs; Google asset warnings. - Reference site uses the new defaults; e2e for GPC, a stale grant, equal prominence, withdrawal; e2e:built runs every consent test in both bundlers. YouTubeEmbed warns in development without a poster. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
99036eb70c
commit
f5c53e4523
@@ -169,7 +169,7 @@ describe('the stored record', () => {
|
||||
describe('the first-paint script and Global Privacy Control', () => {
|
||||
const run = (o: { cookie?: string; gpc?: 'ask' | 'honour' | false; signal?: boolean }) => {
|
||||
setGpc(o.signal)
|
||||
const b = { removeAttribute: (n: string) => void b.removed.push(n), removed: [] as string[], style: {} as Record<string, string>, addEventListener() {} }
|
||||
const b = { addEventListener() {}, removeAttribute: (n: string) => void b.removed.push(n), removed: [] as string[], style: {} as Record<string, string> }
|
||||
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
||||
new Function('document', consentBannerScript({ gpc: o.gpc, version: 3 }))({ cookie: o.cookie ?? '', currentScript: { previousElementSibling: b } })
|
||||
return b.style.display === 'none' ? 'hidden' : b.removed.includes('hidden') ? 'shown' : 'untouched'
|
||||
@@ -236,7 +236,7 @@ describe('the signal appears after a grant made without it', () => {
|
||||
setGpc(true)
|
||||
load({ analytics: { gtmContainerId: 'GTM-TEST', metaPixelId: '123' }, logEndpoint: '/api/ipal/consent' })
|
||||
expect(banner()).toBeNull()
|
||||
expect(storedRecord()).toMatchObject({ gpc: true, id: 'a1b2c3d4e5f6a7b8c9d0e1f2', state: { ...ACCEPT, analytics: false, marketing: false } })
|
||||
expect(storedRecord()).toMatchObject({ id: 'a1b2c3d4e5f6a7b8c9d0e1f2', gpc: true, state: { ...ACCEPT, analytics: false, marketing: false } })
|
||||
expect(liveCookies().filter((c) => /^_ga|^_fbp/.test(c))).toEqual([])
|
||||
expect(layer()[0]).toEqual(['consent', 'default', expect.objectContaining({ ad_storage: 'denied', analytics_storage: 'denied', functionality_storage: 'granted' })])
|
||||
expect(injected).toEqual([])
|
||||
@@ -410,7 +410,7 @@ describe('consent log: on by default, fails soft without its table', () => {
|
||||
const logger = { error: vi.fn() }
|
||||
const payload = { create: vi.fn(async () => { throw new Error('relation "consent_records" does not exist') }), db: { deleteMany: vi.fn(async () => {}) }, logger }
|
||||
const endpoint = buildConsentLogEndpoint()
|
||||
const body = { gpc: true, id: 'a1b2c3d4e5f6a7b8c9d0e1f2', state: REJECT, version: 1 }
|
||||
const body = { id: 'a1b2c3d4e5f6a7b8c9d0e1f2', gpc: true, state: REJECT, version: 1 }
|
||||
const call = (ip: string) =>
|
||||
(endpoint.handler as (r: PayloadRequest) => Promise<Response>)(
|
||||
Object.assign(new Request('http://acme.pl/api/ipal/consent', { body: JSON.stringify(body), headers: { 'content-type': 'application/json', 'x-real-ip': ip }, method: 'POST' }), { payload }) as unknown as PayloadRequest,
|
||||
@@ -437,7 +437,7 @@ describe('doctor: consent rules', () => {
|
||||
dirs.push(root)
|
||||
const all = {
|
||||
'node_modules/@intecion/ipal-kit/package.json': { name: '@intecion/ipal-kit', version: '1.17.0' },
|
||||
'package.json': { dependencies: { '@intecion/ipal-kit': '^1.17.0' }, name: 'acmepl-web' },
|
||||
'package.json': { name: 'acmepl-web', dependencies: { '@intecion/ipal-kit': '^1.17.0' } },
|
||||
...files,
|
||||
}
|
||||
for (const [rel, content] of Object.entries(all)) {
|
||||
@@ -450,7 +450,7 @@ describe('doctor: consent rules', () => {
|
||||
const findings = async (files: Record<string, object | string>) =>
|
||||
(await runDoctor({ offline: true, only: ['consent'], packageRoot, root: project(files), today: '2026-11-26', writeSeen: false })).findings.map((f) => `${f.rule}:${f.severity}:${f.message.slice(0, 60)}`)
|
||||
const pg = { 'node_modules/@payloadcms/db-postgres/package.json': { name: '@payloadcms/db-postgres', version: '3.70.0' } }
|
||||
const config = (opts = '') => ({ 'src/payload.config.ts': `export default buildConfig({ plugins: [iapl({ i18n${opts} })] })` })
|
||||
const config = (opts = '') => ({ 'src/payload.config.ts': `export default withPlugins({ plugins: [iapl({ i18n${opts} })] })` })
|
||||
|
||||
test('Postgres, consent log on, no migration creating consent_records → error; with one, or consentLog: false → nothing', async () => {
|
||||
expect(await findings({ ...pg, ...config(), 'src/migrations/20260101_init.ts': 'create table "users"' })).toEqual([expect.stringMatching(/^consent-log-migration:error/)])
|
||||
|
||||
@@ -391,8 +391,8 @@ describe('decisions, reopening and withdrawal work as before', () => {
|
||||
expect(fetchMock).toHaveBeenCalledTimes(2)
|
||||
const calls = fetchMock.mock.calls.map(([url, init]) => ({ ...(init as object), body: JSON.parse(init.body) as unknown, url }))
|
||||
// 1.17.0: `gpc` (the browser's Global Privacy Control at the time) joins the body; the record's shape is unchanged
|
||||
expect(calls[0]).toEqual({ body: { gpc: false, id: first.id, state: REJECT, version: 3 }, headers: { 'content-type': 'application/json' }, keepalive: true, method: 'POST', url: '/api/ipal/consent' })
|
||||
expect(calls[1].body).toEqual({ gpc: false, id: first.id, state: ACCEPT, version: 3 })
|
||||
expect(calls[0]).toEqual({ body: { id: first.id, gpc: false, state: REJECT, version: 3 }, headers: { 'content-type': 'application/json' }, keepalive: true, method: 'POST', url: '/api/ipal/consent' })
|
||||
expect(calls[1].body).toEqual({ id: first.id, gpc: false, state: ACCEPT, version: 3 })
|
||||
expect(errors).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user