feat: idempotency key, the INTERRUPTED phase, and a real-hub skew suite

The hub now takes an idempotency key and reports INTERRUPTED for a run
its process did not survive, so the client exposes both. The real-hub
suite gained the cross-language half of the idempotency guard: a
repeated key has to answer with the first run's outputs, which only a
real hub can prove.

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-10-27 01:32:58 +01:00
parent b6c6cc8295
commit 0db793494d
4 changed files with 39 additions and 2 deletions

View file

@ -111,6 +111,27 @@ describe('client against a real hub', { skip: available ? false : `no hub binary
assert.equal(err.retryable, false);
});
it('answers a repeated idempotency key with the first run', async () => {
// The cross-language half of the idempotency guard: the field has
// to survive this client's encoding and the hub's decoding, which
// the fake hub cannot prove.
const key = `e2e-${Date.now()}`;
const first = await client.submit({
flowYaml: HELLO,
inputs: { name: 'first' },
idempotencyKey: key,
});
const again = await client.submit({
flowYaml: HELLO,
inputs: { name: 'second' },
idempotencyKey: key,
});
assert.equal(again.invocationId, first.invocationId);
// The replay answers with what the first run produced, not with
// the second request's input.
assert.equal(asText(again.outputs.greeting), 'Hello, first');
});
it('refuses a flow whose module is not installed, as not_found', async () => {
const err = (await client
.submit({