3.6 KiB
3.6 KiB
estimated_steps, estimated_files, skills_used
| estimated_steps | estimated_files | skills_used | ||
|---|---|---|---|---|
| 4 | 5 |
|
T02: Persist Gmail thread metadata and harden import continuity
Slice: S01 — Smarter Gmail import and matching Milestone: M001
Description
Make imported Gmail correspondence durable enough to support real thread continuity. This task extends persistence and import handling so that once the user chooses a suggested Gmail message or thread, the app keeps the metadata needed for dedupe, timeline continuity, and later reply/follow-up context instead of collapsing everything down to a bare message body.
Steps
- Extend
Models/Correspondence.csso Gmail imports can retain thread/message identity and sender/recipient metadata that downstream slices can trust. - Update
JobTrackerApi/Controllers/GmailController.csimport paths andJobTrackerApi/Controllers/CorrespondenceController.csresponse behavior so imported records populate and expose the new Gmail metadata while keeping the existing no-auto-send boundary intact. - Update
JobTrackerApi/Program.csstartup compatibility guards for SQLite/MySQL so older dev databases can gain the new correspondence columns without breaking local startup. - Add or extend
JobTrackerApi.Tests/GmailControllerTests.csassertions for repeat single-message imports, repeat thread imports, and import result payloads that distinguish imported vs skipped work.
Must-Haves
- Imported Gmail correspondence keeps message/thread identity plus sender/recipient metadata in
Models/Correspondence.csrather than forcing later slices to re-derive it. - Import endpoints clearly report imported vs skipped outcomes and continue deduping on repeat imports.
- Runtime schema guards in
JobTrackerApi/Program.csare updated alongside the model change so legacy/dev databases remain bootable.
Verification
dotnet test JobTrackerApi.Tests/JobTrackerApi.Tests.csproj --filter GmailControllerTests- Confirm the tests prove duplicate single-message import handling, duplicate thread import handling, and the enriched import payload contract.
Observability Impact
- Signals added/changed: persisted Gmail metadata on correspondence records and explicit imported/skipped counts from Gmail import actions.
- How a future agent inspects this: inspect
Models/Correspondence.cs, the import payloads inJobTrackerApi/Controllers/GmailController.cs, and startup column guards inJobTrackerApi/Program.cs. - Failure state exposed: repeat imports should now reveal whether the issue is dedupe, missing metadata persistence, or schema mismatch on startup.
Inputs
JobTrackerApi/Controllers/GmailController.cs— T01 job-aware matching/import contract and existing import behavior.Models/Correspondence.cs— current correspondence persistence model.JobTrackerApi/Controllers/CorrespondenceController.cs— current correspondence list/create/delete surface.JobTrackerApi/Program.cs— runtime schema repair path that must stay aligned with new columns.JobTrackerApi.Tests/GmailControllerTests.cs— backend Gmail coverage expanded in T01.
Expected Output
Models/Correspondence.cs— persists Gmail message/thread and sender/recipient metadata.JobTrackerApi/Controllers/GmailController.cs— populates and reports the new import metadata cleanly.JobTrackerApi/Controllers/CorrespondenceController.cs— exposes the enriched correspondence records back to the UI.JobTrackerApi/Program.cs— keeps legacy/dev DB startup safe after the schema change.JobTrackerApi.Tests/GmailControllerTests.cs— proves continuity and duplicate-import behavior.