Skip to content

Commit 4a3db01

Browse files
committed
test(runtime): pin the MCP resume door for a run of a disabled holder's slot
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cx5ZPCyTk8ckTsx4ut
1 parent 1e495c2 commit 4a3db01

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎packages/runtime/src/mcp-resume-run.test.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,38 @@ describe('MCP resumeRun — a run of a flow name two namespaces hold (ADR-0150 D
863863
expect(hr.engine.resume).not.toHaveBeenCalled();
864864
});
865865

866+
/**
867+
* [ADR-0150 D3, #33386; seat ruling 6884403301, amendments 3 and 4] CRM
868+
* disabled: a run filed under CRM's slot key is no served holder's. CRM's
869+
* own action reaches no flow (a disabled caller's own holding answers
870+
* none), so it cannot resume CRM's run; HR's action reaches HR's flow,
871+
* never CRM's run. HR's run is still resumed through HR's own action.
872+
*/
873+
const withCrmDisabled = {
874+
...registry,
875+
isPackageDisabled: (id: string) => id === CRM,
876+
// The registry's served read: a disabled package holds no name, but the caller's own holding stays.
877+
packageScopedHoldersOf: (type: string, name: string, caller?: string | null, read?: { includeDisabledPackages?: boolean }) =>
878+
registry.packageScopedHoldersOf(type, name).filter((id) => read?.includeDisabledPackages === true || id === caller || id !== CRM),
879+
};
880+
it('[#33386] CRM disabled: CRM\'s paused run is resumed by no action (FROM: CRM\'s own action resumed it), and stays parked', async () => {
881+
for (const objectPackage of [CRM, HR]) {
882+
const h = makeHarness({ actions: [SCHEDULE], objectPackage, registry: withCrmDisabled });
883+
const runId = parkedRunOf(h, CRM);
884+
const refusal = await refusalOf(h.bridgeFor('u1').resumeRun(runId, { values: { subject: 'Call back' } }));
885+
expect(refusal.status, objectPackage).toBe(403);
886+
expect([h.engine.resume.mock.calls.length, h.engine.runs.get(runId)?.status], objectPackage).toEqual([0, 'paused']);
887+
}
888+
});
889+
890+
it('[#33386] CONTROL — CRM disabled: HR\'s paused run is resumed through HR\'s own action, as before', async () => {
891+
const h = makeHarness({ actions: [SCHEDULE], objectPackage: HR, registry: withCrmDisabled });
892+
const runId = parkedRunOf(h, HR);
893+
const resumed = await h.bridgeFor('u1').resumeRun(runId, { values: { subject: 'Call back' } });
894+
expect(resumed).toMatchObject({ ok: true, action: SCHEDULE.name });
895+
expect(h.engine.resume.mock.calls.map((c: unknown[]) => c[0])).toEqual([runId]);
896+
});
897+
866898
for (const [filed, what] of [[[], 'no holder\'s slot'], [[CRM, HR], 'both holders\' slots (CONTROL)']] as const) {
867899
it(`[R3-B] a run under a key ${what} is filed under is refused 409 naming every holder, and stays parked`, async () => {
868900
const h = makeHarness({ actions: [SCHEDULE], objectPackage: CRM, registry });

0 commit comments

Comments
 (0)