Skip to content

Commit 99fca26

Browse files
committed
test(runtime): pin the definition writes and the MCP resume under a disabled holder; changeset names the deferred trigger binding and no migration
The changeset's "Not moved" claimed every definition write keeps a 409 naming every holder. At an address naming the disabled holder, at _env and at a third namespace the write is refused naming the served holder only, and with both holders disabled an address answers 404. The text now says so, and one pin measures it over a real SchemaRegistry in both registration orders, with HR's own address still naming both. A second pin measures that a package-less flow action and one from a package depending on both holders resume the served holder's parked run. The changeset declares amendment 3's trigger binding deferred and states in visible text that no migration is needed. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cx5ZPCyTk8ckTsx4ut
1 parent 9bb45bb commit 99fca26

3 files changed

Lines changed: 56 additions & 3 deletions

File tree

‎.changeset/33386-flow-doors-served-holders.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ Metadata-protocol: none
1818
- A package that reaches the name only through CRM ran CRM's flow. It is now refused 409 `outside-closure` naming HR. A package that reaches neither holder is refused naming HR only (before: both).
1919
- An address naming CRM (`/automation/crm/convert/…`, `/automation/trigger/crm/convert`) ran CRM's slot. It is now refused 409 `not-held-by-qualifier` naming HR. `/automation/connectors/crm/mail/connection` reached the service, which answered 404; it is now refused 409 naming HR, and the service is not asked.
2020
- `_env` or another namespace (`/automation/_env/convert/…`, `/automation/connectors/ops/mail/connection`) was refused 409 naming both. It is now refused naming HR only.
21+
- The definition writes (`PUT`, `DELETE`, clone) at an address naming CRM, at `_env` or at a third namespace were refused 409 naming both. They are now refused 409 naming HR only. With both disabled, such a write at an address answers 404.
2122
- With CRM and HR both disabled, no door and no run reaches a flow. An address answers 404. The bare name and `_env` answer as for a flow the engine does not hold.
2223

23-
**Not moved.** HR's own address and HR's own callers answer as before. The durable coordinates stay judged over every holder, served or not: the engine's slot keys, a run's key, the schedule dispatch key (`flowDispatchHolder`), the credential channel's scoping, the subflow guards' arming verdicts, and which slot a run row is filed under. A disable is reversible, so it re-points no slot. A run filed under CRM's slot key is no served holder's: the run doors answer it as a run nobody holds, and it is never read or acted on as HR's. A definition write (`PUT`/`DELETE`, clone) of the shared name keeps its 409 naming every holder. A name only one package holds is judged as before.
24+
**Not moved.** HR's own address and HR's own callers answer as before. The durable coordinates stay judged over every holder, served or not: the engine's slot keys, a run's key, the schedule dispatch key (`flowDispatchHolder`), the credential channel's scoping, the subflow guards' arming verdicts, and which slot a run row is filed under. A disable is reversible, so it re-points no slot. A run filed under CRM's slot key is no served holder's: the run doors answer it as a run nobody holds, and it is never read or acted on as HR's. A definition write (`PUT`, `DELETE`, clone) at HR's own address keeps its 409 naming every holder; a bare definition write is refused by the metadata store over its stored rows, as before. A name only one package holds is judged as before.
25+
26+
**Deferred:** amendment 3's trigger binding (a runtime-disabled holder's trigger still fires its slot, as on main) → #33748.
27+
28+
**No migration.** No schema key, stored row, slot key, run key or dispatch key changes, so there is nothing to rewrite: the answers that move follow a reversible package state.
2429

2530
The fix for a caller: re-enable the package, or address the served holder by its namespace.

‎packages/runtime/src/domains/automation-addressed-route.test.ts‎

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,8 @@ describe('[#33386] the by-name doors judge the served holders of a name two pack
541541
const resolve = (name: string) => services[name];
542542
const kernel: any = { getService: resolve, getServiceAsync: async (name: string) => resolve(name), context: { getService: resolve } };
543543
const dispatcher = new HttpDispatcher(kernel);
544-
const call = async (path: string, method: string) => {
545-
const answered = await dispatcher.handleAutomation(path, method, {}, { request: {}, executionContext: ADMIN } as any, {});
544+
const call = async (path: string, method: string, body: unknown = {}) => {
545+
const answered = await dispatcher.handleAutomation(path, method, body, { request: {}, executionContext: ADMIN } as any, {});
546546
return { status: answered.response?.status ?? 200, body: answered.response?.body as any };
547547
};
548548
return { call, automation };
@@ -594,6 +594,35 @@ describe('[#33386] the by-name doors judge the served holders of a name two pack
594594
expect(automation.getConnectorConnection).toHaveBeenCalledTimes(2);
595595
});
596596

597+
it('the definition writes (PUT, DELETE, clone) under a disable: an address naming CRM, `_env` or a third namespace is refused naming HR only (FROM: naming both); HR\'s address still names both; both disabled, an address answers 404 (FROM: 409)', async () => {
598+
const writes = (prefix: string) => [
599+
[`${prefix}/convert`, 'PUT', { name: 'convert', type: 'autolaunched' }],
600+
[`${prefix}/convert`, 'DELETE', {}],
601+
[`${prefix}/convert/clone`, 'POST', { name: 'convert_copy' }],
602+
] as const;
603+
const oneOff = dispatcherOver(registryOf(order, [CRM]));
604+
for (const prefix of ['/crm', '/_env', '/ops']) {
605+
for (const [path, method, body] of writes(prefix)) {
606+
const answer = await oneOff.call(path, method, body);
607+
expect([path, method, answer.status, codeOf(answer), packagesOf(answer)]).toEqual([path, method, 409, 'RESOURCE_CONFLICT', [HR]]);
608+
}
609+
}
610+
// Not moved: HR's own address keeps the 409 naming every holder.
611+
for (const prefix of ['/hr']) {
612+
for (const [path, method, body] of writes(prefix)) {
613+
const answer = await oneOff.call(path, method, body);
614+
expect([path, method, answer.status, packagesOf(answer).sort()]).toEqual([path, method, 409, [CRM, HR].sort()]);
615+
}
616+
}
617+
const bothOff = dispatcherOver(registryOf(order, [CRM, HR]));
618+
for (const prefix of ['/crm', '/hr']) {
619+
for (const [path, method, body] of writes(prefix)) {
620+
expect([path, method, (await bothOff.call(path, method, body)).status]).toEqual([path, method, 404]);
621+
}
622+
}
623+
for (const h of [oneOff, bothOff]) expect(h.automation.executeSlot).not.toHaveBeenCalled();
624+
});
625+
597626
it('both disabled: no address reaches a flow or an instance (404); the bare door and `_env` reach no slot, and the service answers them with no package', async () => {
598627
const { call, automation } = dispatcherOver(registryOf(order, [CRM, HR]));
599628
for (const path of ['/crm/convert/trigger', '/hr/convert/trigger']) expect((await call(path, 'POST')).status, path).toBe(404);

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,25 @@ describe('MCP resumeRun — a run of a flow name two namespaces hold (ADR-0150 D
895895
expect(h.engine.resume.mock.calls.map((c: unknown[]) => c[0])).toEqual([runId]);
896896
});
897897

898+
it('[#33386] CRM disabled: HR\'s paused run is resumed through a package-less action and through BOTH\'s (depends on CRM and HR) (FROM: 403, the name answered two holders)', async () => {
899+
const BOTH = 'com.both.pkg';
900+
const manifestOf = (id: string) => (id === BOTH
901+
? { id, namespace: 'both', dependencies: { [CRM]: '^1.0.0', [HR]: '^1.0.0' } }
902+
: { id, namespace: id === CRM ? 'crm' : 'hr' });
903+
const withBoth = {
904+
...withCrmDisabled,
905+
getPackage: (id: string) => ({ manifest: manifestOf(id), source: 'code' }),
906+
getAllPackages: () => [CRM, HR, BOTH].map((id) => ({ manifest: manifestOf(id), source: 'code' })),
907+
};
908+
for (const objectPackage of [undefined, BOTH]) {
909+
const h = makeHarness({ actions: [SCHEDULE], ...(objectPackage ? { objectPackage } : {}), registry: withBoth });
910+
const runId = parkedRunOf(h, HR);
911+
const resumed = await h.bridgeFor('u1').resumeRun(runId, { values: { subject: 'Call back' } });
912+
expect(resumed, String(objectPackage)).toMatchObject({ ok: true, action: SCHEDULE.name });
913+
expect(h.engine.resume.mock.calls.map((c: unknown[]) => c[0]), String(objectPackage)).toEqual([runId]);
914+
}
915+
});
916+
898917
for (const [filed, what] of [[[], 'no holder\'s slot'], [[CRM, HR], 'both holders\' slots (CONTROL)']] as const) {
899918
it(`[R3-B] a run under a key ${what} is filed under is refused 409 naming every holder, and stays parked`, async () => {
900919
const h = makeHarness({ actions: [SCHEDULE], objectPackage: CRM, registry });

0 commit comments

Comments
 (0)