# Consent on the server

Bucker decides, for every item an SDK sends about a person, which lawful basis it is stored
under and what may be stored at all. The SDK states what it holds (the `consent` envelope
header); the project's posture decides what that statement is worth.

## The header

`consent` carries `state` (`granted`, `pending`, `revoked`), `basis` (`consent`, `contract`,
`legitimate_interest`, `not_required` or none), `gpc`, `dnt` and `gpcMode` (`honoured` or
`ignored`). It is a claim by the client. It can tighten what is stored; it can loosen it only
where the project's posture says so.

## Postures

| Posture | Consent is required |
| --- | --- |
| `everywhere` (the default) | for every visitor |
| `eu_uk` | for visitors in the EU, EEA or the UK, and wherever the country is unknown |
| `none` | nowhere: the project states that another basis carries the processing |
| `exempt_audience` | no: each dataset keeps only what its `exemptMode` allows; no identity, no recording |

A project with no posture row, or one Bucker cannot read, is treated as `everywhere`. A posture
is only ever loosened by something that was recorded, never by something that was lost.

An `exempt_audience` posture names the jurisdiction profile whose conditions it rests on
(`eu_eprivacy_audience_measurement`, `uk_pecr`, `fr_cnil`, `es_aepd` or `de_ttdsg`), stored in the
posture's `profile` column; a posture naming a profile Bucker does not list is not honoured and the
strictest posture applies.

## Changing the posture

The posture is one human act, `web_consent_posture.update`: CRITICAL, human-only, needing the
`org:admin` scope. An agent, a service principal, an OAuth client and a delegated session are
refused before anything is read; there is no MCP tool that changes it.

- **A tightening** (toward consent being required, a stricter replay scope) is one owner's act,
  applied at once with that owner's step-up.
- **A loosening** is dual-controlled. The registry ships the act denied, so an organization first
  writes the approval row (`ASK`, two approvers). Then a second owner confirms with a step-up of
  their own, a 24-hour hold runs during which any person may reject, and the requester confirms
  again with a fresh step-up before the change applies. The confirming person must be an OWNER:
  the act is filed against the organization, so an ADMIN cannot confirm it. An organization with
  one person who may approve takes the hold alone; one with a single owner and other members who
  hold the approval scope is not counted as short of approvers, so it makes a second owner before
  it can loosen.
- **What counts as loosening** is judged over the posture, the profile and the replay scope
  together, and anything not clearly tighter is a loosening: a change of profile, a move between
  `none` and an exempt posture, a tightening in one setting that loosens another.
- Every change writes one audit row with the before and after, the direction and the reason, and a
  signed receipt.

## The exempt-mode checker

An `exempt_audience` posture is saved only with a passing run of the checker for its profile,
recorded in the last 24 hours, and the checker is run again when the change applies (the hold is as
long as a run stays fresh). The checker evaluates ten conditions over the project's live
configuration: the jurisdiction recognises an exemption (Germany does not, so `de_ttdsg` never
passes), no cross-site identifier, no persisted visitor identifier, no IP prefix kept and location
no finer than the country, counts only, no replay or individual capture, the visitor's objection
honoured by the server, counters kept at most 25 months, no destination receiving web events, and a
recorded data-processing agreement with Bucker as processor. Each condition is pass or fail with
its evidence, and the run carries a digest over what was observed. A condition that cannot be read
fails.

The checker reports what is met and what is not. It is a check of configuration against the
conditions the guidance names, not a legal determination, and it does not conclude that a notice
to visitors can be left out. The thresholds (25 months for counters; the identity modes allowed)
are constants in `exempt-checker/profiles.ts` and are reviewed there.

## Reading it

`GET /orgs/:o/projects/:p/consent` and the MCP tool `web_consent_get` report the posture, the last
recorded checker run, who last changed the posture and why, and the basis mix with the refused and
GPC shares. They need the analytics gate (PA-01) open for the project.

## What is stored

Items about a person (product events, replay segments, survey answers, feedback) are either
stored identified under a basis, kept as counts, or refused with `consent_required`. Items that
are kept anyway (errors, sessions) lose their person instead: they are stored personless under
`not_required`.

- A visitor's refusal wins under every posture: `revoked`, `pending`, and a GPC or DNT signal the
  SDK did not report as ignored. A pending header on the wire is a client that is not holding its
  requests, so nothing identity-bearing is stored for it.
- GPC and DNT leave only what the dataset's `exemptMode` allows (`none`, `aggregate_only`,
  `allowed`). `gpcMode: ignored` is the customer's explicit opt-out; it is counted on every
  envelope, never silent.
- Where consent is required, only `granted` with basis `consent` (or none stated) is identified.
  A `contract` or `legitimate_interest` claim is not taken in place of consent.
- A `consent` basis named without `state: granted` is read as no basis at all: Bucker never
  stamps consent nobody gave.
- Every stored row carries its basis. Only a refusal carries none.

## Replay

`replayConsentScope` is the project's rule for recordings: `granted` (only when the header says
granted), `any` (any state the visitor has not refused), `none` (no consent needed), or unset
(the behaviour from before consent: only an explicit refusal stops a recording). A visitor's
refusal stops a recording under every scope. Each segment records the basis it was stored under
(`consentBasis`).

## The basis mix

Every resolved item is counted per (project, basis, gpc, hour) in `consent_stamp_hours`, refusals
included (`refused`), so any read can state what its numbers rest on. The counts need the
product-analytics gate (PA-01) to be open for the project; with it shut nothing is counted.

## Limits

The basis a client states is a claim, not proof; Bucker enforces what the posture and the
visitor's signals allow and records what it was told. Country comes from the edge's own lookup
and is a hint, not a legal determination. This page describes the server's decisions; it is not
legal advice, and nothing in Bucker says that a notice to visitors can be left out.
