--- estimated_steps: 4 estimated_files: 2 skills_used: - test --- # T01: Strengthen follow-up draft context assembly and backend reply/follow-up tests **Slice:** S03 — Reply and follow-up drafting from real thread context **Milestone:** M001 ## Description Make the follow-up draft endpoint use imported correspondence, recruiter details, and saved application package material so the draft reflects the real thread stage and saved job context instead of a generic reminder template. ## Steps 1. Audit `GetFollowUpDraft` and nearby helpers in `JobApplicationsController` to identify which imported thread/package signals are currently ignored. 2. Add or refactor backend context assembly so follow-up drafting consumes recent correspondence, saved package material, recruiter details, and stage-specific cues without crossing the manual-send boundary. 3. Add focused backend tests proving the follow-up draft output changes in response to thread/package context and still preserves explicit manual-send behavior. 4. Verify the focused backend behavior with an isolated test path if the broader test project remains blocked by unrelated compile drift. ## Must-Haves - [ ] Follow-up draft context includes imported correspondence and saved application package material deliberately. - [ ] The generated follow-up draft reflects thread stage/recruiter context instead of generic job-only phrasing. - [ ] Focused backend tests prove the stronger draft grounding. ## Verification - `dotnet test JobTrackerApi.Tests/JobTrackerApi.Tests.csproj --filter JobApplicationsFollowUpDraftTests` - Focused isolated harness if needed: run only `JobApplicationsFollowUpDraftTests` against `JobTrackerApi/Controllers/JobApplicationsController.cs` ## Observability Impact - Signals added/changed: richer follow-up draft reason/context surface and clearer thread-aware draft behavior. - How a future agent inspects this: `GET /api/jobapplications/{id}/followup-draft` plus `JobTrackerApi.Tests/JobApplicationsFollowUpDraftTests.cs`. - Failure state exposed: missing thread/package context should show up as weaker fallback behavior in focused backend tests rather than silent generic output. ## Inputs - `JobTrackerApi/Controllers/JobApplicationsController.cs` — existing follow-up draft and send/log endpoints. - `Models/Correspondence.cs` — imported thread/sender/recipient fields from S01. - `JobTrackerApi.Tests/JobApplicationsApplicationPackageTests.cs` — current focused test seam style for isolated job-application behavior. ## Expected Output - `JobTrackerApi/Controllers/JobApplicationsController.cs` — stronger follow-up draft context assembly. - `JobTrackerApi.Tests/JobApplicationsFollowUpDraftTests.cs` — focused backend proof for thread-aware follow-up drafting.