refactor(cloud): simplify control-plane logging (M7s)
What and why
A follow-up to #9927 (333fac9c, M7 part 1). That commit was about four times larger than the job (18 files, +1,336 / -205). This PR keeps the same useful outcome and is mostly deletion. Against 333fac9c's parent, the code is now +275 / -35, and the tests are +199 / -20.
packages/trpc/src/lib/control-log.tsis now one 43-line file: aControlEventunion,controlTags, andlogControl. There is no barrel, levels map, sink, capture object,errorClassorlogStepFailed.- 13 events go to Sentry Logs with
log.source = "control",cloud_workspace.id,organization.idand, when there is a boot,boot.id:workspace.failed,boot.refused,boot.authorized,boot.released(with its reason),meter.cap_reached,meter.cap_stopped,workspace.asleep,workspace.awake,wake.failed,wake.completed,workspace.archived,archive.stopped,archive.deleted. Keepalive wakes write nothing. An Autumn refusal is a warning and opens no issue. - The provision and wake transactions keep the
boot.idattribute. Captured exceptions carry the ids as tags, notextra. The three failure sites capture only when the row really moved. - All 26 console lines that 333fac9c replaced are back, word for word. The "runs past its limit" line is written before the stop again, and
meter.cap_stoppedafter it. - Undone: the
settled()closure,bootScope, the third parameter ofcheckOrFailOpen, and theorganizationIdthreading through the sleep and reap helpers.queueProvisionkeeps itsorganizationIdparameter, so a provision that cannot be queued writesworkspace.failedwith both ids. isUsageRefusalis removed.isCloudUsageRefusalin@superset/shared/billingnow reads the key fromdata(what clients get) or fromcause(the server's ownTRPCError).enableLogs: truestays explicit in the API's Sentry config. The evidence page shows the line in@sentry/core10.75.2 where the default is set.
No billing call or status write changed. The verify-sandbox-asleep model check passes.
What breaks, and for whom
Nothing breaks. No tRPC procedure changed. Desktop and mobile get the same result from isCloudUsageRefusal as before. These events are no longer written: workspace.created, workspace.unarchived, provision.*, wake.started, restart.started, boot.attached, boot.adopted, meter.settled, meter.settle_failed, archive.hook_ran, step.failed. They shipped today, so nothing reads them yet.
Links
- Evidence: https://app.superset.sh/page/m7s-simplify-control-plane-logging-55mwoa
- Design: https://app.superset.sh/page/admin-cloud-workspace-cost-and-health-design-8z3d4d
š¤ Generated with Claude Code
Summary by cubic
Follow-up to the larger logging commit: the control-plane event framework is now one small control-log.ts helper (43 lines) with the same behavior at about a third of the size. 13 events still go to Sentry Logs with workspace, organization, and boot ids, and the console lines it replaced are back word for word.
What to know
enableLogs: trueis kept explicit in the API's Sentry config rather than relying on the@sentry/core10.75.2 default.queueProvisiontakes the organization id again, so a provision that cannot be queued writesworkspace.failedwith both ids and tags its capture with both.workspace.created,provision.*,wake.started,restart.started,boot.attached,boot.adopted,meter.settled,meter.settle_failed,archive.hook_ran, andstep.failedare no longer written; nothing reads them yet.- Captured exceptions only fire when the status row actually moved, and carry ids as tags instead of
extra. isCloudUsageRefusalnow reads the key fromdata(clients) orcause(server);isUsageRefusalis gone.
No billing call, status write, or tRPC procedure changed.