Released docs. You are viewing the documentation published with v0.48.0. Development docs are available at Latest.
An event record is data stored in a Base Registry Engine (BReg) registry that states something happened.
A hook event is something else: a notification the registry sends after a Record changes.
Bind webhook receivers covers hook events.
You model an event record as an ordinary Record; the descriptor has no event member, and the two never read each other.
A Record type may declare that each of its Records is an event record. It states something that happened to one or more subjects, when it happened, when it took effect, what it rests on, and whether it corrects an earlier statement. The declaration is a descriptor over fields the Record type already stores. It adds no storage, no route, no grant and no behaviour. It lets a compiler, an explanation, runtime metadata and a client read the same Record shape in one generic way.
Declare the descriptor
Section titled “Declare the descriptor”eventRecord is an optional member of a Record type, next to consentRecord.
Every field value is the id of a stored field of the same Record type (not a derived field and not an apiName).
recordTypes: entry-registration: mutationMode: create-only fields: - id: entry type: reference target: entry required: true - id: source-reference type: string required: true - id: effective-at type: timestamp required: true - id: occurred-on type: date required: false - id: summary type: text required: false - id: corrects type: reference target: entry-registration required: false constraints: - id: one-per-source type: unique fields: - source-reference eventRecord: label: Entry registered subjects: - role: entry field: entry label: Entry target: entry summary: summary occurredAt: at: occurred-on effective: at: effective-at sources: - role: source field: source-reference label: Source external: namespace: "urn:example:synthetic:sources" correction: field: corrects relation: corrects sourceEventId: field: source-reference namespace: "urn:example:synthetic:sources" duplicates: reject constraint: one-per-source| Member | Required | Meaning |
|---|---|---|
label | no | Display text for the event record. Defaults to the Record type display label, then its id. |
subjects | yes, 1 to 16 | What the event record is about. Each item maps a role to a field. |
summary | no | A string or text field holding a human description. The descriptor never generates prose. |
occurredAt | no | When it happened: a point or an interval. |
effective | no | When it took effect: a point or a span, kept separate from occurredAt. |
sources | no, 0 to 16 | References to what the statement rests on. Same item shape as subjects. |
correction | no | A reference to an earlier event record this one corrects or supersedes. |
sourceEventId | no | An identifier assigned by the originating system, with its namespace and a duplicate policy. |
Subjects and sources share one role namespace. A role starts with a lowercase letter, contains only lowercase letters, digits, hyphens and underscores, is at most 64 characters, and is unique across both lists. A role item maps either:
- a
referencefield (a native relationship; optionaltargetasserts the referenced Record type), or - a
stringoruuidfield withexternal: {namespace: <absolute URI>}, an opaque identifier owned by another system. The registry never resolves it, and an external item has no native target.
Recording a source reference is not verification. The registry does not check that the source exists or supports the statement.
occurredAt and effective are either a point or an interval, over date or timestamp fields (both bounds of an interval share one type).
| Shape | Members |
|---|---|
| point | at |
| interval | start, end, and for occurredAt a meaning |
meaning is required for an occurredAt interval and refused on a point:
span: it lasted fromstarttoend(end exclusive, as in history).endis optional (still open).within: the event happened at an unknown point betweenstartandend.endis required. This is the unknown-precision form, for example “agreed between two dates, exact day unknown”.
effective is span-only: it has no meaning member, and its end is optional for an open-ended effect.
You author these as flat members, with no tag.
Where the explanation, the runtime metadata and the client view serve a time, a type member names the shape (point or interval) beside that shape’s members.
Rules that follow from this:
- A null value in a mapped field means declared but unknown.
The compiler does not require mapped fields to be
required: true. An optional field that is absent is served as an explicitnullin Record Get and in revisiondomainData. - Date fields stay dates. No midnight instant is ever derived from them.
- The descriptor adds no ordering rule.
To require
startbeforeend, or an effect not before the event, author acompareconstraint. A null side passes the constraint. - There is no
recordedAtmember; the parser refuses it withconfig.unknown-key. Recorded time is always the creation revision of the Record, never authored and never a clock fallback; see recorded time.
Corrections
Section titled “Corrections”correction.field is a reference to a Record type that declares an event record (the same Record type is allowed).
relation is:
corrects: the new Record amends an error in the earlier statement.supersedes: the new Record replaces the earlier statement as the current interpretation.
Neither changes the earlier Record. Which Record is current, and who may record a correction, belongs to your Actions, guards and documentation. A guard that checks the prior target is an ordinary Action guard; the descriptor does not add one.
Source event identifier
Section titled “Source event identifier”sourceEventId names a field (string or uuid) that carries the identifier the originating system assigned.
Declare exactly one of namespace (an absolute URI of at most 512 bytes) or namespaceField (a string or vocabulary-code field).
duplicates is:
reject: a second Record with the same identifier must be refused. The descriptor creates no constraint;constraintmust name an authoreduniqueconstraint over exactly the identifier field (and the namespace field when one is declared), with nowhencondition. A violation returns409 mutation.conflict.allow: duplicates are permitted;constraintis forbidden.
Validation
Section titled “Validation”All diagnostics are errors.
Paths use recordTypes[id=<record>].eventRecord as the base, and [role=<role>] for role items (the index form [<n>] when the role itself is invalid or duplicated).
The event record codes are:
breg.event-record.subjects-empty:subjectsis empty.breg.event-record.roles-too-many: more than 16 subjects or sources.breg.event-record.role-invalid: a role is not a lowercase identifier.breg.event-record.role-duplicate: a role repeated across subjects and sources.breg.event-record.field-unknown: a mapped field is not a stored field of the Record type.breg.event-record.field-type: a field type outside the allowed set.breg.event-record.field-reused: one field mapped by two of subjects, sources, correction and summary.breg.event-record.reference-target:targetdiffers from the field’s reference target.breg.event-record.external-target:targeton anexternalitem.breg.event-record.external-namespace: a namespace that is not an absolute URI of at most 512 bytes.breg.event-record.time-shape: point and interval members mixed,endwithoutstart, missing or misplacedmeaning, orwithinwithoutend.breg.event-record.interval-type-mismatch: interval bounds of different types.breg.event-record.correction-target: the correction target declares no event record.breg.event-record.source-event-namespace: both or neither ofnamespaceandnamespaceField.breg.event-record.source-event-constraint: policy and constraint disagree, or the constraint is not a matching unique constraint.
Four shared codes also apply:
breg.display-text.invalid: unsafe characters in a label.config.unknown-key: an unknown member, for examplerecordedAt,eventormeaningundereffective.config.unknown-variant: an unknownmeaning,relationorduplicatesvalue.config.missing-key:duplicatesmissing fromsourceEventId.
The allowed field types are:
| Member | Allowed type |
|---|---|
subject or source without external | reference |
subject or source with external | string, uuid |
summary | string, text |
occurredAt, effective | date, timestamp |
correction.field | reference |
sourceEventId.field | string, uuid |
sourceEventId.namespaceField | string, vocabulary-code |
The compiler does not validate requiredness of mapped fields, interval order, recorded-versus-effective order, who may correct, or whether the Record type is create-only.
What the descriptor does not do
Section titled “What the descriptor does not do”The descriptor grants nothing: no read, write, resolution, schedule, retention exemption or immutability.
Reading, writing and executing remain governed by access profiles, Actions and guards.
It is excluded from record_definition_revision, Action definition_revision and Proposal fingerprints, so adding, changing or removing it does not change any execution identity.
It is included in the effective model, so it changes the registry revision and the package checksum.
Package comparison treats it like display text: no change code and no review gate.
It does not touch storage. The generated DDL for a project is identical with and without descriptors.
It is separate from the Manifest projection concepts on fields (concepts, relationshipRole), which annotate vocabulary for publication, and from temporal and validTimeRole, which drive history validity and valid-at queries.
You may use all of them on the same fields; none reads the others.
Explain the descriptor
Section titled “Explain the descriptor”bregctl explain model reports the declared descriptor in recordTypes[].eventRecord (null when undeclared) and the display grouping in recordTypes[].grouping and actions[].grouping.
The explanation keeps explicit nulls for undeclared members, and shows the sourceEventId constraint that runtime metadata does not serve.
These members arrive with model explanation v1alpha7.
The version string is part of the document file name and envelope, so a reader that accepts only an earlier version refuses the document; there is no partial view.
bregctl explain output describes the contract.
Read the descriptor in runtime metadata
Section titled “Read the descriptor in runtime metadata”GET /v1/registry carries the descriptor as an eventRecord member of a Record type, filtered for the caller and profile.
metadataVersion stays "2"; the member is additive and ignorable.
- No
eventRecordmember when the Record type declares none. descriptorVersion(the integer1),labelandrecordedTime({source: creation-revision}) are always present for a declaring, visible Record type.- A subject or source item is omitted when its field is not readable by the profile. The lists may become empty.
summary,correctionandsourceEventIdare omitted when any field they use is unreadable. AsourceEventIdwhosenamespaceFieldis unreadable is omitted whole.occurredAtandeffectiveare omitted unless every mapped bound is readable.- A native item’s or correction’s
targetis dropped when that Record type is not among the caller’s visible Record types. - Withheld and undeclared members are omitted, never
null, so a client cannot distinguish them and reports both as unavailable. - Each emitted field is
{id, apiName, type, target?}, and every one is already inreadableFields. The servedsourceEventIdcarries noconstraint. - Grouping is not exposed in runtime metadata.
Discovery grants no authority; the Base Registry Engine API reference describes the metadata contract.
Recorded time
Section titled “Recorded time”Recorded time is when the registry first accepted the Record: createdAt of revision 1 of the Record (mutationKind: create, no predecessor), read from its revision history.
A client reading it needs revision access under the selected profile; without it, or when history is absent, recorded time is unavailable, never guessed from another clock.
The client’s compact creation evidence is {recordType, recordId, revision, createdAt}; the type and identifier must both match the projected Record.
The registry serves revision createdAt as RFC 3339 text ending in Z.
Authored timestamp values are stored as instants and served in UTC with a +00:00 offset: 2026-10-20T09:30:00+02:00 is read back as 2026-10-20T07:30:00+00:00.
The registry does not preserve the authored offset.
The client event record view passes the served text through (only letter case is normalised: uppercase T separator and Z zone letter) and never converts a value to another zone.
Project the client event record view
Section titled “Project the client event record view”The Rust, Node and Python clients project a Record plus its creation revision into an event record view for any declared Record type through one reader.
The view is inert data.
Its format identifier is id.registrystack.org/formats/breg/event-record-view/v1alpha1, and its JSON Schema ships with the BReg contracts, which the client tests hold to the projection output.
The view carries these members:
contract,descriptorVersion(the integer1) andregistryRevision, the revision of the metadata that supplied the descriptor.source:recordType,recordIdandrevisionof the projected Record revision.label,subjectsandsources. Each role listsrole, an optionallabel,kind(nativeorexternal),namespacefor an external role, andvalue. A role whose kind this client does not know has nokindand nonamespace, and itsvalueisunsupported.summary,occurredAt,effective,correctionandsourceEventId. Each isunavailablewhen the descriptor does not declare it. A time names its shape intype:point(at) orinterval(meaningspanorwithin,start,end). A correction namesrelation(correctsorsupersedes) and areferencevalue. A source event identifier namesnamespace,valueandduplicates(rejectorallow).recordedAtandrecordedAtSource. Recorded time isavailableonly when the caller supplied the creation revision of the projected Record; otherwise it isunavailable.recordedAtSourceis alwayscreation-revision.provenance: one entry for each distinct item of supplied evidence that names this exact Record revision. An ActionReceipt entry carriesaction,applicationIdandeffect. A Proposal application entry carriesapplicationId,submissionVersion, andappliedAt(an RFC 3339 instant, normalised like every other instant) andappliedBywhen stated. Evidence repeated by the caller yields one entry, in first-seen order.ignoredEvidence: evidence that does not name this exact Record revision, withreasonrevision-mismatch(same Record, other revision) orno-matching-result. Ignored evidence never contributes provenance.
A value member states what the client could say, never a guess:
availablecarriestype(date,instant,text,uuidorreference),value, and for a reference itstargetRecord type.declaredUnknownmeans the Record holds an explicit null.unavailablemeans the Record has no such key.unsupportedcarries adetailnaming the type, kind, relation, meaning or policy the client does not know, so a descriptor that is newer than the client degrades one member instead of failing the whole view.
The reader refuses with a closed set of error codes, none of which carries a Record value:
not-an-event-record: the Record type declares no event record.unsupported-version: a descriptor version that is a non-negative integer other than1, including0.malformed-descriptor: a malformed descriptor, including adescriptorVersionthat is not a non-negative integer, such as a string, a fraction or a negative number.wrong-record-evidence: evidence or a creation revision that belongs to another Record, or a malformed identifier, revision or Proposal application time.revision-mismatch.incompatible-metadata: a Record member that contradicts its declared type.invalid-input: the language-binding arguments are not exact JSON or do not match the contract.
Change a descriptor while work is in flight
Section titled “Change a descriptor while work is in flight”- A descriptor-only package activation does not invalidate submitted Proposals: the frozen contract fingerprint (
definition_revision) is unchanged, so a waiting Proposal still applies afterwards. - A saved client Action command is bound to the registry revision it was prepared under. After any activation, including a descriptor-only one, the client refuses to recover or replay it (the stored bytes and key are preserved). Settle uncertain Action commands before activating a descriptor-only package.
Retention and tombstones
Section titled “Retention and tombstones”Event record links are ordinary reference fields and follow the existing reference rules.
Only onDelete: restrict is supported.
- A create-only Record cannot be tombstoned. An event record is normally create-only, so it stays as evidence.
- Tombstoning a Record that an active Record references is refused with a value-free conflict. This applies to subjects of a create-only event record and to a Record an active mutable event record points at.
- Tombstoning a mutable Record that held a reference releases the restriction on its target. The retained link UUID stays in the revision history.
- A reference to an unknown Record UUID, such as an unknown
correctstarget, is refused at write time.
Declare a descriptor over a mutable Record type only when its fields may change; the descriptor then describes the current revision, and earlier statements remain in revision history.
Display purpose and grouping
Section titled “Display purpose and grouping”Record types and Actions may declare display.purpose and display.group.
They are presentation only: they never grant, hide, order execution, gate activation or change Action, Access or Proposal behaviour.
A missing declaration gives an ungrouped list with no purpose claim; purpose is never inferred from a name, route or mutation mode.
recordTypes: entry: display: label: Entry purpose: domain group: Registeractions: seed-demonstration-entries: display: label: Seed demonstration entries purpose: synthetic-seed group: Demonstration datapurpose is optional; group is optional display text, and grouping is by exact string.
| Value | Records | Actions |
|---|---|---|
domain | registry facts the programme exists to keep | changes to those facts |
processing | working records that support processing (notes, review items, intake) | processing steps |
technical | operational or integration records | maintenance or integration Actions |
synthetic-seed | not allowed | Actions that create demonstration or test data |
The validation codes are:
config.unknown-variant:purposeoutside the four values.breg.display.purpose-surface:synthetic-seedon a Record type.breg.display-text.invalid: unsafe characters ingroup.config.unknown-key:purposeorgroupon any other display surface (fields, inputs, datasets, review authorities).
A group with one member is valid, groups may mix purposes, and a Record type and an Action may share a group string.
Grouping is excluded from Record and Action definition revisions, migration review revisions and Proposal fingerprints; it is included in the effective model, so it changes the registry revision.
It is reported by bregctl explain model (v1alpha7) and not by runtime metadata.
A consumer shows grouping: null as ungrouped with no badge, shows a group without a purpose as grouped with no badge, and shows an unrecognised future purpose as unsupported while keeping the item visible.
Grouping never hides an item.
Write event records with Actions
Section titled “Write event records with Actions”Writing an event record is an ordinary create-only Action: one or more effects, an idempotency key, and commit guards. The observed behaviour is:
- A failed guard returns
412 action.guard_failed, withguardReasonwhen the caller may read every guard fact. - A violated unique source-event constraint returns
409 mutation.conflict. - The same idempotency key with a changed body returns
409 idempotency.key-reused; the exact same command replays the retained result. - Two concurrent Actions with the same precondition token commit once: one receives
200, the other412. Two concurrent handovers of the same external deed commit once: one200, one409.
Cookies on Registry Stack
We use optional cookies to understand how you use the main Registry Stack website and this documentation. If you contact us, we may link this activity to your enquiry. You can change your choice at any time. Read the privacy policy.
Your browser asks sites not to track you, so optional tracking stays off.
We could not use or save that choice. Optional tracking remains off.