Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
1356cf7
feat(breg): serve the decision on every Proposal command response
jeremi Nov 27, 2026
4dd7d20
fix(breg): declare the Proposal attachment download as any media type
jeremi Nov 27, 2026
9f5079b
feat(review): add asks to the review protocol
jeremi Nov 27, 2026
9a7bd9e
feat(review): add ask feed, read and answer to the review client
jeremi Nov 27, 2026
a3014d4
feat(casework): let an approval stage opt in to asks and a producer d…
jeremi Nov 27, 2026
723fc13
fix(review): bind ask answers to the accepted request and refuse unty…
jeremi Nov 27, 2026
d3580e7
feat(breg): refuse a Proposal grant that writes inputs it cannot read
jeremi Nov 27, 2026
8bd95d8
feat(casework): let the task holder ask the applicant and serve asks …
jeremi Nov 27, 2026
cdac18b
test(casework): cover the ask command and producer ask routes over HTTP
jeremi Nov 27, 2026
7214095
feat(casework): publish the ask contract, matrices rows and docs
jeremi Nov 27, 2026
65a24f6
feat(casework): add the staff ask command to the Rust client
jeremi Nov 27, 2026
856434e
feat(casework): add the ask command to the Node and Python clients
jeremi Nov 27, 2026
42c137c
chore(casework): allow the ask command's argument list like its siblings
jeremi Nov 27, 2026
7ea9bbb
fix(casework): order ask feed events, bind asks to their request and …
jeremi Nov 27, 2026
4f8679b
test(breg): grant the inputs each editing Proposal grant may write to…
jeremi Nov 27, 2026
c16d91b
feat(casework): configure ask timing and returning-stage resubmission
jeremi Nov 27, 2026
a24f71d
feat(casework): expose ask expiry and clock pause in clients
jeremi Nov 27, 2026
59b7b30
feat(casework): publish ask timing and paused clock contracts
jeremi Nov 27, 2026
c577a38
fix(casework): sync the unified Node declaration
jeremi Nov 27, 2026
57c951e
feat(breg): accept supporting files during submitted Proposal review
jeremi Nov 27, 2026
3261078
feat(casework): resume review after applicant answers or asks expire
jeremi Nov 27, 2026
a2837f1
docs(breg): explain and verify supporting file additions
jeremi Nov 27, 2026
5a90fda
fix(casework): expose ask types through the Rust facade
jeremi Nov 27, 2026
ae3f8a8
chore(breg): refresh explain report revisions after contract changes
jeremi Nov 27, 2026
bad9ec7
docs(breg): publish the additions limit problem code
jeremi Nov 27, 2026
4d98751
fix(casework): preserve current review and paused clock state
jeremi Nov 27, 2026
ae18abc
fix(breg): audit replayed public reasons and bind readable inputs to …
jeremi Nov 27, 2026
de1a37b
fix(breg): point the unreadable-input refusal at the one fix that res…
jeremi Nov 27, 2026
4849be2
fix(casework): keep earlier-stage reviewers excluded when a review re…
jeremi Nov 27, 2026
511a177
fix(breg): preserve retained additions and enforce upload admission
jeremi Nov 27, 2026
436967c
docs(breg): pin additions security and receiver obligations
jeremi Nov 27, 2026
195aed4
fix(casework): derive task markers from the newest ask
jeremi Nov 27, 2026
34493a7
fix(casework): exclude earlier-round reviewers above the stage they d…
jeremi Nov 27, 2026
63cdaf4
fix(casework): publish the deadline requirement for paused asks
jeremi Nov 27, 2026
69f4f6d
fix(casework): resume only when stages up to the returning stage are …
jeremi Nov 27, 2026
9034af9
docs(casework): restore the line break before the subject clock sentence
jeremi Nov 27, 2026
16a42b8
test(casework): retain expired markers after older answers
jeremi Nov 27, 2026
708d3cb
fix(casework): correct the pre-existing outbox clock mismatch
jeremi Nov 27, 2026
97bb1d3
feat(breg): preserve approved submissions with served status
jeremi Nov 27, 2026
b5bc367
fix(breg): expose Proposal problems and missing attachments
jeremi Nov 27, 2026
22f1b3b
test(breg): allow Proposal OpenAPI authentication examples
jeremi Nov 27, 2026
5e3ca63
fix(breg): return blocked applications to party recovery
jeremi Nov 27, 2026
8ebfea6
fix(breg): align Proposal refusals with served contracts
jeremi Nov 28, 2026
cc1f073
feat(breg): establish revision-fenced ask storage
jeremi Nov 28, 2026
8f8b09e
feat(casework): join live source answers onto reviewer asks
jeremi Nov 28, 2026
bbb26e7
feat(breg): deliver applicant answers to review asks
jeremi Nov 28, 2026
73d9ea5
docs(breg): explain applicant answers and reviewer disclosure
jeremi Nov 28, 2026
e6b690d
test(breg): prove review asks across live products
jeremi Nov 28, 2026
77653a1
fix(breg): serve applicant answers to human reviewers only
jeremi Nov 28, 2026
1005bd8
fix(breg): recover and bound review ask observations
jeremi Nov 28, 2026
1f3edd6
chore(identifiers): regenerate the catalog for review asks, attachmen…
jeremi Nov 28, 2026
6c2173e
fix(casework): cap asks per review request
jeremi Nov 28, 2026
eb993f7
fix(breg): serve asks only to the human answering party and keep call…
jeremi Nov 28, 2026
cc42f72
fix(breg): bound ask disclosure and receipt retention
jeremi Nov 28, 2026
2d79a9f
docs(breg): name every unfiltered Proposal hook addition
jeremi Nov 28, 2026
2c96506
chore(identifiers): regenerate the catalog for the Casework ask limit
jeremi Nov 28, 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
64 changes: 64 additions & 0 deletions crates/registry-breg-client-node/__test__/additions.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
'use strict';
const assert = require('node:assert/strict');
const http = require('node:http');
const { createHash } = require('node:crypto');
const { test } = require('node:test');
const { BaseRegistryClient } = require('..');

test('additions preserve the submitted version and use exact binary exchanges', async () => {
const id = '00000000-0000-4000-8000-000000000001';
const file = '00000000-0000-4000-8000-000000000002';
const revision = `sha256:${'a'.repeat(64)}`;
const bytes = Buffer.from('support');
const metadata = { id: 'additions', version: '1', revision, metadataVersion: '2', recordTypes: [], operations: [], actions: [],
proposals: {actions: [{actionId: 'correct', accessProfile: 'writer', operations: ['get'], readableInputs: [], readableContextFields: []}],
get: {method: 'GET', path: '/v1/proposals/{proposal_id}', accessProfiles: ['writer']}} };
const document = {id, actionId: 'correct', actionRevision: revision, submissionVersion: 1, revision: 2, state: 'submitted', effectDigest: revision, links: {},
additions: {other: {id: 'other', maximumBytes: 64, maximumCount: 2, contentTypes: ['text/plain'], classification: 'restricted', items: [],
links: {add: {method: 'POST', path: `/v1/proposals/${id}/additions/other`, accessProfile: 'writer', operation: 'add', ifMatch: '"condition"'}}}}};
const requests = [];
const server = http.createServer(async (request, response) => {
const chunks = []; for await (const chunk of request) chunks.push(chunk);
requests.push({method: request.method, url: request.url, headers: request.headers, body: Buffer.concat(chunks)});
response.setHeader('traceparent', '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01');
response.setHeader('cache-control', 'no-store');
if (request.url.includes(`/additions/${file}?`)) {
response.setHeader('content-type', 'text/plain'); response.setHeader('content-disposition', 'attachment');
response.setHeader('x-content-type-options', 'nosniff'); response.setHeader('vary', 'authorization');
return response.end(bytes);
}
if (request.method === 'POST') {
document.revision++;
document.additions.other.items.push({id: file, submissionVersion: 1, sha256: createHash('sha256').update(bytes).digest('hex'),
byteSize: bytes.length, contentType: 'text/plain', addedAt: '2026-11-27T00:00:00Z', verificationStatus: 'notRequired',
links: {download: {method: 'GET', path: `/v1/proposals/${id}/additions/${file}?submissionVersion=1`, accessProfile: 'writer', operation: 'download'}}});
}
response.setHeader('content-type', 'application/json'); response.setHeader('vary', 'authorization, accept');
response.end(JSON.stringify(request.url.includes('/registry?') ? metadata : document));
});
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
try {
const client = new BaseRegistryClient({baseUrl: `http://127.0.0.1:${server.address().port}/tenant/`});
assert.equal(typeof client.addProposalAddition, 'function');
assert.equal(typeof client.downloadProposalAddition, 'function');
const contract = await client.registryContract('writer');
const prior = await client.getProposal(contract.selectProposalGet('writer'), id);
const before = requests.length;
await assert.rejects(client.addProposalAddition(prior, 'other', 'application/pdf', bytes, 'refused'), error => error.kind === 'invalid-request');
assert.equal(requests.length, before);
const added = await client.addProposalAddition(prior, 'other', 'text/plain', bytes, 'addition-one');
assert.equal(JSON.parse(added.documentJson).submissionVersion, 1);
assert.deepEqual((await client.downloadProposalAddition(added, file)).body, bytes);
const upload = requests[before];
assert.equal(upload.method, 'POST'); assert.equal(upload.headers['if-match'], '"condition"');
assert.equal(upload.headers['idempotency-key'], 'addition-one'); assert.deepEqual(upload.body, bytes);
assert.equal(upload.url, `/tenant/v1/proposals/${id}/additions/other?accessProfile=writer`);
const slot = document.additions.other;
slot.maximumCount = 1;
slot.items.push({...slot.items[0], id: '00000000-0000-4000-8000-000000000003', links: {}});
slot.links.add.availability = {available: false, observedRevision: document.revision, reason: 'limit-reached', recovery: 'receipt-only'};
const retained = await client.getProposal(contract.selectProposalGet('writer'), id);
assert.equal(JSON.parse(retained.documentJson).additions.other.items.length, 2);
assert.deepEqual((await client.downloadProposalAddition(retained, file)).body, bytes);
} finally { await new Promise(resolve => server.close(resolve)); }
});
55 changes: 55 additions & 0 deletions crates/registry-breg-client-node/__test__/asks.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'use strict';
const assert = require('node:assert/strict');
const http = require('node:http');
const { test } = require('node:test');
const { BaseRegistryClient } = require('..');

test('answers use the promoted ask link, exact body, ETag and caller key', async () => {
const id = '00000000-0000-4000-8000-000000000001';
const ask = '00000000-0000-4000-8000-000000000007';
const digest = `sha256:${'a'.repeat(64)}`;
const metadata = {id: 'asks', version: '1', revision: digest, metadataVersion: '2', recordTypes: [], operations: [], actions: [],
proposals: {actions: [{actionId: 'correct', accessProfile: 'author', operations: ['get', 'answer'], readableInputs: [], readableContextFields: []}],
get: {method: 'GET', path: '/v1/proposals/{proposal_id}', accessProfiles: ['author']}}};
const document = {id, actionId: 'correct', actionRevision: digest, submissionVersion: 1, revision: 2, state: 'submitted', effectDigest: digest, links: {},
asks: [{id: ask, text: 'Why?', wants: [{kind: 'answer'}], askedAt: '2026-11-27T00:00:00Z', state: 'open', links: {
answer: {method: 'POST', path: `/v1/proposals/${id}/asks/${ask}/answer`, accessProfile: 'author', operation: 'answer', ifMatch: '"condition"', availability: {available: true, observedRevision: 2}}}}]};
const requests = [];
const server = http.createServer(async (request, response) => {
const chunks = []; for await (const chunk of request) chunks.push(chunk);
requests.push({method: request.method, url: request.url, headers: request.headers, body: Buffer.concat(chunks)});
response.setHeader('traceparent', '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01');
response.setHeader('cache-control', 'no-store'); response.setHeader('content-type', 'application/json'); response.setHeader('vary', 'authorization, accept');
if (request.method === 'POST') {
document.revision = 3; document.asks[0].state = 'answered';
document.asks[0].answer = {...JSON.parse(requests.at(-1).body), additions: [], answeredAt: '2026-11-27T01:00:00Z'};
document.asks[0].links.answer.availability = {available: false, observedRevision: 3, reason: 'ask-answered', recovery: 'receipt-only'};
response.setHeader('etag', `"breg-v1-${'c'.repeat(64)}"`);
}
response.end(JSON.stringify(request.url.includes('/registry?') ? metadata : document));
});
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
try {
const client = new BaseRegistryClient({baseUrl: `http://127.0.0.1:${server.address().port}/tenant/`});
assert.equal(typeof client.answerProposalAsk, 'function');
const contract = await client.registryContract('author');
const prior = await client.getProposal(contract.selectProposalGet('author'), id);
const before = requests.length;
await assert.rejects(client.answerProposalAsk(prior, ask, {text: ' '}, 'invalid'), error => error.kind === 'invalid-request');
assert.equal(requests.length, before);
document.asks[0].wants = [];
const withoutWants = await client.getProposal(contract.selectProposalGet('author'), id);
const beforeEmpty = requests.length;
for (const body of [{}, {additions: []}]) {
await assert.rejects(client.answerProposalAsk(withoutWants, ask, body, 'empty'), error => error.kind === 'invalid-request');
}
assert.equal(requests.length, beforeEmpty);
document.asks[0].wants = [{kind: 'answer'}];
const answered = await client.answerProposalAsk(prior, ask, {text: 'The explanation'}, 'answer-one');
assert.equal(JSON.parse(answered.documentJson).asks[0].answer.text, 'The explanation');
const wire = requests.at(-1);
assert.equal(wire.url, `/tenant/v1/proposals/${id}/asks/${ask}/answer?accessProfile=author`);
assert.equal(wire.headers['if-match'], '"condition"'); assert.equal(wire.headers['idempotency-key'], 'answer-one');
assert.deepEqual(JSON.parse(wire.body), {text: 'The explanation'});
} finally { await new Promise(resolve => server.close(resolve)); }
});
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ test('a write boundary refusal uses the core problem projection without detail l
});
});


test('unknown problem codes fall back to HTTP status semantics', async () => {
const client = new BaseRegistryClient({ baseUrl });
for (const [recordId, status] of UNKNOWN_PROBLEM_STATUSES) {
Expand Down
13 changes: 13 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 @@ -13,6 +13,7 @@ import {
BRegRecoveredAction,
BRegRecoveredCreate,
BRegProposal,
BRegProposalDocument,
BRegProposalGetBinding,
BRegProposalCollection,
BRegPreparedProposal,
Expand All @@ -32,6 +33,18 @@ import {
} from '..'

declare const client: BaseRegistryClient
declare const additionProposal: BRegProposal
declare const additionDocument: BRegProposalDocument
const proposalStatus: import('..').BRegProposalStatus | undefined = additionDocument.status
void proposalStatus
// @ts-expect-error The served status vocabulary is closed.
const invalidProposalStatus: import('..').BRegProposalStatus = 'queued'
void invalidProposalStatus
client.addProposalAddition(additionProposal, 'other', 'text/plain', Buffer.from('support'), 'addition-one')
client.downloadProposalAddition(additionProposal, '00000000-0000-4000-8000-000000000002')
additionDocument.additions?.other?.items[0]?.addedAt.toUpperCase()
// @ts-expect-error Added file bytes use Buffer rather than a JSON string.
client.addProposalAddition(additionProposal, 'other', 'text/plain', 'support', 'addition-one')
new BaseRegistryClient({
baseUrl: 'https://registry.example.test/',
maximumResponseBytes: 8 * 1024 * 1024,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const statusDocument = state => {
test('Proposal response boundaries preserve disclosure and exact Action revision bindings', async t => {
let value = document();
let replyStatus = 200;
let replyContentType = 'application/json';
let downloadBytes;
const requests = [];
const wireRequests = [];
Expand All @@ -46,7 +47,7 @@ test('Proposal response boundaries preserve disclosure and exact Action revision
response.end(downloadBytes);
return;
}
response.writeHead(replyStatus, {'content-type': 'application/json', 'cache-control': 'no-store', 'vary': 'authorization, accept',
response.writeHead(replyStatus, {'content-type': replyContentType, 'cache-control': 'no-store', 'vary': 'authorization, accept',
traceparent: '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01'});
response.end(JSON.stringify(request.url.startsWith('/v1/registry') ? metadata : value));
});
Expand Down Expand Up @@ -96,6 +97,45 @@ test('Proposal response boundaries preserve disclosure and exact Action revision
}
});

await t.test('application refusals preserve Rebase and Revise recovery', async () => {
for (const [reason, recovery] of [['stale-revision', 'rebase'], ['invalid-input', 'revise']]) {
value = statusDocument('blocked');
Object.assign(value.applicationStatus, {reason: 'application-refused', recovery});
value.links.apply = {method: 'POST', path: `/v1/proposals/${id}/apply`, accessProfile: 'reader', operation: 'apply', ifMatch: '"blocked-condition"',
availability: {available: false, observedRevision: 8, reason, recovery}};
const observed = JSON.parse((await client.getProposal(binding, id)).documentJson);
assert.deepEqual(observed.applicationStatus, value.applicationStatus);
assert.deepEqual(observed.links.apply.availability, value.links.apply.availability);
}
});

await t.test('Submit attachment problems preserve only their slot location', async () => {
value = document(); value.state = 'draft'; delete value.application; delete value.effectDigest;
value.links.submit = {method: 'POST', path: `/v1/proposals/${id}/submit`, accessProfile: 'reader',
operation: 'submit', ifMatch: '"attachment-condition"'};
const draft = await client.getProposal(binding, id);
try {
for (const [code, status, detail] of [
['attachment.required', 422, 'The required attachment slot is empty.'],
['attachment.verification-pending', 409, 'The attachment is awaiting verification. Refresh the Proposal before submitting.'],
['attachment.verification-rejected', 422, 'The attachment was rejected by verification. Replace or remove the file before submitting.'],
]) {
const attempt = client.prepareProposal(draft, 'submit', {}, `attachment-${code}`);
replyStatus = status; replyContentType = 'application/problem+json';
value = {type: `https://id.registrystack.org/problems/registry-breg/${code.replaceAll('.', '/')}`,
title: status === 409 ? 'Conflict' : 'Unprocessable Entity', status, detail, code,
traceId: '4bf92f3577b34da6a3ce929d0e0e4736', fieldPath: '/attachments/support'};
await assert.rejects(client.executeProposal(attempt), error => {
assert.equal(error.kind, 'problem'); assert.equal(error.code, code);
assert.equal(error.status, status); assert.equal(error.fieldPath, '/attachments/support');
assert.equal(error.outcomeUnknown, false); return true;
});
assert.equal(wireRequests.at(-1).method, 'POST');
assert.match(wireRequests.at(-1).url, /\/submit\?accessProfile=reader$/);
}
} finally { replyStatus = 200; replyContentType = 'application/json'; }
});

value = document();
value.application.resultLinks = [];
assert.deepEqual(JSON.parse((await client.getProposal(binding, id)).documentJson).application.resultLinks, []);
Expand Down
39 changes: 39 additions & 0 deletions crates/registry-breg-client-node/__test__/proposals.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,45 @@ const proposal = {id, actionId: 'correct', actionRevision: revision, submissionV
submit: {method: 'POST', path: `/v1/proposals/${id}/submit`, accessProfile: 'author', operation: 'submit', ifMatch: '"draft-condition"'},
}};

test('Proposal status is a closed served value and application-pending requires refresh', async () => {
let document = proposal;
const server = http.createServer((request, response) => {
response.setHeader('content-type', 'application/json');
response.setHeader('cache-control', 'no-store');
response.setHeader('vary', 'authorization, accept');
response.setHeader('traceparent', '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01');
response.end(JSON.stringify(request.url.includes('/registry') ? metadata : document));
});
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
try {
const client = new BaseRegistryClient({baseUrl: `http://127.0.0.1:${server.address().port}/`});
const binding = (await client.registryContract('author')).selectProposalGet('author');
for (const [status, state, turn] of [
['draft', 'draft', 'party'], ['awaiting-party', 'submitted', 'party'],
['in-review', 'submitted', 'official'], ['approved', 'submitted', 'official'],
['processing', 'submitted', 'nobody'], ['applied', 'applied', 'nobody'],
['rejected', 'rejected', 'nobody'], ['cancelled', 'cancelled', 'nobody'],
]) {
document = {...proposal, state, status, turn, links: {self: proposal.links.self}};
if (state === 'submitted') document.effectDigest = revision;
assert.equal(JSON.parse((await client.getProposal(binding, id)).documentJson).status, status);
}
document = {...proposal, state: 'submitted', status: 'approved', turn: 'official', effectDigest: revision, links: {
self: proposal.links.self, revise: {method: 'POST', path: `/v1/proposals/${id}/revise`, accessProfile: 'author', operation: 'revise',
ifMatch: '"condition"', availability: {available: false, observedRevision: 1, reason: 'application-pending', recovery: 'refresh'}},
}};
assert.equal(JSON.parse((await client.getProposal(binding, id)).documentJson).links.revise.availability.reason, 'application-pending');
document.links.revise.availability.recovery = 'retry';
await assert.rejects(client.getProposal(binding, id), error => error.kind === 'invalid-request');
for (const status of ['unknown', null, false, 1]) {
document = {...proposal, status};
await assert.rejects(client.getProposal(binding, id), error => error.kind === 'invalid-request');
}
document = proposal;
assert.equal(JSON.parse((await client.getProposal(binding, id)).documentJson).status, undefined);
} finally { await new Promise(resolve => server.close(resolve)); }
});

test('proposal object methods preserve exact bodies and refuse JSON strings before I/O', async () => {
const requests = [];
const server = http.createServer(async (request, response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ test('review-only binding reads context and exact document without Proposal Get'
const binding = contract.selectProposalReviewContext('reviewer', 'correct');
assert.ok(binding instanceof BRegProposalReviewBinding);
const observed = (await client.readProposalReviewById(binding, id)).value;
assert.equal(new URL(requests.at(-1), 'http://local').searchParams.get('include'), 'answers');
const batch = await client.readProposalReviewContextBatch(binding, [id, concealedId]);
assert.deepEqual(batch.value, [observed, null]);
const batchUrl = new URL(requests.at(-1), 'http://local');
assert.equal(batchUrl.pathname, '/tenant/v1/proposals/review-context');
assert.equal(batchUrl.searchParams.get('ids'), `${id},${concealedId}`);
assert.equal(batchUrl.searchParams.get('accessProfile'), 'reviewer');
assert.equal(batchUrl.searchParams.has('include'), false);
const beforeBatchRefusals = requests.length;
for (const ids of [[], [id, id]]) {
await assert.rejects(client.readProposalReviewContextBatch(binding, ids), error => error.kind === 'invalid-request');
Expand Down
Loading