Repository navigation
feat(durable): read and stop executions with the application credential - #357
Merged
Merged
Conversation
Add durable.getFromApplication(functionName, executionId, { clientToken })
and durable.stopFromApplication(...), which call GET and POST stop on
/durable-functions/{functionId}/executions/{executionId} with the
credential durable.start uses: the user's session when there is one,
otherwise the client's key. An anon key, or a user who did not start the
execution, sends the start's client_token as X-Volcano-Client-Token.
Both answer the DurableExecution envelope that get and stop do.
Sync openapi/openapi.yaml from the public bundle of
Kong/volcano-hosting#2364 (6377c22be0), which adds the two routes, add
them to the orval allowlist, and regenerate. Docs, doc comments, and the
order pipeline example no longer say that reading or stopping an
execution needs the owner's token.
Vendor hosting main's public bundle (1ccff82a16), which Kong/volcano-hosting#2364 shipped, and regenerate the client. A service key now reaches every execution only when it holds `*`. A key scoped without `*` needs the execution's client token, as an anon key does, and only a `*` key reaches a pending execution. Read and stop also answer 503 with Retry-After when reads of the execution's state are throttled; a stop answered that way may already have been sent. Update the Durable doc comments, the durable and error-handling guides, and the order pipeline example to say so, and pin that a service key sends the client token and that a throttled 503 surfaces `error.retryAfter`.
AI review: no P0-P2 findingsAdds ⚪ P3
Not checked: The AI review read the diff, the code, and the PR's text; it ran no tests or builds and read nothing outside this repository.
Human review: not needed |
The full bundle sync renamed Autofix to LavaFlow and removed those keys from the exported OpenAPIOperations and OpenAPIComponents types, a break this additive release must not carry. The chore/sync-openapi PR owns the full sync. Start from main's snapshot and take from hosting main 1ccff82a16 every /durable-functions, /durable-callbacks, and project durable path, every Durable* component, and the service key scope note on client tokens, so those sections match hosting main exactly. Regenerate the client. List getFromApplication and stopFromApplication among the methods that resolve with DurableExecution in the TypeScript guide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracking
Tracks: volcano-hosting#2364, the server support for reading and stopping an execution with the start's credentials. Coordination branch:
skeever/durable-execution-data-plane, the same name in Hosting, Python, and Ruby.volcano-hosting#2364 merged as
29807384cf, so the server support ships before this SDK release.Summary
{ data, status, error }envelope with aDurableExecution, asgetandstopdo:volcano.durable.getFromApplication(functionName, executionId, { clientToken? })callsGET /durable-functions/{functionId}/executions/{executionId}.volcano.durable.stopFromApplication(functionName, executionId, { clientToken? })callsPOST /durable-functions/{functionId}/executions/{executionId}/stop.startsends: the user's session when there is one, otherwise the client's key.clientTokengoes out asX-Volcano-Client-Tokenwith every credential, a service key included, and no header is sent without one. A service key holding*reaches any execution; one scoped to a list without*needs the client token, as an anon key does. The SDK checks the function name, the execution id, and the token locally, with the rulesdurable.messagesalready applies, and refuses a bad value withstatus: null.startand the new methods choose their credential in one shared helper. Owner-scopedget,list, andstopare unchanged.openapi/openapi.yamlismain's snapshot with Hosting's durable sections taken from its public bundle atmain1ccff82a16, after volcano-hosting#2364 merged (built withscripts/ci/openapi-bundle.sh, byte-identical to that commit'sdocs/public/api-reference/openapi.yaml). Every/durable-functions,/durable-callbacks, and project durable-function path, everyDurable*component, and the service key scope note on client tokens match that bundle exactly; nothing else changes. The full bundle would also rename Autofix to LavaFlow and drop those keys from the exportedOpenAPIOperationsandOpenAPIComponentstypes, which an additive release must not carry;chore/sync-openapi(chore(api): sync OpenAPI contract #352) owns the full sync. The two operations are added to the orval allowlist, and the client is regenerated withpnpm generate:openapi.docs/durable-functions.mdgains "Reading and stopping from the application".docs/error-handling.md, theDurabledoc comments, and the order pipeline example no longer say that reading or stopping needs the owner's token.*reaches every execution, including apendingone; a scoped key needsclientToken; and a throttled read or stop answers503witherror.retryAfter, after which a stop may already have been sent.docs/typescript.mdlists both methods among those that resolve withDurableExecution.test/types/openapi-contract-durable.tspins both routes, so a sync from a Hostingmainwithout them fails.Verification
On
3001ca0, under Node 26.0.0 (Node 22.23.3 from.node-versionis not installed on this machine; CI runs it):pnpm check:openapi: the regenerated client matches the commit.pnpm lintandpnpm check:unusedpnpm test: 219 suites, 3,399 tests. The new__tests__/durable-executions-application.test.tscovers:X-Volcano-Client-Tokenwhen a token is given, with an anon key, a session, or a service key, and no header when none is;503withRetry-Aftersurfacingerror.retryAfter, against transport doubles and over a mockedfetch.pnpm test:types, including the published-API fixture (public-api-compatibility.d.ts), pluspnpm test:typed-runtimepnpm quality:policyandpnpm run auditpnpm test:packageandpnpm test:quickstartMUTATION_BASE=origin/main pnpm mutation:full: not rerun to completion locally. The runtime files are unchanged since 9d27d64, where Stryker killed all 248 mutants (durable-facade.ts193,volcano-auth-config.ts45,volcano-auth-facades.ts10). CI's 32 mutation shards passed ond760f30.pnpm test:tooling: 116 of 117 pass. "native reporter preserves cancelled case" times out under Node 26. That fixture's never-settling test, and the tooling, are unchanged here, so the Node 22 CI job decides it.Left to CI:
pnpm test:examples, which this change does not touch.Cross-language impact
Classify this change: public facade / wire contract
tests/sdk-contractrequirement or scenario for these reads and stops. A follow-up should add one, for example a client token reaching its execution and an anon key without one getting404.get_from_application/stop_from_application) and Ruby are in progress on the same branch name,skeever/durable-execution-data-plane.docs/durable-functions.mdanddocs/error-handling.md.docs/public/functions/durable-functions.mdin #2364.Coordination
Companion PRs, all on
skeever/durable-execution-data-plane: #357, Kong/volcano-sdk-python#422, Kong/volcano-sdk-ruby#366.Merge order:
tests/sdk-contractscenarios for both routes.🤖 Generated with Claude Code