refactor(workflows): testable runApprovalTextCommand (proves #2 resolve+resume)#458
Merged
Merged
Conversation
…lve+resume The Telegram text-approval orchestration (list pending → select → resolve → resume → reply) was inline in bot-handlers.ts, untestable without standing up the bot. Extract it into runApprovalTextCommand with injected deps so the resolve+resume wiring is observable in unit tests; bot-handlers becomes a thin caller that sends result.reply. Behavior-preserving (same reply strings, same resolveDurableWorkflowApprovalById + resumeWorkflowRunAfterApproval calls). Adds 6 orchestration tests: approve→status=approved+resume, deny symmetric, in-memory→no durable resume, multi→lists, zero→no-op, already-resolved→gone. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository 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)
Comment |
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.
Follow-up to #457. Makes Bug #2's acceptance (text reply "approve" resolves + resumes) observable in tests — the orchestration was inline in
bot-handlers.tsand untestable without the full bot.Change
Extract
runApprovalTextCommand(list pending → select → resolve → resume → reply) intoworkflow-approvals.tswith injected deps.bot-handlers.tsbecomes a thin caller that sendsresult.reply. Behavior-preserving — same reply strings, sameresolveDurableWorkflowApprovalById+resumeWorkflowRunAfterApprovalcalls.Tests (observable #2 proof)
6 orchestration cases: approve →
resolveById(approved=true)+ resume; deny symmetric (approved=false); in-memory pending → in-memory resolve, no durable resume; multiple → lists, resolves nothing; zero → no-op; already-resolved between list+update → "gone". Plus the existing 7 selector cases. 437 telegram+approvals tests green; tsgo 189 (unchanged); oxfmt clean.🤖 Generated with Claude Code