Skip to content

Commit cc4c762

Browse files
committed
refactor(breg): call domain occurrences event records
Readers found "occurrence" unclear for records that state something happened. Nothing using the old name has been released, so it is renamed outright. Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
1 parent af56e2d commit cc4c762

67 files changed

Lines changed: 1187 additions & 1171 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎crates/CLIENTS.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ or unify distinct authority contracts. Shared HTTP/token primitives live in
6767
permissions in a binding. Validate a mutation before token acquisition or
6868
I/O; never generate its idempotency key, and resend it only through the
6969
bounded same-key retry. Record ETags and lifecycle-action ETags are distinct.
70-
- The BReg occurrence view (`id.registrystack.org/formats/breg/occurrence-view/v1alpha1`)
70+
- The BReg event record view (`id.registrystack.org/formats/breg/event-record-view/v1alpha1`)
7171
is a pure, read-only projection of one record revision, built from the
72-
caller-filtered occurrence descriptor in Registry Metadata, the record, and
72+
caller-filtered event record descriptor in Registry Metadata, the record, and
7373
evidence the caller supplies. It reads no clock and performs no exchange.
7474
Recorded time comes only from the creation revision of that record, which
75-
`occurrence_creation_revision` reads as exactly revision 1 and reports as
75+
`event_record_creation_revision` reads as exactly revision 1 and reports as
7676
absent only for a 403 or 404 answer, which means the caller cannot see that
7777
revision; every other status is returned as an error. Its compact
7878
`{recordType, recordId, revision, createdAt}` form retains the response's
@@ -82,11 +82,11 @@ or unify distinct authority contracts. Shared HTTP/token primitives live in
8282
uppercase `T` and `Z` and the offset the
8383
registry served (it serves stored timestamps in UTC with `+00:00`); dates stay
8484
dates. The Rust projection is the single implementation:
85-
the Node and Python exports (`occurrenceView`, `occurrence_view`, and the
86-
metadata `occurrenceDescriptor` or `occurrence_descriptor` accessor) pass
85+
the Node and Python exports (`eventRecordView`, `event_record_view`, and the
86+
metadata `eventRecordDescriptor` or `event_record_descriptor` accessor) pass
8787
JSON through it unchanged and add no semantics. The view shape, its status
88-
words and its error codes are documented in `products/breg/occurrences.md`
89-
and published as `products/breg/contracts/occurrence-view/OccurrenceView.schema.json`.
88+
words and its error codes are documented in `products/breg/event-records.md`
89+
and published as `products/breg/contracts/event-record-view/EventRecordView.schema.json`.
9090
- Messaging submissions take a caller-chosen idempotency key; a binding never
9191
generates one. Only the Rust client's bounded same-key retry resends a
9292
submission, and a cancellation is never resent. Message, template,

crates/registry-breg-client-node/__test__/occurrence-view.test.js renamed to crates/registry-breg-client-node/__test__/event-record-view.test.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const path = require('node:path');
66
const { test } = require('node:test');
77
const pkg = process.env.BREG_CLIENT_PACKAGE
88
? require(process.env.BREG_CLIENT_PACKAGE).breg : require('..');
9-
const { BaseRegistryClient, occurrenceView } = pkg;
9+
const { BaseRegistryClient, eventRecordView } = pkg;
1010

1111
const fixtures = path.join(
12-
__dirname, '..', '..', 'registry-breg-client', 'tests', 'fixtures', 'occurrence-view',
12+
__dirname, '..', '..', 'registry-breg-client', 'tests', 'fixtures', 'event-record-view',
1313
);
1414
const read = (name) => fs.readFileSync(path.join(fixtures, name), 'utf8');
1515

@@ -19,31 +19,31 @@ const recordId = '6f1e0c62-0000-4000-8000-000000000001';
1919
const hiddenId = '6f1e0c62-0000-4000-8000-000000000404';
2020
const link = '<https://id.registrystack.org/profiles/registry-record/v1>; rel="profile", </v1/schemas/incorporation>; rel="describedby"';
2121

22-
test('occurrenceView projects every generated fixture to its recorded view', () => {
22+
test('eventRecordView projects every generated fixture to its recorded view', () => {
2323
for (const name of [
2424
'incorporation', 'suspension-decision', 'suspension-correction', 'ownership-transfer',
2525
]) {
26-
const view = occurrenceView(read(`${name}.input.json`));
26+
const view = eventRecordView(read(`${name}.input.json`));
2727
assert.equal(typeof view, 'string');
2828
assert.deepEqual(JSON.parse(view), JSON.parse(read(`${name}.json`)), name);
2929
}
3030
});
3131

32-
test('occurrenceView raises a described occurrence failure', () => {
32+
test('eventRecordView raises a described event record failure', () => {
3333
const input = JSON.parse(read('incorporation.input.json'));
3434
input.descriptor.descriptorVersion = 2;
35-
assert.throws(() => occurrenceView(JSON.stringify(input)), (error) => {
36-
assert.equal(error.kind, 'occurrence');
35+
assert.throws(() => eventRecordView(JSON.stringify(input)), (error) => {
36+
assert.equal(error.kind, 'event-record');
3737
assert.equal(error.code, 'unsupported-version');
3838
assert.equal(error.outcomeUnknown, false);
3939
return true;
4040
});
41-
assert.throws(() => occurrenceView('{"unknown":true}'), (error) => {
42-
assert.equal(error.kind, 'occurrence');
41+
assert.throws(() => eventRecordView('{"unknown":true}'), (error) => {
42+
assert.equal(error.kind, 'event-record');
4343
assert.equal(error.code, 'invalid-input');
4444
return true;
4545
});
46-
assert.throws(() => occurrenceView({}), (error) => error.kind === 'invalid-request');
46+
assert.throws(() => eventRecordView({}), (error) => error.kind === 'invalid-request');
4747
});
4848

4949
test('the metadata accessor and the creation-revision read follow the declared contract', async () => {
@@ -54,7 +54,7 @@ test('the metadata accessor and the creation-revision read follow the declared c
5454
{
5555
id: 'incorporation', datasetIdentifier: 'register', route: 'incorporations',
5656
operations: [], readableFields: [], schema: '/v1/schemas/incorporation',
57-
occurrence: input.descriptor,
57+
eventRecord: input.descriptor,
5858
},
5959
{
6060
id: 'note', datasetIdentifier: 'register', route: 'notes', operations: [],
@@ -105,32 +105,32 @@ test('the metadata accessor and the creation-revision read follow the declared c
105105
try {
106106
const client = new BaseRegistryClient({ baseUrl: `http://127.0.0.1:${server.address().port}` });
107107
const contract = await client.registryContract();
108-
const descriptor = JSON.parse(contract.occurrenceDescriptor('incorporation'));
108+
const descriptor = JSON.parse(contract.eventRecordDescriptor('incorporation'));
109109
assert.equal(descriptor.descriptorVersion, 1);
110110
assert.equal(descriptor.label, 'Incorporation');
111111
for (const absent of ['note', 'unknown-type']) {
112-
assert.throws(() => contract.occurrenceDescriptor(absent), (error) => {
113-
assert.equal(error.kind, 'occurrence');
114-
assert.equal(error.code, 'not-an-occurrence');
112+
assert.throws(() => contract.eventRecordDescriptor(absent), (error) => {
113+
assert.equal(error.kind, 'event-record');
114+
assert.equal(error.code, 'not-an-event-record');
115115
return true;
116116
});
117117
}
118118

119-
const text = await client.occurrenceCreationRevision('incorporations', recordId);
119+
const text = await client.eventRecordCreationRevision('incorporations', recordId);
120120
assert.deepEqual(JSON.parse(text), {
121121
recordType: 'incorporation', recordId, revision: '1',
122122
createdAt: '2026-10-26T08:15:30.123456Z',
123123
});
124124
assert.ok(requests.some((url) => url.includes(`/incorporations/${recordId}/revisions/1`)));
125-
assert.equal(await client.occurrenceCreationRevision('incorporations', hiddenId), null);
125+
assert.equal(await client.eventRecordCreationRevision('incorporations', hiddenId), null);
126126
input.creationRevision = JSON.parse(text);
127127
assert.deepEqual(
128-
JSON.parse(occurrenceView(JSON.stringify(input))).recordedAt,
128+
JSON.parse(eventRecordView(JSON.stringify(input))).recordedAt,
129129
{ status: 'available', type: 'instant', value: '2026-10-26T08:15:30.123456Z' },
130130
);
131131
input.creationRevision.recordType = 'ownership-transfer';
132-
assert.throws(() => occurrenceView(JSON.stringify(input)), (error) => {
133-
assert.equal(error.kind, 'occurrence');
132+
assert.throws(() => eventRecordView(JSON.stringify(input)), (error) => {
133+
assert.equal(error.kind, 'event-record');
134134
assert.equal(error.code, 'wrong-record-evidence');
135135
assert.doesNotMatch(error.message, /ownership-transfer/);
136136
return true;

‎crates/registry-breg-client-node/client.d.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ export interface VerifiedHookDelivery {
4747
export declare function verifyHookDelivery(input: HookDeliveryInput): VerifiedHookDelivery
4848

4949
/**
50-
* Project one record revision into the occurrence view. `argumentsJson` is a
50+
* Project one record revision into the event record view. `argumentsJson` is a
5151
* JSON object with `registryRevision`, `recordType`, `descriptor`, `record`
5252
* and optional `creationRevision`, `actionReceipts` and
5353
* `proposalApplications`. The result is the view document as JSON text.
54-
* Failures carry kind `occurrence` and one of the codes `not-an-occurrence`,
54+
* Failures carry kind `event-record` and one of the codes `not-an-event-record`,
5555
* `unsupported-version`, `malformed-descriptor`, `wrong-record-evidence`,
5656
* `revision-mismatch`, `incompatible-metadata` or `invalid-input`.
5757
*/
58-
export declare function occurrenceView(argumentsJson: string): string
58+
export declare function eventRecordView(argumentsJson: string): string
5959

6060
export interface PrivateJwk {
6161
readonly kty: string
@@ -807,8 +807,8 @@ export declare class BRegMetadata {
807807
selectAction(actionIdentifier: string, expectedProfile: string): BRegActionBinding
808808
selectTombstone(recordTypeIdentifier: string, expectedProfile: string): BRegTombstoneBinding
809809
selectBatch(recordTypeIdentifier: string, expectedProfile: string): BRegBatchBinding
810-
/** The occurrence descriptor declared for a record type, as JSON text. */
811-
occurrenceDescriptor(recordType: string): string
810+
/** The event record descriptor declared for a record type, as JSON text. */
811+
eventRecordDescriptor(recordType: string): string
812812
}
813813

814814
/** Bounded declared identifiers; absent when any referenced field is unreadable. */
@@ -900,7 +900,7 @@ export declare class BaseRegistryClient {
900900
* `{recordType, recordId, revision, createdAt}` JSON text, or null when the
901901
* caller may not read it (403 or 404).
902902
*/
903-
occurrenceCreationRevision(entityRoute: string, recordIdentifier: string, accessProfile?: string | null): Promise<string | null>
903+
eventRecordCreationRevision(entityRoute: string, recordIdentifier: string, accessProfile?: string | null): Promise<string | null>
904904
statisticsLive(dataset: string, from?: string | null, to?: string | null, accessProfile?: string | null, format?: StatisticsFormat | null): Promise<RawOutcome>
905905
statisticsReleases(dataset: string, top?: SafeInteger | null, skipToken?: string | null, accessProfile?: string | null): Promise<RawOutcome>
906906
statisticsLatestRelease(dataset: string, period: string, selection: StatisticsReleaseSelection, accessProfile?: string | null, format?: StatisticsFormat | null): Promise<RawOutcome>

‎crates/registry-breg-client-node/client.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ function verifyHookDelivery(value) {
119119
}
120120
}
121121

122-
function occurrenceView(argumentsJson) {
122+
function eventRecordView(argumentsJson) {
123123
try {
124124
if (typeof argumentsJson !== 'string') throw inputError('invalid-request');
125-
return native.occurrenceView(argumentsJson);
125+
return native.eventRecordView(argumentsJson);
126126
} catch (error) {
127127
throw normalize(error, 'invalid-request');
128128
}
@@ -220,7 +220,7 @@ for (const [method, jsonIndexes, requiredIndexes] of [
220220
['statisticsLive'], ['statisticsReleases'], ['statisticsLatestRelease'],
221221
['statisticsReleaseVersion'], ['statisticsReleaseSeries'], ['statisticsPublish'],
222222
['statisticsWithdraw'],
223-
['recordRevisions'], ['getRecordRevision', [3]], ['occurrenceCreationRevision'],
223+
['recordRevisions'], ['getRecordRevision', [3]], ['eventRecordCreationRevision'],
224224
['getRecord', [2]], ['listRecords', [1]], ['continueList', [0], [0]],
225225
['getGeoJsonRecord', [2]], ['listGeoJsonRecords', [1]], ['continueGeoJsonList', [0], [0]],
226226
['listCurrentRecords', [1]], ['continueCurrentList', [0], [0]],
@@ -307,7 +307,7 @@ const BRegPreparedProposal = preparedClass(native.BRegPreparedProposal, 'BRegPre
307307
for (const name of [
308308
'selectCreate', 'selectPatch',
309309
'selectAction', 'selectTombstone', 'selectBatch', 'selectProposals', 'selectProposalGet',
310-
'selectProposalReviewContext', 'selectProposalReviewStatus', 'occurrenceDescriptor',
310+
'selectProposalReviewContext', 'selectProposalReviewStatus', 'eventRecordDescriptor',
311311
]) {
312312
const original = native.BRegMetadata.prototype[name];
313313
native.BRegMetadata.prototype[name] = function (...args) {
@@ -383,7 +383,7 @@ class PrivateKeyJwt {
383383

384384
module.exports = {
385385
verifyHookDelivery,
386-
occurrenceView,
386+
eventRecordView,
387387
PrivateKeyJwt,
388388
BaseRegistryClient,
389389
BaseRegistryClientError,

‎crates/registry-breg-client-node/index.d.ts‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export declare class BaseRegistryClient {
3333
* `{recordType, recordId, revision, createdAt}` JSON, or null when the
3434
* caller may not read it.
3535
*/
36-
occurrenceCreationRevision(entityRoute: string, recordIdentifier: string, accessProfile?: string | undefined | null): Promise<string | null>
36+
eventRecordCreationRevision(entityRoute: string, recordIdentifier: string, accessProfile?: string | undefined | null): Promise<string | null>
3737
getRecord(entityRoute: string, recordIdentifier: string, options?: any | undefined | null): Promise<CompleteOutcome>
3838
listRecords(entityRoute: string, options?: any | undefined | null): Promise<PageOutcome>
3939
continueList(value: any): Promise<PageOutcome>
@@ -221,8 +221,8 @@ export declare class BRegIngestionPrefixDigest {
221221
export type IngestionPrefixDigest = BRegIngestionPrefixDigest
222222

223223
export declare class BRegMetadata {
224-
/** The occurrence descriptor declared for one record type, as JSON text. */
225-
occurrenceDescriptor(recordType: string): string
224+
/** The event record descriptor declared for one record type, as JSON text. */
225+
eventRecordDescriptor(recordType: string): string
226226
/** Read-only capability inventory for each exact Action/profile pair. */
227227
get proposalActions(): any
228228
/** Caller-filtered inert descriptors. Selectors below remain the only authority constructors. */
@@ -344,6 +344,13 @@ export interface CompleteOutcome {
344344
*/
345345
export declare function encodeIngestionChunk(chunkIndex: number, items: any, prefixDigest: string): BRegIngestionChunk
346346

347+
/**
348+
* Project one record revision into the event record view. The input is the
349+
* JSON arguments document of the Rust projection; the result is the view
350+
* document as JSON text.
351+
*/
352+
export declare function eventRecordView(argumentsJson: string): string
353+
347354
/** Exact BReg hook request supplied by a receiver. */
348355
export interface HookDeliveryInput {
349356
method: string
@@ -365,13 +372,6 @@ export interface JsonOutcome {
365372
validAt?: string
366373
}
367374

368-
/**
369-
* Project one record revision into the occurrence view. The input is the
370-
* JSON arguments document of the Rust projection; the result is the view
371-
* document as JSON text.
372-
*/
373-
export declare function occurrenceView(argumentsJson: string): string
374-
375375
export interface PageOutcome {
376376
kind: string
377377
value: any

‎crates/registry-breg-client-node/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,5 +818,5 @@ module.exports.TombstoneBinding = nativeBinding.TombstoneBinding
818818
module.exports.PrivateKeyJwt = nativeBinding.PrivateKeyJwt
819819
module.exports.PrivateKeyJwtBinding = nativeBinding.PrivateKeyJwtBinding
820820
module.exports.encodeIngestionChunk = nativeBinding.encodeIngestionChunk
821-
module.exports.occurrenceView = nativeBinding.occurrenceView
821+
module.exports.eventRecordView = nativeBinding.eventRecordView
822822
module.exports.verifyHookDelivery = nativeBinding.verifyHookDelivery

0 commit comments

Comments
 (0)