feat(compute): add workload revisions and deployment events list commands - #246
Merged
Conversation
…ands
`@flowcore/sdk` 4.7.0 shipped 21 of the 22 compute operations plus the SSE
log stream, but was cut before compute-api 1.11.0 added two read endpoints:
GET /api/v1/workloads/{workloadId}/revisions
GET /api/v1/workloads/{workloadId}/events
`ComputeWorkloadRevisionsListCommand` is cursor-paginated in the shape of the
shipped `ComputeWorkloadRunsListCommand`; `ComputeWorkloadEventsListCommand`
takes no pagination, because the Kubernetes event TTL already bounds the
window and an empty array is a legitimate 200.
`outcome` on a revision is DELIBERATELY optional, not a tolerance: upstream
reports the joined operation's status, `pending` when the named operation has
not reported, and NOTHING AT ALL when the revision names no operation. That
third case is every `created` revision — a create mints no operation — so a
required field would make `parseResponseHelper` throw on revision 1 of every
healthy workload. Pinned by a test.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Completes compute coverage. 4.7.0 shipped 21 of the 22 operations plus the SSE stream, but these two endpoints landed in compute-api 1.11.0, after 4.7.0 was cut:
GET /api/v1/workloads/{workloadId}/revisionsGET /api/v1/workloads/{workloadId}/eventsThe frontend currently declares both as local
Commandsubclasses because the SDK had nothing. Those delete cleanly once this releases.The detail most likely to be got wrong
outcomeis optional on a revision, and it must be:The service reports it at three levels of knowledge — the joined operation's status;
pendingwhen a revision names an operation that has not reported yet; and absent when it names no operation at all. That third case is everycreatedrevision, because a create mints no operation. Requiring the field would makeparseResponseHelperthrow on revision #1 of every workload in existence.A test pins exactly that: a revisions page whose
createdentry carries nooutcome,operationIdorslotTier, asserted withassertEquals(response.revisions[2]?.outcome, undefined).Shapes
Revisions are cursor-paginated —
{ workloadId, limit?, cursor? }in,{ revisions, nextCursor? }out — matching the shipped runs-list command. Both responses are bare, not{ success: true, ... }envelopes.Events take no pagination: the cluster reaps them on roughly an hour's TTL, so the window is bounded by construction. An empty array is a legitimate answer for a healthy, quiet workload, and a test covers it. Each event carries
name,type,reason,message,countandobject { kind, name }, withsource,firstSeenandlastSeenoptional.typestays a plain string because the cluster's field is free-form.Both use
parseResponseHelperwith a TypeBox schema rather than casting the raw response, and map 404 toNotFoundException, like every other command here.Tests
248 → 254, 0 fail. Covers the no-
outcomerevision, cursor round-tripping, events spanning several object kinds including one with nosource, an empty events array, and 404 for both.lint,typecheck,testandbuild(ESM + CJS + DTS) all green.🤖 Generated with Claude Code