Skip to content

feat(user-manager-client): stateful sub-workspace lifecycle mock handlers (LLMO-5616)#1708

Open
byteclimber wants to merge 1 commit into
feat/llmo-5616-user-manager-mockfrom
feat/llmo-5616-subworkspace-lifecycle
Open

feat(user-manager-client): stateful sub-workspace lifecycle mock handlers (LLMO-5616)#1708
byteclimber wants to merge 1 commit into
feat/llmo-5616-user-manager-mockfrom
feat/llmo-5616-subworkspace-lifecycle

Conversation

@byteclimber

Copy link
Copy Markdown
Contributor

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 id
  • GET /v1/workspaces/{id}/status — random status
  • POST /v2/workspaces/{id}/resources/transfer — random 200

How

Hand-authored stateful handlers delegating to $.context (mirroring the existing v1/workspaces/{id}/child pattern), surviving Counterfact regeneration (append-don't-clobber on existing route files):

  • _.context.tsgetStatus (terminal created; seedable not readycreated sequence), setStatusSequence, transferResources; statusSequences re-seeded on reset().
  • 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 full create → status → transfer chain, the poll sequence, and missing-workspace paths.

Notes

Validation

  • npm test -w packages/spacecat-shared-user-manager-client30 passing (8 new), 100% coverage.
  • npm run lint -w packages/spacecat-shared-user-manager-client — clean.

Closes #1700

🤖 Generated with Claude Code

…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>
@rainer-friederich rainer-friederich requested review from MysticatBot and removed request for rainer-friederich June 24, 2026 08:06
@byteclimber byteclimber requested review from MysticatBot and removed request for MysticatBot June 24, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant