Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e1fe634
chore(release): add v0.52 host images to candidate cleanup
jeremi Dec 3, 2026
07fe716
docs: align TLS and paging guidance with runtime contracts
jeremi Dec 3, 2026
5427758
docs(breg): correct Proposal Thread pagination input
jeremi Dec 3, 2026
87a19dc
docs(platform): correct provisioning command names
jeremi Dec 3, 2026
3983c5a
docs(breg): clarify list refusals and Mark Read revisions
jeremi Dec 3, 2026
bbb305c
docs(adapter): correct the job provision command
jeremi Dec 3, 2026
e02d902
docs(breg): align ingestion authority and list refusals
jeremi Dec 3, 2026
582f191
docs(breg): clarify terminal ingestion run behavior
jeremi Dec 3, 2026
f833215
test(breg): pin the nested Batch result contract
jeremi Dec 3, 2026
6df6477
feat(breg): share the nested Batch contract with ingestion
jeremi Dec 3, 2026
9c2d051
fix(breg): make Batch result parsing available to tooling
jeremi Dec 3, 2026
03cb787
fix(breg): normalize retained ingestion receipts for nested Batch
jeremi Dec 3, 2026
a8ba283
fix(breg): consume nested Batch Record results
jeremi Dec 3, 2026
eb6243b
test(breg): read a committed receipt through the public SDK
jeremi Dec 3, 2026
ad985b0
test(breg): align downstream Batch response fixtures
jeremi Dec 3, 2026
caa5002
test(breg): populate committed ingestion fixture results
jeremi Dec 3, 2026
416967e
test(breg): pin nested batch results in client fixtures
jeremi Dec 3, 2026
854ee68
fix(breg): decode nested batch results across receipts
jeremi Dec 3, 2026
fdb9380
fix(breg): expose typed nested batch results in Node
jeremi Dec 3, 2026
30cd972
test(breg): pin nested Python batch patch result
jeremi Dec 3, 2026
1289737
fix(breg): expose nested receipt shape in Python client
jeremi Dec 3, 2026
b7cbfe9
test(typescript): pin nested BReg write result replies
jeremi Dec 3, 2026
9410900
test(typescript): check ingestion result projection separately
jeremi Dec 3, 2026
ae23ed2
feat(breg): emit nested Records in direct Batch results
jeremi Dec 3, 2026
2b5db01
docs(breg): describe nested Batch and ingestion results
jeremi Dec 3, 2026
1844f7f
test(breg): verify every receipt fixture exchange
jeremi Dec 3, 2026
127c999
test(breg): pin ingestion metadata and paging diagnostics
jeremi Dec 3, 2026
7cbce96
fix(breg): publish ingestion Record Type and paging guidance
jeremi Dec 3, 2026
6d920e1
test(breg): cover fixed ingestion problem locations
jeremi Dec 3, 2026
f109afc
test(breg): send trace headers on the Node Problem fixture
jeremi Dec 3, 2026
5704a19
fix(breg): retain fixed ingestion and Proposal problem locations
jeremi Dec 3, 2026
ba0b9ce
fix(breg): read nested Batch results in maintained workflows
jeremi Dec 3, 2026
67effaa
test(breg): cover typed ingestion item refusals
jeremi Dec 3, 2026
14ae945
test(adapter): pin nested BReg Batch write replies
jeremi Dec 3, 2026
6d2a658
fix(adapter): map nested BReg Batch write receipts
jeremi Dec 3, 2026
868cb23
fix(breg): enforce the shared Record profile for Batch results
jeremi Dec 3, 2026
5877960
fix(breg): retain safe field locations on ingestion items
jeremi Dec 3, 2026
f6a225a
chore(identifiers): refresh the BReg artifact source digest
jeremi Dec 3, 2026
c606521
test(breg): retain the deployment prefix in receipt requests
jeremi Dec 3, 2026
e52f63f
fix(release): accept OCI configs without exposed ports
jeremi Dec 3, 2026
a16d1c9
fix(release): reduce Coordinator and Session image dependencies
jeremi Dec 3, 2026
1126a9c
fix(release): respect Dockerfile comments when folding continuations
jeremi Dec 3, 2026
1ad3915
fix(release): omit unused compression packages from two images
jeremi Dec 3, 2026
f068724
chore(release): bind v0.52.0 image advisory baselines
jeremi Dec 3, 2026
6620344
test: verify reference browser headers at HTTPS ingress
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
125 changes: 125 additions & 0 deletions clients/typescript/tests/breg-write-results.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import ts from 'typescript'
import { Transport } from '../core.ts'
import { generate } from '../generate.ts'

const string = { type: 'string' }
const ref = (name: string) => ({ $ref: '#/components/schemas/' + name })
const object = (properties: Record<string, object>) => ({
type: 'object', additionalProperties: false, required: Object.keys(properties), properties,
})
const parameter = (name: string, schema: object) => ({ in: 'path', name, required: true, schema })
const operation = (operationId: string, schema: object, parameters: object[] = []) => ({
operationId, parameters,
responses: { 200: { description: 'Success', content: { 'application/json': { schema } } } },
})

const batchSchema = (domainData: object) => object({
snapshot: string,
results: { type: 'array', items: object({
operation: { enum: ['create', 'patch'] },
record: object({
recordId: { type: 'string', format: 'uuid' },
revisionId: { type: 'string', pattern: '^[1-9][0-9]*$' },
domainData,
}),
etag: string,
}) },
})

const batchPath = '/v1/records/enrolments:batch'
const chunkPath = '/v1/records/enrolments/ingestion-runs/{run_id}/chunks'
const receiptPath = chunkPath + '/{chunk_index}/receipt'
const runIdParameter = parameter('run_id', { type: 'string', format: 'uuid' })
const source = JSON.stringify({
openapi: '3.1.0', info: { title: 'BReg write result fixture' },
components: { schemas: {
Enrolment: object({ name: string }),
Batch: batchSchema(ref('Enrolment')),
Receipt: object({
chunkIndex: { type: 'integer', minimum: 0 },
digest: { type: 'string', pattern: '^[0-9a-f]{64}$' },
replayed: { type: 'boolean' },
erased: { const: false },
batch: batchSchema({ type: 'object' }),
}),
} },
paths: {
[batchPath]: { post: operation('records.enrolment.batch', ref('Batch')) },
[chunkPath]: { post: operation('enrolment.ingestion.submitChunk',
object({ run: object({ runId: string }), receipt: ref('Receipt') }), [runIdParameter]) },
[receiptPath]: { get: operation('enrolment.ingestion.chunkReceipt', ref('Receipt'),
[runIdParameter, parameter('chunk_index', { type: 'integer', minimum: 0 })]) },
},
})

test('generated Fetch output types expose the nested BReg write result in all three replies', () => {
const entry = fileURLToPath(new URL('../generated/breg-minimal.ts', import.meta.url))
const output = generate(source, { breg: true, coreImport: '../core.ts', schemaImport: '../schema.ts' }) + `
type Result<DomainData> = {
operation: 'create' | 'patch'
record: { recordId: string; revisionId: string; domainData: DomainData }
etag: string
}
type Batch<DomainData> = { snapshot: string; results: Result<DomainData>[] }
type Receipt = { chunkIndex: number; digest: string; replayed: boolean; erased: false; batch: Batch<Record<string, JsonValue>> }
type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false
type Assert<T extends true> = T
type Direct = Assert<Equal<Operations['records.enrolment.batch']['output'], Batch<{ name: string }>>>
type Submit = Assert<Equal<Operations['enrolment.ingestion.submitChunk']['output'], { run: { runId: string }; receipt: Receipt }>>
type Read = Assert<Equal<Operations['enrolment.ingestion.chunkReceipt']['output'], Receipt>>
`
const options: ts.CompilerOptions = {
strict: true, noEmit: true, skipLibCheck: true, types: [],
target: ts.ScriptTarget.ES2023, module: ts.ModuleKind.NodeNext, allowImportingTsExtensions: true,
}
const host = ts.createCompilerHost(options)
const readFile = host.readFile
host.readFile = path => path === entry ? output : readFile(path)
assert.equal(ts.formatDiagnostics(ts.getPreEmitDiagnostics(ts.createProgram([entry], options, host)), host), '')
})

test('generated Fetch calls preserve nested results and the declared reply envelopes', async t => {
const dir = realpathSync(mkdtempSync(join(tmpdir(), 'registry-write-results-')))
t.after(() => rmSync(dir, { recursive: true, force: true }))
const file = join(dir, 'client.ts')
writeFileSync(file, generate(source, {
breg: true,
coreImport: fileURLToPath(new URL('../core.ts', import.meta.url)),
schemaImport: fileURLToPath(new URL('../schema.ts', import.meta.url)),
}))
const { Client } = await import(file)
const runId = '00000000-0000-4000-8000-000000000001'
const batch = { snapshot: 'opaque-snapshot', results: [{
operation: 'create',
record: {
recordId: '00000000-0000-4000-8000-000000000002',
revisionId: '9007199254740993',
domainData: { name: 'Example enrolment' },
},
etag: '"breg-fixture"',
}] }
const receipt = { chunkIndex: 0, digest: 'a'.repeat(64), replayed: false, erased: false, batch }
const submission = { run: { runId }, receipt }
const replies = new Map<string, unknown>([
['POST ' + batchPath, batch],
['POST ' + chunkPath.replace('{run_id}', runId), submission],
['GET ' + receiptPath.replace('{run_id}', runId).replace('{chunk_index}', '0'), receipt],
])
const client = new Client(new Transport({
baseUrl: 'https://registry.example', token: () => 'fixture',
fetch: async (url, init) => {
const reply = replies.get(init?.method + ' ' + new URL(String(url)).pathname)
assert.ok(reply)
return Response.json(reply)
},
}))
assert.deepEqual((await client.call('records.enrolment.batch')).data, batch)
assert.deepEqual((await client.call('enrolment.ingestion.submitChunk', { path: { run_id: runId } })).data, submission)
assert.deepEqual((await client.call('enrolment.ingestion.chunkReceipt', { path: { run_id: runId, chunk_index: 0 } })).data, receipt)
})
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ fn batch_input() -> Value {

fn batch_receipt() -> Value {
json!({"snapshot": format!("breg1_{RUN_ID}"), "results": [
{"operation": "create", "recordId": RECORD_ID, "revisionIdentifier": "1",
"etag": SERVER_ETAG, "domainData": {"legalName": "Batch Ltd"}},
{"operation": "patch", "recordId": RECORD_ID, "revisionIdentifier": "2",
"etag": SERVER_ETAG, "domainData": {"legalName": "Batched Ltd"}}
{"operation": "create", "etag": SERVER_ETAG, "record": {
"recordId": RECORD_ID, "revisionId": "1", "domainData": {"legalName": "Batch Ltd"}
}},
{"operation": "patch", "etag": SERVER_ETAG, "record": {
"recordId": RECORD_ID, "revisionId": "2", "domainData": {"legalName": "Batched Ltd"}
}}
]})
}

Expand Down
16 changes: 15 additions & 1 deletion crates/registry-adapter-connectors/tests/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,20 @@ pub fn ingestion_run(status: &str, next_chunk: u64, committed: u64, prefix: &str
/// The committed chunk receipt beside the run state. The fixture run
/// announces two items, so a two-item chunk completes it.
pub fn chunk_submission(items: &[Value], replayed: bool) -> Value {
let record_ids = [RECORD_ID, OTHER_RECORD_ID];
assert!((1..=record_ids.len()).contains(&items.len()));
let results = items
.iter()
.zip(record_ids)
.map(|(item, record_id)| {
assert_eq!(item["operation"], "create");
json!({
"operation": "create",
"etag": SERVER_ETAG,
"record": {"recordId": record_id, "revisionId": "1", "domainData": item["data"]}
})
})
.collect::<Vec<_>>();
let complete = items.len() == 2;
let empty_prefix = ingestion_prefix_digest(&[]);
let run = ingestion_run(
Expand All @@ -835,7 +849,7 @@ pub fn chunk_submission(items: &[Value], replayed: bool) -> Value {
"digest": ingestion_chunk_digest(items).expect("fixture chunk digest"),
"replayed": replayed,
"erased": false,
"batch": {"snapshot": format!("breg1_{RUN_ID}"), "results": []}
"batch": {"snapshot": format!("breg1_{RUN_ID}"), "results": results}
}
})
}
Expand Down
54 changes: 33 additions & 21 deletions crates/registry-adapter/tests/govstack_write_replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,22 @@ async fn created_validator() -> String {
key,
json!({"idempotency-key": key}),
json!({"data": {"name": "Ada Lovelace", "email": "ada@example.test"}}),
json!({"results": [{
"operation": "create",
"recordId": RECORD_ID,
"etag": "\"breg-v1\"",
"domainData": {
"name": "Ada Lovelace",
"email": "ada@example.test",
"jurisdiction": "zone-a"
}
}]}),
json!({
"snapshot": "breg1_00000000-0000-4000-8000-000000000001",
"results": [{
"operation": "create",
"etag": "\"breg-v1\"",
"record": {
"recordId": RECORD_ID,
"revisionId": "1",
"domainData": {
"name": "Ada Lovelace",
"email": "ada@example.test",
"jurisdiction": "zone-a"
}
}
}]
}),
200,
))
.await;
Expand Down Expand Up @@ -218,17 +224,23 @@ async fn fixed_write_replay_renders_create_and_conditional_update_semantics() {
key,
json!({"idempotency-key": key, "if-match": validator.clone()}),
json!({"data": {"note": "Updated"}}),
json!({"results": [{
"operation": "patch",
"recordId": RECORD_ID,
"etag": "\"breg-v2\"",
"domainData": {
"name": "Ada Lovelace",
"email": "ada@example.test",
"note": "Updated",
"jurisdiction": "zone-a"
}
}]}),
json!({
"snapshot": "breg1_00000000-0000-4000-8000-000000000001",
"results": [{
"operation": "patch",
"etag": "\"breg-v2\"",
"record": {
"recordId": RECORD_ID,
"revisionId": "2",
"domainData": {
"name": "Ada Lovelace",
"email": "ada@example.test",
"note": "Updated",
"jurisdiction": "zone-a"
}
}
}]
}),
200,
))
.await;
Expand Down
36 changes: 21 additions & 15 deletions crates/registry-adapter/tests/postgres_govstack_write_audit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,21 @@ async fn conflict_failures(served: &Served) -> usize {
const RECORD_ID: &str = "00000000-0000-4000-8000-000000000001";

/// One successful one-item BReg batch answer for `operation`.
fn batch_receipt(operation: &str, etag: &str) -> Response {
fn batch_receipt(operation: &str, revision: &str, etag: &str) -> Response {
Response::json(
200,
&json!({"results": [{
"operation": operation,
"recordId": RECORD_ID,
"etag": etag,
"domainData": {"name": "Ada", "email": "ada@example.test", "jurisdiction": "zone-a"}
}]})
&json!({
"snapshot": "breg1_00000000-0000-4000-8000-000000000001",
"results": [{
"operation": operation,
"etag": etag,
"record": {
"recordId": RECORD_ID,
"revisionId": revision,
"domainData": {"name": "Ada", "email": "ada@example.test", "jurisdiction": "zone-a"}
}
}]
})
.to_string(),
)
}
Expand Down Expand Up @@ -395,8 +401,8 @@ async fn a_completed_update_replays_after_its_validator_closure_changes() {
let project = repository_path("products/adapter/examples/breg-govstack");
let first_source = UpstreamDouble::start();
first_source.respond_with(vec![
batch_receipt("create", "\"breg-1\""),
batch_receipt("patch", "\"breg-2\""),
batch_receipt("create", "1", "\"breg-1\""),
batch_receipt("patch", "2", "\"breg-2\""),
]);
let first = Served::start_with_pack_endpoint_and_credential(
&first_source.url(""),
Expand Down Expand Up @@ -520,8 +526,8 @@ async fn a_retry_under_a_stale_guard_is_answered_in_flight_while_its_update_runs
let project = repository_path("products/adapter/examples/breg-govstack");
let first_source = UpstreamDouble::start();
first_source.respond_with(vec![
batch_receipt("create", "\"breg-1\""),
batch_receipt("patch", "\"breg-2\""),
batch_receipt("create", "1", "\"breg-1\""),
batch_receipt("patch", "2", "\"breg-2\""),
]);
let first = Served::start_with_pack_endpoint_and_credential(
&first_source.url(""),
Expand Down Expand Up @@ -647,9 +653,9 @@ async fn a_bodyless_update_does_not_negotiate_accept_but_create_still_does() {
let project = repository_path("products/adapter/examples/breg-govstack");
let source = UpstreamDouble::start();
source.respond_with(vec![
batch_receipt("create", "\"breg-1\""),
batch_receipt("patch", "\"breg-2\""),
batch_receipt("patch", "\"breg-3\""),
batch_receipt("create", "1", "\"breg-1\""),
batch_receipt("patch", "2", "\"breg-2\""),
batch_receipt("patch", "3", "\"breg-3\""),
]);
let served = Served::start_with_pack_endpoint_and_credential(
&source.url(""),
Expand Down Expand Up @@ -731,7 +737,7 @@ async fn an_update_refuses_a_nested_object_member_even_when_its_schema_admits_on
.expect("re-pin the widened schema");

let source = UpstreamDouble::start();
source.respond_with(vec![batch_receipt("create", "\"breg-1\"")]);
source.respond_with(vec![batch_receipt("create", "1", "\"breg-1\"")]);
let served = Served::start_with_pack_endpoint_and_credential(
&source.url(""),
changed.path(),
Expand Down
13 changes: 8 additions & 5 deletions crates/registry-adapterctl/tests/fixtures_replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,17 @@ entries:
response:
status: 200
body:
snapshot: breg1_00000000-0000-4000-8000-000000000001
results:
- operation: create
recordId: contact-1
etag: '"breg-1"'
domainData:
name: Ada
email: ada@example.test
jurisdiction: zone-a
record:
recordId: contact-1
revisionId: "1"
domainData:
name: Ada
email: ada@example.test
jurisdiction: zone-a
expected:
type: response
status: 201
Expand Down
12 changes: 7 additions & 5 deletions crates/registry-breg-client-node/__test__/exact-json.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ test('native JSON methods preserve values, metadata, cursors and mutation precon
if (path.endsWith(':batch')) {
const revision = request.headers['idempotency-key'] === 'exact-batch' ? '9007199254740992' : '2';
const operation = JSON.parse(body).items[0].operation;
return response.end(`{"snapshot":"breg1_${applicationId}","results":[{"operation":"${operation}","recordId":"${id}","revisionIdentifier":"${revision}","etag":"\\"breg-record-000000000002\\"","domainData":{"wide":9007199254740992},"futureItem":null}],"futureBatch":true}`);
return response.end(`{"snapshot":"breg1_${applicationId}","results":[{"operation":"${operation}","record":{"recordId":"${id}","revisionId":"${revision}","domainData":{"wide":9007199254740992},"futureRecord":true},"etag":"\\"breg-record-000000000002\\"","futureItem":null}],"futureBatch":true}`);
}
response.setHeader('link','<https://id.registrystack.org/profiles/registry-record/v1>; rel="profile", </v1/schemas/item>; rel="describedby"');
response.setHeader('etag','"breg-record-000000000001"');
Expand Down Expand Up @@ -209,9 +209,11 @@ test('native JSON methods preserve values, metadata, cursors and mutation precon
assert.equal(requests.at(-1).headers['registry-access-reason'], 'UmV2aWV3IMOp');
assert.ok(!Object.hasOwn(batchResult.value, 'futureBatch'));
assert.ok(!Object.hasOwn(batchResult.value.results[0], 'futureItem'));
assert.equal(batchResult.value.results[0].recordId,id);
assert.equal(batchResult.value.results[0].revisionIdentifier,'2');
assert.equal(batchResult.value.results[0].domainData.wide,9007199254740992);
assert.ok(!Object.hasOwn(batchResult.value.results[0].record, 'futureRecord'));
assert.equal(batchResult.value.results[0].etag,'"breg-record-000000000002"');
assert.equal(batchResult.value.results[0].record.recordId,id);
assert.equal(batchResult.value.results[0].record.revisionId,'2');
assert.equal(batchResult.value.results[0].record.domainData.wide,9007199254740992);
assert.match(requests.at(-1).body,/"reasonCode":"verified-source"/);
const batchPatch = await client.batchRecords(batch,{items:[{operation:'patch',recordId:id,
ifMatch:'"breg-record-000000000001"',patch:[{op:'replace',field:'wide',value:2}]}]},'batch-patch');
Expand All @@ -227,7 +229,7 @@ test('native JSON methods preserve values, metadata, cursors and mutation precon
error=>error.kind === 'invalid-request');
const exactBatch = await client.batchRecordsJson(batch,'{"items":[{"operation":"create","data":{"wide":9007199254740992}}]}','exact-batch','Review é');
assert.equal(requests.at(-1).headers['registry-access-reason'], 'UmV2aWV3IMOp');
assert.match(exactBatch.valueJson,/"revisionIdentifier":"9007199254740992"/);
assert.match(exactBatch.valueJson,/"revisionId":"9007199254740992"/);
assert.match(requests.at(-1).body,/"wide":9007199254740992/);
const tombstone = contract.selectTombstone('item',profile);
const removed = await client.tombstoneRecord(tombstone,id,'"breg-record-000000000001"','remove-one');
Expand Down
2 changes: 2 additions & 0 deletions crates/registry-breg-client-node/__test__/facade.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ client.executeRecoveredActionJson(immediateAction, recoveredAction).then(outcome
// @ts-expect-error Recovery needs the original idempotency key, never a fresh one.
client.recoverAction(immediateAction, preparedAction, { targetId: '9f6973f9-10b3-4c58-b41b-494cba26796f' })
client.batchRecords(batch, { items: [{ operation: 'create', data: { name: 'Ada' } }], changeContext: { kind: 'correction', reasonCode: 'source-fix' } }, 'batch-1')
.then((outcome): string => outcome.value.results[0].record.revisionId)
client.batchRecordsJson(batch, '{"items":[{"operation":"create","data":{"name":"Ada"}}]}', 'batch-2')
client.tombstoneRecord(tombstone, '9f6973f9-10b3-4c58-b41b-494cba26796f', '"breg-1"', 'remove-1')
client.tombstoneRecordJson(tombstone, '9f6973f9-10b3-4c58-b41b-494cba26796f', '"breg-1"', 'remove-2')
Expand All @@ -232,6 +233,7 @@ client.submitIngestionChunk('people', '9f6973f9-10b3-4c58-b41b-494cba26796f', ch
client.cancelIngestionRun('people', '9f6973f9-10b3-4c58-b41b-494cba26796f', 'auditor')
client.cancelIngestionRun('people', '9f6973f9-10b3-4c58-b41b-494cba26796f')
client.ingestionChunkReceipt('people', '9f6973f9-10b3-4c58-b41b-494cba26796f', 1, 'facility-operator')
.then((outcome): string => outcome.value.batch.results[0].etag)
// @ts-expect-error Chunk submissions and receipts must carry the run's access profile.
client.submitIngestionChunk('people', '9f6973f9-10b3-4c58-b41b-494cba26796f', chunk)
// @ts-expect-error Run list queries accept only the fields the route parses.
Expand Down
Loading