feat(user-manager-client): stateful sub-workspace lifecycle mock handlers (LLMO-5616)#1708
Open
byteclimber wants to merge 1 commit into
Open
Conversation
…lers (LLMO-5616)
The sub-workspace provisioning chain used by api-service's market-mirror flow
fell back to auto-generated random stubs, so the provisioning poll never
reliably read the success state and creation hung/failed against the mock:
- POST /v2/workspaces/{id}/child (random id)
- GET /v1/workspaces/{id}/status (random status)
- POST /v2/workspaces/{id}/resources/transfer (random 200)
Make them stateful via the existing $.context pattern:
- _.context.ts: getStatus (terminal "created" — the value the api-service
transport polls for, per the merged overlay CR2; not "ready"), a seedable
"not ready" -> "created" sequence, setStatusSequence, and transferResources
- v2 child / v1 status / v2 transfer: random stubs -> stateful handlers
- __set-status-sequence: non-spec control route to drive the poll path in tests
- mock.test.js: E2E coverage for the create -> status -> transfer chain,
the poll sequence, and the negative (missing-workspace) paths
Closes #1700
Co-Authored-By: Claude Opus 4.8 <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.
What
Makes the sub-workspace provisioning lifecycle stateful and deterministic in the User Manager Counterfact mock. The three endpoints
spacecat-api-service's market-mirror provisioning calls were still auto-generated random stubs, so the provisioning poll never reliably read the success state and sub-workspace creation hung/failed against the mock:POST /v2/workspaces/{id}/child— random idGET /v1/workspaces/{id}/status— random statusPOST /v2/workspaces/{id}/resources/transfer— random 200How
Hand-authored stateful handlers delegating to
$.context(mirroring the existingv1/workspaces/{id}/childpattern), surviving Counterfact regeneration (append-don't-clobber on existing route files):_.context.ts—getStatus(terminalcreated; seedablenot ready→createdsequence),setStatusSequence,transferResources;statusSequencesre-seeded onreset().v2 child/v1 status/v2 transfer— random stubs → stateful.__set-status-sequence— non-spec control route (like__reset) to drive the poll path deterministically.mock.test.js— E2E for the fullcreate → status → transferchain, the poll sequence, and missing-workspace paths.Notes
created, notready. That's the value the api-service transport polls for, per the merged overlay's CR2 (status.status === 'created');readyisn't in theWorkspaceCheckResponseenum.familyor add a transfer balance guard — both would bake unvalidated behavior into the mock (the consumer path isn't live-validated yet).feat/llmo-5616-user-manager-mock), since the mock infrastructure isn't onmainyet. Will retarget tomainonce feat(user-manager-client): stateful Counterfact mock with seed/reset + E2E (LLMO-5616) #1685 merges.main.Validation
npm test -w packages/spacecat-shared-user-manager-client— 30 passing (8 new), 100% coverage.npm run lint -w packages/spacecat-shared-user-manager-client— clean.Closes #1700
🤖 Generated with Claude Code