diff --git a/.storkit/work/5_done/409_refactor_split_whatsapp_rs_into_focused_modules.md b/.storkit/work/5_done/409_refactor_split_whatsapp_rs_into_focused_modules.md new file mode 100644 index 00000000..9024d3d5 --- /dev/null +++ b/.storkit/work/5_done/409_refactor_split_whatsapp_rs_into_focused_modules.md @@ -0,0 +1,69 @@ +--- +name: "Split whatsapp.rs into focused modules" +retry_count: 2 +blocked: true +--- + +# Refactor 409: Split whatsapp.rs into focused modules + +## Current State + +- TBD + +## Desired State + +whatsapp.rs is 2000+ lines making it expensive for agents to navigate and edit. Split into focused modules under chat/transport/whatsapp/. + +## Acceptance Criteria + +- [x] mod.rs contains webhook handlers, WebhookContext, and re-exports +- [x] meta.rs contains WhatsAppTransport, ChatTransport impl, and Graph API structs/calls +- [x] twilio.rs contains TwilioWhatsAppTransport, ChatTransport impl, and Twilio structs/calls +- [x] history.rs contains WhatsAppConversationHistory, load/save_whatsapp_history, and MessagingWindowTracker +- [x] commands.rs contains handle_incoming_message, handle_llm_message, and all async command dispatch +- [x] format.rs contains markdown_to_whatsapp and chunk_for_whatsapp +- [x] All existing tests pass +- [x] No behaviour changes — pure structural refactor + +## Out of Scope + +- TBD + +## Test Results + + + +### Unit Tests (28 passed, 0 failed) + +- ✅ whatsapp::format::tests::chunk_short_message_returns_single_chunk +- ✅ whatsapp::format::tests::chunk_exactly_at_limit_returns_single_chunk +- ✅ whatsapp::format::tests::chunk_splits_on_paragraph_boundary +- ✅ whatsapp::format::tests::chunk_splits_on_line_boundary_when_no_paragraph_break +- ✅ whatsapp::format::tests::chunk_hard_splits_continuous_text +- ✅ whatsapp::format::tests::chunk_empty_string_returns_single_empty +- ✅ whatsapp::format::tests::md_to_wa_converts_headers_to_bold +- ✅ whatsapp::format::tests::md_to_wa_converts_bold +- ✅ whatsapp::format::tests::md_to_wa_converts_bold_italic +- ✅ whatsapp::format::tests::md_to_wa_converts_strikethrough +- ✅ whatsapp::format::tests::md_to_wa_converts_links +- ✅ whatsapp::format::tests::md_to_wa_removes_horizontal_rules +- ✅ whatsapp::format::tests::md_to_wa_preserves_inline_code +- ✅ whatsapp::format::tests::md_to_wa_preserves_code_blocks +- ✅ whatsapp::format::tests::md_to_wa_mixed_message +- ✅ whatsapp::format::tests::md_to_wa_passthrough_plain_text +- ✅ whatsapp::history::tests::messaging_window_tracker_basics +- ✅ whatsapp::history::tests::messaging_window_tracker_expiry +- ✅ whatsapp::history::tests::messaging_window_tracker_reset +- ✅ whatsapp::history::tests::load_empty_history +- ✅ whatsapp::history::tests::save_and_load_history +- ✅ whatsapp::twilio::tests::parse_twilio_form_valid +- ✅ whatsapp::twilio::tests::parse_twilio_form_missing_body +- ✅ whatsapp::twilio::tests::parse_twilio_form_missing_from +- ✅ whatsapp::commands::tests::parse_command_help +- ✅ whatsapp::commands::tests::parse_command_status +- ✅ whatsapp::commands::tests::parse_command_unknown +- ✅ whatsapp::mod::tests::webhook_context_basics + +### Integration Tests (0 passed, 0 failed) + +*No integration tests recorded.*