fix: resolve typecheck/lint failures from feature-services PR#3
fix: resolve typecheck/lint failures from feature-services PR#3
Conversation
- Add thread.branch-from-checkpoint case to commandToAggregateRef in OrchestrationEngine.ts; the new command type uses sourceThreadId/ newThreadId instead of threadId, causing TS2339 after we added ThreadBranchFromCheckpointCommand to the contracts union - Simplify deleteTemplate in WorkflowService.ts to eliminate the unnecessary Effect.gen wrapper (TS5 message) - Change error channel type in server.ts runServer from any to unknown to suppress TS28 anyUnknownInErrorContext warnings propagating through cli.ts and bin.ts https://claude.ai/code/session_01XF5adFusgTx5Fb1Qhc8MeC
…heck The anyUnknownInErrorContext lint rule (TS28) fires for both any and unknown in the error channel. Changing the prior session's unknown to never correctly models a fully-launched server layer (all typed errors are handled internally; unhandled failures are fatal) and eliminates the TS28 propagation through cli.ts, bin.ts, and cli.test.ts. bun typecheck now exits 0 with only pre-existing TS32 informational messages (Effect.runFork inside Effect, pre-existing upstream). https://claude.ai/code/session_01Nxa3JfS5jZVHsnJmaaHvbW
📝 WalkthroughWalkthroughThis pull request introduces three focused improvements across the server infrastructure: adding a new command routing case for thread branching from checkpoints, refining an Effect type annotation for error handling clarity, and simplifying SQL delete operation control flow in the workflow service. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/server/src/workflow/Services/WorkflowService.ts (1)
305-308: PreferEffect.gen()here to match server async-operation convention.This works, but it diverges from the project’s server-side Effect style rule.
As per coding guidelines "Use Effect's `Layer.effect()` for service composition, `Effect.gen()` for async operations, and `Stream` API for event/data streaming in the server architecture".♻️ Suggested adjustment
const deleteTemplate: WorkflowServiceShape["delete"] = (input) => - sql` - DELETE FROM workflow_templates - WHERE id = ${input.templateId} AND is_built_in = 0 - `.pipe(Effect.orDie); + Effect.gen(function* () { + yield* sql` + DELETE FROM workflow_templates + WHERE id = ${input.templateId} AND is_built_in = 0 + `; + }).pipe(Effect.orDie);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server/src/workflow/Services/WorkflowService.ts` around lines 305 - 308, Replace the direct SQL effect pipeline sql`...`.pipe(Effect.orDie) with an Effect.gen-based async operation per server conventions: wrap the DELETE sql template call inside an Effect.gen(() => { ... }) block, yield the sql call inside that generator and handle/propagate errors via the gen's effect flow (instead of calling .pipe(Effect.orDie) inline). Target the SQL deletion snippet (the sql`DELETE FROM workflow_templates WHERE id = ${input.templateId} AND is_built_in = 0` block) in WorkflowService.ts and ensure the returned value is the Effect produced by Effect.gen so it conforms to the project's async-operation style.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/server/src/workflow/Services/WorkflowService.ts`:
- Around line 305-308: Replace the direct SQL effect pipeline
sql`...`.pipe(Effect.orDie) with an Effect.gen-based async operation per server
conventions: wrap the DELETE sql template call inside an Effect.gen(() => { ...
}) block, yield the sql call inside that generator and handle/propagate errors
via the gen's effect flow (instead of calling .pipe(Effect.orDie) inline).
Target the SQL deletion snippet (the sql`DELETE FROM workflow_templates WHERE id
= ${input.templateId} AND is_built_in = 0` block) in WorkflowService.ts and
ensure the returned value is the Effect produced by Effect.gen so it conforms to
the project's async-operation style.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1953e723-664d-47b6-a0a1-e3167f62678d
📒 Files selected for processing (3)
apps/server/src/orchestration/Layers/OrchestrationEngine.tsapps/server/src/server.tsapps/server/src/workflow/Services/WorkflowService.ts
Summary
Three targeted fixes for issues introduced by the prior feature-services commit:
case "thread.branch-from-checkpoint":beforedefault:incommandToAggregateRef. The new command usesnewThreadId/sourceThreadIdrather thanthreadId, which caused TS2339 in the default fallthrough.deleteTemplateto a direct sql tag +.pipe(Effect.orDie), eliminating the single-returnEffect.genwrapper that triggered the TS5 lint message.runServer's error channel fromany/unknowntonever. TheanyUnknownInErrorContext(TS28) rule fires for bothanyandunknown;neveris semantically correct for a fully-launched server layer and eliminates TS28 propagation throughcli.ts,bin.ts, andcli.test.ts.Test plan
bun typecheckexits 0 (only pre-existingTS32informational messages remain)bun lint— 5 pre-existing warnings, 0 errorsbun fmt --check— all files correctly formattedhttps://claude.ai/code/session_01Nxa3JfS5jZVHsnJmaaHvbW
Summary by CodeRabbit
Refactor
Chores