Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
955d100
fix(breg): admit additive Action response members
jeremi Dec 2, 2026
7caa45f
fix(breg): admit Proposal callers before reporting request faults
jeremi Dec 3, 2026
838e73a
fix(breg): admit native reads before refusing retired paging
jeremi Dec 3, 2026
c4f4e64
fix(review): project applicant Form responses across SDKs
jeremi Dec 3, 2026
fc0de4d
test(casework): pin applicant Form response postconditions
jeremi Dec 3, 2026
3cc14ad
fix(casework): enforce applicant Form response postconditions
jeremi Dec 3, 2026
84c58dc
test(review): reject misplaced Form selectors in ask fixtures
jeremi Dec 3, 2026
1f94186
feat(breg): carry explicit access reasons through Batch and ingestion
jeremi Dec 3, 2026
d69cd27
chore: regenerate the CLI catalog and Node client facades
jeremi Dec 3, 2026
8c7b87b
test(breg): pin effective request and selected metadata contracts
jeremi Dec 3, 2026
cc8af34
fix(breg): publish effective request and selected metadata contracts
jeremi Dec 3, 2026
25545b1
fix(breg): consume canonical List and Patch contracts in TypeScript
jeremi Dec 3, 2026
d12c3d5
test(breg): exercise optional as-of OpenAPI input in TypeScript
jeremi Dec 3, 2026
e0cf448
test(breg): preserve the unlocated refusal for mis-cased filter
jeremi Dec 3, 2026
e1a352d
test(breg): cover additive Batch and ingestion replies across SDKs
jeremi Dec 3, 2026
e9c945c
fix(breg): read additive flat Batch results and bare ingestion receipts
jeremi Dec 3, 2026
39db4e6
test(breg): read a reason-aware bare receipt through the SDK
jeremi Dec 3, 2026
dedb1bd
test(breg): distinguish Review policy selectors from task pins
jeremi Dec 3, 2026
3fac4f1
fix(breg): publish the current Review response policy schema
jeremi Dec 3, 2026
c4744f3
fix(breg): tolerate additive Proposal and Review replies
jeremi Dec 3, 2026
d245f0b
test(breg): pin canonical query problem locations
jeremi Dec 3, 2026
d17f970
fix(breg): retire legacy paging names from problem locations
jeremi Dec 3, 2026
279ffec
test(breg): format the query catalogue assertions
jeremi Dec 3, 2026
b1ea525
docs: describe additive SDK responses and Problem handling
jeremi Dec 3, 2026
2ed61e4
docs(breg): align the SDK Problem capability table
jeremi Dec 3, 2026
5497d9d
docs: document exact Discovery and Review compatibility
jeremi Dec 3, 2026
841d087
test(breg): inventory synthetic Proposal Problem identifiers
jeremi Dec 3, 2026
0f69523
docs(breg): list the native development-peer error kind
jeremi Dec 3, 2026
575f3ef
docs(breg): specify omitted Review context status members
jeremi Dec 3, 2026
7190838
chore(breg): regenerate reviewed schemas and client surfaces
jeremi Dec 3, 2026
304b4cf
test(breg): pin Python Proposal message error kind
jeremi Dec 3, 2026
7718191
fix(breg): classify unexpected Python Proposal replies as protocol er…
jeremi Dec 3, 2026
782ef71
chore(breg): refresh the Action contract identifier digest
jeremi Dec 3, 2026
128a4eb
docs: clarify the Discovery server compatibility line
jeremi Dec 3, 2026
cf4e6c0
test(breg): cover unknown Python Proposal message outcome
jeremi Dec 3, 2026
8c992ef
fix(breg): mark unexpected Python Proposal message outcome unknown
jeremi Dec 3, 2026
62565f5
test(typescript): enforce generated Contact Patch input
jeremi Dec 3, 2026
51ed6b5
test(breg): align temporal metadata with first-page requirement
jeremi Dec 3, 2026
796e51b
test(breg): pin effective workspace Patch capabilities
jeremi Dec 3, 2026
6a9b99d
test(adapter): add current turn to Proposal read fixtures
jeremi Dec 3, 2026
076fcca
test(coordinator): align Proposal Start mocks with HTTP 201
jeremi Dec 3, 2026
dba2e0c
test(breg): use a neutral additive Review want member
jeremi Dec 3, 2026
f6189a2
test(breg): pin revisions for effective PATCH schemas
jeremi Dec 3, 2026
69c165c
chore(breg): refresh Facility explain revisions
jeremi Dec 3, 2026
4d88303
chore(breg): refresh the Minimal ODRL coverage revision
jeremi Dec 3, 2026
fbf88bf
fix(breg-mcp): include current Proposal turn in mock reads
jeremi Dec 3, 2026
6b69b85
chore(breg): refresh Evidence source export provenance
jeremi Dec 3, 2026
7e884b0
fix(breg-review): include current Proposal turn in mock reads
jeremi Dec 3, 2026
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
43 changes: 40 additions & 3 deletions clients/typescript/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ const bregPatchValue = new RegExp(
'u',
)

const bregPatchOperationValue = new RegExp(
'^/paths/~1v1~1records~1' + record +
'(?:~1\\{record_id\\}/patch/requestBody/content/application~1json-patch\\+json/schema/items' +
'|(?::batch|~1ingestion-runs~1\\{run_id\\}~1chunks)/post/requestBody/content/application~1json/schema' +
'/properties/items/items/oneOf/[01]/properties/patch/items)' +
'/oneOf/[0-3]/properties/value$',
'u',
)
const bregAsOfRoute = new RegExp('^/v1/records/' + record + ':as-of$', 'u')

const isJson = (media: string) => /(?:\/json|\+json)(?:;|$)/u.test(media)
const members = (value: Node | undefined): [string, any][] => Object.entries(value ?? {})
const identifier = (value: string) => value.replace(/[^a-zA-Z0-9_]/gu, '_')
Expand Down Expand Up @@ -287,6 +297,22 @@ export function generate(source: string, settings: Settings = {}): string {
lookup(target)
return target
}
function allowsBregPatchValue(pointer: string): boolean {
if (bregPatchValue.test(pointer)) return true
if (!bregPatchOperationValue.test(pointer)) return false
const branchPointer = pointer.slice(0, -'/properties/value'.length)
const batchEnd = branchPointer.indexOf('/properties/patch/items/')
if (batchEnd !== -1) {
const item = lookup(branchPointer.slice(0, batchEnd))
if (item.properties?.operation?.const !== 'patch'
|| !Array.isArray(item.required) || !item.required.includes('operation')) return false
}
const branch = lookup(branchPointer)
const operation = branch.properties?.op?.const
return (operation === 'add' || operation === 'replace' || operation === 'test')
&& branch.properties?.path?.type === 'string'
&& Array.isArray(branch.required) && ['op', 'path', 'value'].every(name => branch.required.includes(name))
}
function audit(schema: Node | boolean, pointer: string): void {
if (rules.has(pointer)) return
if (schema === false) { rules.set(pointer, false); return }
Expand All @@ -300,7 +326,7 @@ export function generate(source: string, settings: Settings = {}): string {
}
}
if (!keys.some(key => keywords.has(key))) {
if (!allowed.has(pointer) && !(breg && bregPatchValue.test(pointer))) {
if (!allowed.has(pointer) && !(breg && allowsBregPatchValue(pointer))) {
fail(pointer, 'unconstrained schema is outside the reviewed allowlist')
}
used.add(pointer)
Expand Down Expand Up @@ -613,10 +639,14 @@ export function generate(source: string, settings: Settings = {}): string {
parameterMap.set(value.in + ':' + value.name, { value, pointer: at })
})
}
const exclusiveAsOf = breg && method === 'get' && bregAsOfRoute.test(path)
&& parameterMap.has('query:asOf') && parameterMap.has('query:cursor')
const args: Node = {}
let requiredOptions = false
for (const [location, group] of [['path', 'path'], ['query', 'query'], ['header', 'headers']] as const) {
const fields: string[] = []
const continuationFields: string[] = []
const asOfQuery = exclusiveAsOf && location === 'query'
let required = false
for (const { value, pointer: at } of parameterMap.values()) {
if (value.in !== location) continue
Expand All @@ -629,12 +659,19 @@ export function generate(source: string, settings: Settings = {}): string {
}
const declaredType = describe(value.schema, child(at, 'schema'))
const profileType = breg && value.name === 'accessProfile' && profiles?.length ? profile : undefined
const requiredParameter = value.required === true && !(location === 'query' && value.name === 'accessProfile')
fields.push(quote(value.name) + (requiredParameter ? '' : '?') + ': ' + (profileType ?? declaredType))
const field = quote(value.name)
const type = profileType ?? declaredType
const requiredParameter = (asOfQuery && value.name === 'asOf') ||
(value.required === true && !(location === 'query' && value.name === 'accessProfile'))
fields.push(asOfQuery && value.name === 'cursor' ? field + '?: never'
: field + (requiredParameter ? '' : '?') + ': ' + type)
if (asOfQuery) continuationFields.push(value.name === 'cursor' ? field + ': ' + type
: field + '?: ' + (value.name === 'accessProfile' ? type : 'never'))
required ||= requiredParameter
}
if (fields.length) {
args[group] = '{ ' + fields.join('; ') + ' }'
if (asOfQuery) args[group] += ' | { ' + continuationFields.join('; ') + ' }'
inputs.push('{ ' + group + (required ? '' : '?') + ': ' + args[group] + ' }')
requiredOptions ||= required
}
Expand Down
26 changes: 15 additions & 11 deletions clients/typescript/generated/breg-facility.ts

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions clients/typescript/generated/breg-minimal.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Generated for Stack version 0.52.0, client version 0.52.0.
// Source SHA-256 a0c571c73a3d832ce42d500fd151a8d72947955a848e0a138e9dfbed0b08ff78
// Unconstrained JSON /paths/~1v1~1records~1contacts~1{record_id}/patch/requestBody/content/application~1json-patch+json/schema/items/properties/value
// Source SHA-256 13e08ab78e0288597af557e82fdce29c82ecd8ff2eff395da92cddfe7c6198a5
// Unconstrained JSON /paths/~1v1~1records~1contacts~1{record_id}/patch/requestBody/content/application~1json-patch+json/schema/items/oneOf/0/properties/value
// Unconstrained JSON /paths/~1v1~1records~1contacts~1{record_id}/patch/requestBody/content/application~1json-patch+json/schema/items/oneOf/1/properties/value
// Unconstrained JSON /paths/~1v1~1records~1contacts~1{record_id}/patch/requestBody/content/application~1json-patch+json/schema/items/oneOf/2/properties/value
import { assertClientVersion, type Transport, type Answer, type CallOptions, type JsonValue, type Operation, type Page, type RequestValues, type ResponseVariant, type WireBytes, type WireText } from "../core.ts"
import { actionAvailability, type ActionAvailability, type DescribeOptions } from "../core.ts"
import { sentence } from "../core.ts"
Expand Down Expand Up @@ -36,7 +38,7 @@ export interface Operations {
"records.contact.list": { input: CallOptions & { query?: { "accessProfile"?: "directory-editor"; "$select"?: (string); "$filter"?: (string); "$orderby"?: (string); "limit"?: (number); "$count"?: (boolean); "cursor"?: (string) } } & { headers?: { "traceparent"?: (string); "Accept"?: ("application/json" | "application/ld+json") & (string) } } & { accept?: "application/json" | "application/ld+json" | "*/*" }; required: false; output: ({ "count"?: (number); "items": (Array<({ "domainData": ({ "email"?: (string); "jurisdiction"?: (string); "name"?: (string) }); "recordId": (string); "revisionId": (string) })>); "meta": ({ "datasetId": "directory"; "recordTypeId": "contact"; "registryId": "local-directory" }); "pageInfo": ({ "nextCursor": (string | null) }) }) | ({ "@context": "https://id.registrystack.org/contexts/registry-record/v1"; "count"?: (number); "items": (Array<({ "domainData": ({ "email"?: (string); "jurisdiction"?: (string); "name"?: (string) }); "recordId": (string); "revisionId": (string) })>); "meta": ({ "datasetId": "directory"; "recordTypeId": "contact"; "registryId": "local-directory" }); "pageInfo": ({ "nextCursor": (string | null) }) }) }
"records.contact.create": { input: CallOptions & { query?: { "accessProfile"?: "directory-editor" } } & { headers?: { "traceparent"?: (string); "Accept"?: ("application/json" | "application/ld+json") & (string) } } & ({ body: ({ "data": Schema_contact_create_input }) }) & { accept?: "application/json" | "application/ld+json" | "*/*" }; required: true; output: ({ "data": ({ "domainData": Schema_contact; "recordId": (string); "revisionId": (string) }); "meta": ({ "datasetId": "directory"; "recordTypeId": "contact"; "registryId": "local-directory" }) }) | ({ "@context": "https://id.registrystack.org/contexts/registry-record/v1"; "data": ({ "domainData": Schema_contact; "recordId": (string); "revisionId": (string) }); "meta": ({ "datasetId": "directory"; "recordTypeId": "contact"; "registryId": "local-directory" }) }) }
"records.contact.get": { input: CallOptions & { path: { "record_id": (string) } } & { query?: { "accessProfile"?: "directory-editor"; "$select"?: (string) } } & { headers?: { "traceparent"?: (string); "Accept"?: ("application/json" | "application/ld+json") & (string) } } & { accept?: "application/json" | "application/ld+json" | "*/*" }; required: true; output: ({ "data": ({ "domainData": ({ "email"?: (string); "jurisdiction"?: (string); "name"?: (string) }); "recordId": (string); "revisionId": (string) }); "meta": ({ "datasetId": "directory"; "recordTypeId": "contact"; "registryId": "local-directory" }) }) | ({ "@context": "https://id.registrystack.org/contexts/registry-record/v1"; "data": ({ "domainData": ({ "email"?: (string); "jurisdiction"?: (string); "name"?: (string) }); "recordId": (string); "revisionId": (string) }); "meta": ({ "datasetId": "directory"; "recordTypeId": "contact"; "registryId": "local-directory" }) }) }
"records.contact.patch": { input: CallOptions & { path: { "record_id": (string) } } & { query?: { "accessProfile"?: "directory-editor" } } & { headers: { "traceparent"?: (string); "If-Match": (string); "Accept"?: ("application/json" | "application/ld+json") & (string) } } & ({ body: (Array<({ "op": ("add" | "replace" | "remove" | "test") & (string); "path": (string); "value"?: JsonValue })>) }) & { accept?: "application/json" | "application/ld+json" | "*/*" }; required: true; output: ({ "data": ({ "domainData": Schema_contact; "recordId": (string); "revisionId": (string) }); "meta": ({ "datasetId": "directory"; "recordTypeId": "contact"; "registryId": "local-directory" }) }) | ({ "@context": "https://id.registrystack.org/contexts/registry-record/v1"; "data": ({ "domainData": Schema_contact; "recordId": (string); "revisionId": (string) }); "meta": ({ "datasetId": "directory"; "recordTypeId": "contact"; "registryId": "local-directory" }) }) }
"records.contact.patch": { input: CallOptions & { path: { "record_id": (string) } } & { query?: { "accessProfile"?: "directory-editor" } } & { headers: { "traceparent"?: (string); "If-Match": (string); "Accept"?: ("application/json" | "application/ld+json") & (string) } } & ({ body: (Array<(({ "op": "add"; "path": ("/data/email" | "/data/jurisdiction" | "/data/name") & (string); "value": JsonValue }) | ({ "op": "replace"; "path": ("/data/email" | "/data/jurisdiction" | "/data/name") & (string); "value": JsonValue }) | ({ "op": "test"; "path": ("/data/email" | "/data/jurisdiction" | "/data/name") & (string); "value": JsonValue }))>) }) & { accept?: "application/json" | "application/ld+json" | "*/*" }; required: true; output: ({ "data": ({ "domainData": Schema_contact; "recordId": (string); "revisionId": (string) }); "meta": ({ "datasetId": "directory"; "recordTypeId": "contact"; "registryId": "local-directory" }) }) | ({ "@context": "https://id.registrystack.org/contexts/registry-record/v1"; "data": ({ "domainData": Schema_contact; "recordId": (string); "revisionId": (string) }); "meta": ({ "datasetId": "directory"; "recordTypeId": "contact"; "registryId": "local-directory" }) }) }
"receiveReviewCompletion": { input: CallOptions & { headers: { "Registry-Recipient-Binding": (string); "webhook-id": (string); "webhook-timestamp": (string); "webhook-signature": (string) } } & ({ body: Uint8Array }); required: true; output: undefined }
}

Expand Down
128 changes: 128 additions & 0 deletions clients/typescript/tests/breg-access-reason.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { generate } from '../generate.ts'
import { Transport } from '../core.ts'

test('BReg generated inputs carry the Batch and ingestion reason in the request header', async t => {
const batchPath = '/v1/records/entries:batch'
const listPath = '/v1/records/entries/ingestion-runs'
const run = '00000000-0000-4000-8000-000000000001'
const runPath = listPath + '/{run_id}'
const chunkPath = runPath + '/chunks'
const receiptPath = chunkPath + '/{chunk_index}/receipt'
const cancelPath = runPath + '/cancel'
const reason = {
in: 'header', name: 'Registry-Access-Reason', required: false,
schema: { type: 'string', minLength: 1, maxLength: 684, pattern: '^[A-Za-z0-9_-]+$' },
}
const responses = {
200: { description: 'Accepted', content: { 'application/json': { schema: { type: 'string' } } } },
}
const bodySchema = { required: true, content: {
'application/json': { schema: { type: 'object', properties: {
items: { type: 'array', items: { type: 'string' } },
}, required: ['items'] } },
} }
const requiredReason = { ...reason, required: true }
const runParameter = { in: 'path', name: 'run_id', required: true, schema: { type: 'string', format: 'uuid' } }
const chunkParameter = { in: 'path', name: 'chunk_index', required: true, schema: { type: 'integer', minimum: 0 } }
const document = {
openapi: '3.1.0',
info: { title: 'Reason fixture' },
paths: {
[batchPath]: { post: {
operationId: 'batchEntries',
'x-registry-operation': 'batch',
parameters: [reason, {
in: 'header', name: 'Idempotency-Key', required: true,
schema: { type: 'string', minLength: 1, maxLength: 256 },
}],
requestBody: {
required: true,
content: { 'application/json': { schema: {
type: 'object', required: ['items'],
properties: { items: { type: 'array', items: { type: 'string' } } },
} } },
},
responses,
} },
[listPath]: {
get: { operationId: 'listEntryRuns', parameters: [requiredReason], responses },
post: { operationId: 'createEntryRun', parameters: [requiredReason], requestBody: bodySchema, responses },
},
[runPath]: { get: {
operationId: 'readEntryRun', parameters: [runParameter, requiredReason], responses,
} },
[chunkPath]: { post: {
operationId: 'submitEntryChunk', parameters: [runParameter, requiredReason], requestBody: bodySchema, responses,
} },
[receiptPath]: { get: {
operationId: 'readEntryReceipt', parameters: [runParameter, chunkParameter, requiredReason], responses,
} },
[cancelPath]: { post: {
operationId: 'cancelEntryRun', parameters: [runParameter, requiredReason], responses,
} },
},
}
const output = generate(JSON.stringify(document), {
breg: true,
coreImport: fileURLToPath(new URL('../core.ts', import.meta.url)),
schemaImport: fileURLToPath(new URL('../schema.ts', import.meta.url)),
})
assert.match(output, /"batchEntries": \{ input:.*headers\?: \{ "Registry-Access-Reason"\?: \(string\)/u)
const ingestion = [
'listEntryRuns', 'createEntryRun', 'readEntryRun',
'submitEntryChunk', 'readEntryReceipt', 'cancelEntryRun',
] as const
for (const operation of ingestion) {
const declaration = output.split('\n').find(line => line.includes(`"${operation}": { input:`))
assert.match(declaration ?? '', /headers: \{ "Registry-Access-Reason": \(string\)/u)
}

const dir = mkdtempSync(join(tmpdir(), 'breg-access-reason-'))
t.after(() => rmSync(dir, { recursive: true, force: true }))
const file = join(dir, 'client.ts')
writeFileSync(file, output)
const { Client } = await import(file)
const seen: Array<{ url: string; headers: Headers; body: BodyInit | null | undefined }> = []
const client = new Client(new Transport({
baseUrl: 'https://registry.example/tenant',
token: () => 'fixture',
fetch: async (url, init) => {
seen.push({ url: String(url), headers: new Headers(init?.headers), body: init?.body })
return Response.json('accepted')
},
}))
const header = 'Registry-Access-Reason'
const encoded = Buffer.from('Review 🧭', 'utf8').toString('base64url')
const body = { items: ['entry'] }
await client.call('batchEntries', { body, idempotencyKey: 'fixture-first', headers: { [header]: encoded } })
await client.call('batchEntries', { body, idempotencyKey: 'fixture-second' })
const headers = { [header]: encoded }
const path = { run_id: run }
await client.call('listEntryRuns', { headers })
await client.call('createEntryRun', { headers, body })
await client.call('readEntryRun', { headers, path })
await client.call('submitEntryChunk', { headers, path, body })
await client.call('readEntryReceipt', { headers, path: { ...path, chunk_index: 0 } })
await client.call('cancelEntryRun', { headers, path })

assert.deepEqual(seen.map(request => request.headers.get(header)), [
encoded, null, encoded, encoded, encoded, encoded, encoded, encoded,
])
assert.deepEqual(seen.map(request => new URL(request.url).pathname), [
'/tenant' + batchPath, '/tenant' + batchPath, '/tenant' + listPath, '/tenant' + listPath,
'/tenant' + runPath.replace('{run_id}', run),
'/tenant' + chunkPath.replace('{run_id}', run),
'/tenant' + receiptPath.replace('{run_id}', run).replace('{chunk_index}', '0'),
'/tenant' + cancelPath.replace('{run_id}', run),
])
assert.ok(seen.every(request => new URL(request.url).search === ''))
for (const request of seen.filter(request => request.body !== undefined)) {
assert.deepEqual(JSON.parse(String(request.body)), body)
}
})
20 changes: 10 additions & 10 deletions clients/typescript/tests/fixtures/breg-list.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
"maxLength": 128
}
},
"top": {
"limit": {
"in": "query",
"name": "$top",
"name": "limit",
"required": false,
"explode": false,
"schema": {
Expand All @@ -66,9 +66,9 @@
"type": "boolean"
}
},
"skiptoken": {
"cursor": {
"in": "query",
"name": "$skiptoken",
"name": "cursor",
"required": false,
"explode": false,
"schema": {
Expand Down Expand Up @@ -461,13 +461,13 @@
"$ref": "#/components/parameters/orderby"
},
{
"$ref": "#/components/parameters/top"
"$ref": "#/components/parameters/limit"
},
{
"$ref": "#/components/parameters/count"
},
{
"$ref": "#/components/parameters/skiptoken"
"$ref": "#/components/parameters/cursor"
}
],
"responses": {
Expand Down Expand Up @@ -556,10 +556,10 @@
"$ref": "#/components/parameters/orderby"
},
{
"$ref": "#/components/parameters/top"
"$ref": "#/components/parameters/limit"
},
{
"$ref": "#/components/parameters/skiptoken"
"$ref": "#/components/parameters/cursor"
}
],
"responses": {
Expand Down Expand Up @@ -626,10 +626,10 @@
"$ref": "#/components/parameters/orderby"
},
{
"$ref": "#/components/parameters/top"
"$ref": "#/components/parameters/limit"
},
{
"$ref": "#/components/parameters/skiptoken"
"$ref": "#/components/parameters/cursor"
}
],
"responses": {
Expand Down
Loading