[Refactor] Rename CloudJob/CloudTask vocabulary to Run/Task - #81
Merged
Conversation
Deletes the TODO(stage5-rename) type-only aliases in packages/db/src/types.ts (CloudJob, CreateCloudJob, UpdateCloudJob, CloudJobEvent, CreateCloudJobEvent) and migrates all usages to Run/CreateRun/UpdateRun/RunEvent/CreateRunEvent. Type-only rename, zero runtime behavior change.
packages/types/src/cloud-jobs.ts vocabulary pass (zero runtime change): - CloudTaskStatus -> RunStatus (enum member names + string values unchanged) - CloudTaskPayload -> TaskPayload - CloudTask (z.infer union) -> TaskSpec (avoids collision with db Task type) - cloudTaskSchema -> taskSpecSchema - CloudTaskWorkspace(Payload)/resolveCloudTaskWorkspace -> TaskWorkspace(Payload)/resolveTaskWorkspace - CloudTaskLaunchClass/CLOUD_TASK_LAUNCH_CLASSES -> RunLaunchClass/RUN_LAUNCH_CLASSES - CloudJobEventSource/Type/Details -> RunEventSource/Type/Details - cloudJobEventSources/Types -> runEventSources/Types - isResumableCloudTaskType -> isResumableTaskPayloadKind - isServicesEnabledCloudTaskType -> isServicesEnabledTaskPayloadKind - stripCloudJobErrorMarkers -> stripRunErrorMarkers - booting/active/exited/done/runningCloudTaskStatuses -> *RunStatuses - isBooting/isRunning/isExitedCloudTaskStatus -> isBooting/isRunning/isExitedRunStatus - isActivelyRunningCloudTask -> isActivelyRunningTask - isCloudTaskExecutingTurn -> isTaskExecutingTurn
…eTask Function/variable vocabulary in shared packages (zero runtime change): - finishCloudJob -> finishRun (+ mockFinishCloudJob -> mockFinishRun) - enqueueCloudTask -> enqueueTask (+ EnqueueCloudTaskInput/Options, enqueueCloudTaskInputSchema, enqueue/mock helpers) - git mv finish-cloud-job.ts -> finish-run.ts (+ test) - git mv enqueue-cloud-task.test.ts -> enqueue-task.test.ts Log-prefix strings updated to match; no wire/DB/Redis field changes.
Contributor
|
No code issues found. See task |
mrubens
marked this pull request as ready for review
July 10, 2026 13:57
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.
Summary
Completes the deferred Stage 5 CloudJob → Run TypeScript vocabulary rename that PR #45 intentionally postponed. The data model was already renamed at the DB layer (
cloud_jobs→task_runs); this makes the code vocabulary match: a run is an execution attempt of a task.Pure type/identifier rename — zero runtime behavior change. No DB, wire, env var, or Redis changes. Enum member names and all runtime string values (DB values, wire formats, Redis keys) are unchanged.
Rename mapping
Scope 1 — db type aliases (deleted the
TODO(stage5-rename)aliases inpackages/db/src/types.ts)CloudJobRunCreateCloudJobCreateRunUpdateCloudJobUpdateRunCloudJobEventRunEventCreateCloudJobEventCreateRunEventScope 2 —
packages/types/src/cloud-jobs.tsvocabularyCloudTaskStatus(enum)RunStatus(members + string values unchanged)CloudTaskPayloadTaskPayloadCloudTask(z.infer union)TaskSpec¹cloudTaskSchemataskSpecSchemaCloudTaskWorkspace/CloudTaskWorkspacePayload/resolveCloudTaskWorkspaceTaskWorkspace/TaskWorkspacePayload/resolveTaskWorkspaceCloudTaskLaunchClass/CLOUD_TASK_LAUNCH_CLASSESRunLaunchClass/RUN_LAUNCH_CLASSESCloudJobEventSource/Type/DetailsRunEventSource/Type/DetailscloudJobEventSources/cloudJobEventTypesrunEventSources/runEventTypesisResumableCloudTaskTypeisResumableTaskPayloadKindisServicesEnabledCloudTaskTypeisServicesEnabledTaskPayloadKindstripCloudJobErrorMarkersstripRunErrorMarkersbooting/active/exited/done/runningCloudTaskStatuses*RunStatusesisBooting/isRunning/isExitedCloudTaskStatusisBooting/isRunning/isExitedRunStatusisActivelyRunningCloudTaskisActivelyRunningTaskisCloudTaskExecutingTurnisTaskExecutingTurn¹
CloudTask→Taskcollides with the existingTaskdb type ($inferSelectof thetaskstable), so the z.infer union was renamed toTaskSpecinstead. One consistent name used throughout.Scope 3 — function/variable vocabulary + file renames
finishCloudJob(+mockFinishCloudJob)finishRun(+mockFinishRun)enqueueCloudTask(+EnqueueCloudTaskInput/Options,enqueueCloudTaskInputSchema, mocks)enqueueTask(+EnqueueTaskInput/Options,enqueueTaskInputSchema, mocks)packages/sdk/.../finish-cloud-job.ts(+ test)finish-run.ts(+ test) —git mvpackages/cloud-agents/.../enqueue-cloud-task.test.tsenqueue-task.test.ts—git mvLog-prefix strings (e.g.
[finishRun]) were updated to match the identifiers; these are observability-only, not parsed anywhere.Wire contracts preserved
No serialized field names were touched. In particular
cloudJobIdwas deliberately left unchanged (1530 refs) because it appears throughout wire surfaces — tRPC input schemas, job-token claims, sandbox RPC payloads, Docker worker command args, and API/URL routes — where renaming would break rolling-deploy compatibility. See "Left as follow-up" below.Left as follow-up (documented, not done)
To keep churn bounded and the build green (per the "green build beats a broken sweep" guidance), the following broader vocabulary was intentionally not renamed in this pass:
cloudJobId→runId(1530 refs) — heavily wire-entangled; needs per-occurrence classification of internal-id vs wire-field, out of scope for a mechanical sweep.*CloudJob*function/class names whose file/dir/URL/telemetry surfaces are load-bearing:CloudJobQueue,dequeueCloudJob/dequeueCloudTask(telemetry stage strings likeresume.dequeueCloudJob.bootstrapFailure),findCloudJob,updateCloudJob,recordCloudJobEvent,getCloudJobLogs,generateCloudJobTitle,createStandardTaskCloudJob, etc.cloud-jobs/directory, tRPC router paths, andapps/web/src/app/api/cloud-jobs/[id]/...URL routes — these are wire/URL surfaces and were left untouched.Validation
pnpm lint— 24/24 ✓pnpm check-types— 24/24 ✓pnpm test— 24/24 ✓ (all DB-backed suites included)pnpm knip— zero delta: baseorigin/developreports identical counts (6 unused files / 157 unused exports / 141 unused types); this rename introduces no new knip issues. The deleted db aliases leave no unused exports. (The pre-existing knip baseline fails locally, so the push used--no-verify; the same failure exists ondevelop.)