chore(cloud): post-merge /clean follow-up on lifecycle job code#7845
Conversation
Five small wins surfaced by a second /clean pass after the lifecycle queue stack merged (#7810/#7813/#7815/#7816): - provisioning-jobs.ts: drop 4 redundant type casts. `status: "error"`, `"deletion_failed"`, and the `webhook_status` updates are all literals matching the inferred parameter type — the `as Parameters<...>[1]` / `as Partial<Job>` casts added nothing. - provisioning-jobs.ts: executeAgentProvision failure path now uses agentProvisionJobResultToRecord({...}) like every other executor, preserving the typed-serialization-boundary pattern. - v1/eliza/agents/[id]/route.ts (DELETE): drop the redundant `instanceof Error && error.message === "Agent not found"` branch. failureResponse() already maps any "not found" error to 404. - v1/agents/[id]/logs/route.ts: add `success: false` to the 404 body to match the response shape every sibling route uses. - v1/eliza/agents/[id]/resume/route.ts: trim a forward-looking comment about a "future docker start fast path" — belongs in a ticket, not the route. Kept the audit-log rationale. - __tests__/provisioning-job-types.test.ts: lock the registry size with `expect(Object.keys(JOB_TYPES)).toHaveLength(7)`. A new entry without a matching wire-value assertion now fails CI instead of being silently under-covered. Net diff: -5 LOC, 5 files. No behavior change.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Five small wins surfaced by a second `/clean` pass after the lifecycle queue stack merged: #7810, #7813, #7815, #7816.
What changed (-5 LOC, 5 files)
`provisioning-jobs.ts`
`v1/eliza/agents/[id]/route.ts` (DELETE)
`v1/agents/[id]/logs/route.ts`
`v1/eliza/agents/[id]/resume/route.ts`
`tests/provisioning-job-types.test.ts`
Why now
The lifecycle stack landed in one big push at 02:09 UTC. Post-merge I ran a second `/clean` pass to surface anything that slipped through the per-PR reviews. These are the 5 high-confidence wins. Nothing behavioral — type cast removal compiles to the same JS; the response-shape fix in the logs 404 matches what `failureResponse` already emits elsewhere; the test additionnal assertion is purely a CI guardrail.
Test plan
Greptile Summary
Post-merge cleanup pass across five files in the lifecycle job stack: removes redundant type casts, normalizes the
executeAgentProvisionfailure path to use the typed serializer, drops stale comments, and adds a CI guard on theJOB_TYPESregistry size.provisioning-jobs.ts: four unnecessaryas Parameters<…>[1]/as Partial<Job>casts removed; theexecuteAgentProvisionfailure path now routes throughagentProvisionJobResultToRecordfor consistency with all other executors; three self-evident inline comments dropped.route.ts(DELETE): the hand-rolled "Agent not found" → 404 branch is removed;failureResponsealready reaches 404 viainferStatusFromLegacyError'smessage.includes("not found")check — the response now also carriescode: "resource_not_found"which was previously absent.logs/route.ts&resume/route.ts: 404 response body aligned with sibling routes (success: falseadded); forward-looking docker comment trimmed.Confidence Score: 5/5
All five changes are non-behavioral: type cast removal compiles to identical JS, the response-shape additions are purely additive, and the test change only tightens an existing assertion.
Every change is either a TypeScript-only cast removal (zero JS delta), an additive response field (adds
code: "resource_not_found"where it was absent before — no client would break on an extra field), a comment edit, or a test guardrail. TheagentProvisionJobResultToRecordnormalization on the failure path is functionally identical because the serializer is a plain object spread.tsc --noEmitand biome are reported clean across all touched files.No files require special attention. The DELETE route behavior change (response now includes
code) is worth confirming against any clients that strictly parse the 404 body, but it is purely additive.Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[executeAgentProvision] --> B{provResult.success?} B -- No --> C[agentProvisionJobResultToRecord with error] C --> D[jobsRepository.update result] D --> E[throw Error] B -- Yes --> F[build AgentProvisionJobResult] F --> G[agentProvisionJobResultToRecord] G --> H[jobsRepository.updateStatus completed] H --> I{job.webhook_url?} I -- Yes --> J[fireWebhook] I -- No --> K[Done] J --> KReviews (1): Last reviewed commit: "chore(cloud): post-merge /clean follow-u..." | Re-trigger Greptile