Repository navigation
improvement(sim-cli): commands reach the API only through the operations they declare - #8877
Conversation
…ons they declare Hand-written commands called SimClient by path and declared nothing, so the command inventory could not mark one Mothership-unavailable when it calls a refused route. Every command now gets its client from callsOperations: calls name an operation, route and method come from the operation table, and the client is typed to the declared operations.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
All reported issues were addressed across 31 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
mothershipUnavailablewhen Sim refuses a Mothership caller any operation the command calls. About 20 hand-written commands (files upload,tables import,logs follow,workflows runs wait,credentials connect,files ls/mkdir,secrets set,profiles add, …) calledSimClientby path and declared nothing, so the inventory saw them as calling nothing. Consumers that rely only on that flag could show a refused command as runnable.callsOperations(command, ops)(orapiCommand(parent, name, ops)) records the declaration and returnsconnect().connect()hands back anOperationClienttyped to exactly those operations.configureOperation: their own operation, plusgetWorkspaceOperationwhen--waitcan poll a workspace operation. Commands layered onto a generated leaf (workflows run --follow,workflows runs get --select-output) connect through that declaration, typed to the operations they use.runsOperationfolds into the declaration ({ runs }).BuiltRequestcarries path params instead of a pre-resolved path. Upload sessions name their parts, complete and abort operations instead of building paths.clientFromis reached only throughconnect, and a test keeps rawSimClient/clientFromuse confined to the wrappers.profiles addis nowmothershipUnavailable: true. It lists workspaces (GET /api/v2/workspaces), which Mothership is refused. No other undeclared command calls a refused route.GETnow pass it explicitly.loginandlogoutcall the OAuth and device-flow routes, which are not v2 operations, so the inventory cannot describe them.Type of Change
Testing
reference.test.ts:profiles addis flagged Mothership-unavailable. This fails on staging.called-operations.test.ts: an undeclared operation is refused before any request, a declared one is routed and encoded from the table, and no module outside the wrappers builds a raw client.profiles addchanged.packages/sim-cli: type-check and vitest (478 passed). Root:bun run test,bun run lint,bun run type-check,check:audits(58),check:cli-docs,docs-manifest:check, block-registry check.Checklist
test-auditauthoring gate)