Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ status: accepted
date: 2026-09-13
revised: 2026-10-04
extends: ADR-0003
superseded-in-part-by: ADR-0009 (decision 5)
superseded-in-part-by: ADR-0009 (decision 5), ADR-0016 (scopes and bindings, nested contexts)
---

# One context per target, threaded through the declaration tree
Expand Down Expand Up @@ -551,3 +551,42 @@ scope and the binding come after the column in its context, and are not
stored. An earlier version of this record said that an EQL type refuses
both. That refusal was removed on 15 November 2026.

## Amended 2026-11-23 (ADR-0016)

[ADR-0016](0016-a-context-is-a-field-path-and-named-parts.md) replaces the
scopes and bindings of the amendment of 2026-11-10 (#1487), and changes
the context of a nested record.

Decision 1 holds. One context input still reaches every operation of a
target.

**Scopes and bindings become named parts.** A part that a query can supply
is a *partition*. A part that ties a ciphertext to its row is a *label*. A
part that the key provider checks is a *policy*, which is new. `Scope`,
`Bind`, and the `scope(..)` and `bind(..)` forms of a declaration are
removed. A record lists its parts by type, such as
`context(TenantId<u64>, RecordId<Uuid>)`. A query narrows with
`.partition(..)`.

**The kind and the name of a part now decide its place in a derivation.**
The amendment of 2026-11-10 said that the kind of a part is in no
derivation, and only the values and their order are. That no longer holds
for a value with parts. Its stored context is the field path, then the
partitions, then the labels, each group sorted by wire name, and each part
enters as its name and its value. The query context is still a prefix of
the stored context. A value with no parts keeps its bytes.

**An own context is a field path.** Decision 2 said an own context is any
`NonEmpty<impl IntoContext>`. It is now a `FieldPath`, the renamed `Label`
struct, or EQL's `Identifier`. `under`, `extend` and `context_from` keep
their meaning.

**A nested record with its own scope keeps the outer names out.** Decision
2 lets a subtree be a record whose own contexts a caller's extends, and a
leaf of an inner record took the outer field's names after its own. A
leaf's field path is now the inner record's scope and the field's name
alone. The leaf still takes the outer record's parts. A value written
under the old rule is not kept readable or matching.

The views of the amendment of 2026-11-10 (#1568) stay. `contexts()` also
prints the kinds of each part.
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,30 @@ bytes Go and Rust must agree on.
The derive's `struct = .., context = "<prefix>"` form and the Go tag bind the
same pair, so a row the derive writes opens through the Go SDK and the
reverse. That is the interoperability this ADR was for.

## Amended 2026-11-23 (ADR-0016)

[ADR-0016](0016-a-context-is-a-field-path-and-named-parts.md) reverses one
part of this decision and renames one type.

**`Describe` is removed.** This record made `Describe` an open trait,
because the renderer carries the safety property and a consumer's own
column type was the expected implementor. Nothing takes `Describe` as a
bound. Its two implementors were `Label` and EQL's `Identifier`. A context
is now a field path and named parts, and a part carries its name and its
value, so the trait has no work left. `Descriptor::from_piece` is still
the only renderer. No implementor writes rendered text, so the safety rule
holds.

**The `Label` struct is renamed `FieldPath`.** The segment rule and the
rendering do not change. The name `Label` goes to the trait for a part
whose value is safe to show. `IntoLabel`, and parsing a path from text,
are removed (#1663).

**An own context is no longer any `IntoContext`.** The last point of the
decision said an own context is any `NonEmpty<impl IntoContext>`. It is a
`FieldPath` or EQL's `Identifier`.

The separator, the escaping and "a column is the pair" are unchanged. A
value whose whole context is a field path renders the descriptor it
rendered before.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
status: accepted
date: 2026-10-18
amended: 2026-10-26
amended: 2026-11-23
extends: vitaminc ADR 0002
---

Expand Down Expand Up @@ -94,3 +94,37 @@ Three things stay outside it, by design, as they were before the cascade:
by naming a type that carries that rule, the way `serde_bytes` selects a
different encoding by type (vitaminc ADR 0002). It is not a default and
not a flag, and it does not exist yet.

## Amended 2026-11-23 (ADR-0016)

[ADR-0016](0016-a-context-is-a-field-path-and-named-parts.md) names the
parts of a context and lets a part be added after encryption. This changes
what "the context it was sealed under" covers.

**Authenticated by the leaf, as before:** the field path, and every
partition and label that was present at encryption. Each part is bound as
its wire name and its value. A leaf that opens was sealed under exactly
those parts. A label's stored copy, such as a row ID in a passthrough
field, is still not authenticated by itself: a changed copy leaves the
leaf unable to open.

**Authenticated by the key tag, and not by the leaf:** a part added by a
refinement. The key provider replays the chain of refinements before it
returns a key. The leaf's AAD does not change when a value is refined.

**Not authenticated, by design:**

- **A label refinement against rollback.** A label refinement is a local
step that anyone who can write the row can compute. Someone who holds an
older tag can write it back and drop a later label, or copy the value to
another row and add that row's ID. A label that must resist this is set
at encryption.
- **Which row a leaf belongs to**, unless a label names the row. This is
the row rule above, in the new words: the label is `RecordId`.

A policy refinement is different. Only the key provider can produce its
step, and the provider refuses a chain that has been rolled back.

A finding that a label refinement can be undone by a writer is not a
defect. A finding that a part present at encryption is not bound to the
leaf is one.
Loading
Loading