Rocko's round 2 candidate, approved by Darkwing (#1519 comment 26757).
build.patch 40d7e838, manifest 61519059, 24 files under packages/bus,
schema v3b (179ffe35, lead decision 60). Integration gate in a git
worktree of 942dca9e (S1 in the tree) plus the patch: bus 43/43 and
business 60/60 on Node 24 and 26, every package test and every
scripts/test-*.sh green, test-task 98/98 with the live-provider cases.
Rulings from lead decisions 62 and 63: the human proof is cooperative in
slice 1, and a self-raised cross-role decision routes to the human.
Single-use gated approvals follow in row 43.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
29 lines
1010 B
JavaScript
29 lines
1010 B
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { busBusiness } from '../src/business.mjs';
|
|
test('S1 adapter takes resolved limits and refs, rejects mismatched instance, never mutates input', () => {
|
|
const business = {
|
|
id: 'demo',
|
|
human: 'jason',
|
|
roles: {
|
|
coder: { definition: 'coder', credentials: { gitea: { file: '/unused', rotateBy: '2099-01-01' } } },
|
|
},
|
|
};
|
|
const resolved = {
|
|
coder: {
|
|
business: 'demo',
|
|
instance: 'coder',
|
|
definition: 'coder',
|
|
limits: { authority: { withinRole: ['message.send'], crossRole: [] } },
|
|
credentials: {},
|
|
},
|
|
};
|
|
const before = structuredClone(business),
|
|
b = busBusiness(business, resolved);
|
|
assert.deepEqual(b.roles.coder.authority, resolved.coder.limits.authority);
|
|
assert.deepEqual(b.roles.coder.credentials, {});
|
|
assert.deepEqual(business, before);
|
|
resolved.coder.instance = 'pm';
|
|
assert.throws(() => busBusiness(business, resolved), /invalid-resolution/);
|
|
});
|