From 3f0eba052583bdf0765b3c8ea897f9179891de08 Mon Sep 17 00:00:00 2001 From: cesnimda Date: Mon, 10 Aug 2026 00:49:49 +0200 Subject: [PATCH] docs(email): record export lifecycle evidence --- docs/audits/verification-log.md | 1 + docs/verification/application-action-matrix.md | 1 + docs/verification/mail-001-job-email-hub.md | 14 +++++++++++--- docs/work-programmes/decisions.md | 10 ++++++++++ docs/work-programmes/master-progress.md | 6 +++--- docs/work-programmes/master-work-plan.md | 6 +++--- docs/work-programmes/session-handoff.md | 14 +++++++------- 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/docs/audits/verification-log.md b/docs/audits/verification-log.md index 84906e5..b54c00c 100644 --- a/docs/audits/verification-log.md +++ b/docs/audits/verification-log.md @@ -170,3 +170,4 @@ Output was reduced to filenames and commit counts. The token artifact appears un | V-136 | Focused `EmailSendAttemptStoreTests|EmailSendControllerTests`; full backend; provider-dependency search; `git diff --check` | Repository root | Verify restart recovery, stale/fresh boundary, pending-failed versus sending-uncertain classification, two-owner notification isolation, idempotency and absence of provider retries | PASS — focused 10/10; full backend 620/620; repeated recovery 0/0; each owner sees one content-free notification; recovery code has no provider/SMTP dependency; no whitespace errors | Real SQLite and manual clock; no process kill, MariaDB, provider, email or production runtime. Five-minute scan performance is unmeasured on a large ledger | Runtime/performance limitation | | V-137 | `npm.cmd ls react-router-dom react-router js-yaml nanoid --all --depth=4`; `npm.cmd audit`; six focused router suites; full `npm.cmd test -- --runInBand`; `npm.cmd run build`; staged diff review | `job-tracker-ui` / repository root | Resolve the frontend advisory gate without an unreviewed forced update and verify the React Router v7 compatibility path | PASS — audit reports 0 vulnerabilities; focused 6/6 suites and 24/24 tests; full 49/49 suites and 190/190 tests; production build/TypeScript/static generation pass; `b55a592` pushed | CI/live deployment has not yet consumed the pushed commit; no deployment or production access occurred | Deployment verification pending | | V-138 | Focused `JobApplicationsFollowUpDraftTests|BackgroundWorkerTenantTests`; focused follow-up/trust-loop Jest; full backend/frontend; production build; `npm.cmd audit`; staged diff review | Repository root / `job-tracker-ui` | Verify legacy direct SMTP retirement while preserving draft generation, scheduled reminders and the provider-confirmed Job email boundary | PASS — focused backend 10/10 and UI 2/2; full backend 621/621 and frontend 49/49 suites, 190/190 tests; build and audit pass; legacy action returns 410 with no SMTP dependency; `8fe3903` pushed | JSDOM/fake services only; no provider/email/browser/production execution. Remote CI/live confirmation remains | External/deployment limitation | +| V-139 | Focused `BackupControllerTests|BackgroundWorkerTenantTests|EmailSendAttemptStoreTests`; full backend; staged diff/secret/content-field review | Repository root | Verify owner-readable content-free send-attempt exports and hard-job-delete cascade isolation | PASS — focused 16/16; full backend 622/622; encrypted and daily exports include one owner attempt without payload hash; real SQLite deletes only the target job's attempt; `aff34cc` pushed | Complete account deletion/files/backups/retention remain SEC-009; no production export or deletion occurred | Deliberately bounded lifecycle increment | diff --git a/docs/verification/application-action-matrix.md b/docs/verification/application-action-matrix.md index a3baa71..f2810a7 100644 --- a/docs/verification/application-action-matrix.md +++ b/docs/verification/application-action-matrix.md @@ -51,6 +51,7 @@ This is the rolling action-level evidence index. `PASS (automated/runtime)` is n | Job email hub | linked/review view switching, Gmail decision component reuse and legacy route redirect | PASS (components; mocked provider data) | NOT RUN | NOT RUN | `mail-001-job-email-hub.md` | | Job email hub | provider status, owner-scoped search/detail and saved-copy fallback | PASS (fake providers + components) | NOT RUN | NOT RUN | `mail-001-job-email-hub.md` | | Job email send | explicit confirmation, owner isolation, idempotency, failure/uncertainty and restart recovery | PASS (real SQLite + fake providers) | NOT RUN | NOT RUN | `mail-001-job-email-hub.md` | +| Job email send | content-free encrypted/daily export and hard-job-delete cascade | PASS (real SQLite) | N/A | NOT RUN | `mail-001-job-email-hub.md` | | Follow-up draft | generate/edit/copy and open canonical Job email; legacy direct SMTP returns 410 | PASS (backend + components) | NOT RUN | NOT RUN | `mail-001-job-email-hub.md` | Remaining product actions are `NOT STARTED` in the master plan and will be added as their work packages enter verification. The in-app browser is available for local UI checks; configured/real-provider and production access are not documented/configured. diff --git a/docs/verification/mail-001-job-email-hub.md b/docs/verification/mail-001-job-email-hub.md index d19b063..44d7e58 100644 --- a/docs/verification/mail-001-job-email-hub.md +++ b/docs/verification/mail-001-job-email-hub.md @@ -2,7 +2,7 @@ Updated: 2026-08-10 -Status: `IN PROGRESS`. Canonical hub routing, provider-neutral reads, explicit-confirmed send API, editable reply UI, interrupted-send recovery and legacy SMTP retirement are implemented and locally verified; remaining provider actions/export lifecycle remain. +Status: `IN PROGRESS`. Canonical hub routing, provider-neutral reads, explicit-confirmed send API, editable reply UI, interrupted-send recovery, legacy SMTP retirement and send-attempt export coverage are implemented and locally verified; remaining provider actions and full account-deletion lifecycle remain. ## Revalidated current boundaries @@ -71,7 +71,7 @@ Status: `IN PROGRESS`. Canonical hub routing, provider-neutral reads, explicit-c - Confirmed composer focused tests: 7/7. - Full backend: 620/620; full frontend: 49/49 suites, 190/190 tests. - Production build/TypeScript and `git diff --check`: pass. -- Implementation commits: `6008b4a`, `536d403`, `a20775c`, `653f011`, `e9937ac`, `123fc55`, `449faeb`, `ee5ef7e`, `8fe3903`. +- Implementation commits: `6008b4a`, `536d403`, `a20775c`, `653f011`, `e9937ac`, `123fc55`, `449faeb`, `ee5ef7e`, `8fe3903`, `aff34cc`. ## Implemented editable composer increment @@ -98,13 +98,21 @@ Status: `IN PROGRESS`. Canonical hub routing, provider-neutral reads, explicit-c - Scheduled reminder notification email remains on its separate worker path and was not removed or redirected. - Focused backend follow-up/worker tests pass 10/10; focused UI trust-loop tests pass 2/2. Full backend 621/621, frontend 190/190, build and audit gates pass across the combined working state. +## Implemented send-attempt export/cascade increment + +- Encrypted on-demand backups and tenant-isolated daily JSON exports now include provider delivery history using one explicit content-free shape. +- Exported attempt fields cover job/provider/request/status/provider-message/failure-category and timestamps. The internal payload hash is excluded; recipient, subject and body were never stored on the ledger. +- Both queries stay inside the current owner filter and the owner's exported job IDs. Daily two-owner fixtures prove one isolated attempt per file and hashed filenames. +- Real SQLite proves a hard delete of one owned job cascades only its send attempts and preserves another owner's job/attempt. +- This does not implement complete account deletion. Identity-row deletion still lacks the cross-store/database/file lifecycle owned by SEC-009 and remains a release blocker. + ## Remaining MAIL-001 work - Extend shared provider-neutral thread navigation and application embedding while preserving provider capability differences. - Surface provider identity, reauthorization, read/unread, pin/read-later/archive/spam/trash only where the provider supports it. - Share thread detail and link/unlink actions between hub and job workspace. - Add durable draft/refresh recovery and compose-new-message behavior if confirmed by the remaining workflow inventory; replies are implemented. -- Include non-sensitive send-attempt metadata in user export and verify account/job deletion coverage before production rollout. +- Complete account deletion coverage under SEC-009 before production rollout; job-level hard-delete cascade and export coverage are verified. - Preserve minimal audit metadata without sensitive body logging; verify Free non-AI access and Pro-only AI assistance. - Complete link/unlink/dismiss/draft/send/failure/two-user/application-embed tests plus browser/production provider gates. No real email may be sent during repository verification. diff --git a/docs/work-programmes/decisions.md b/docs/work-programmes/decisions.md index 8df94e9..6220f30 100644 --- a/docs/work-programmes/decisions.md +++ b/docs/work-programmes/decisions.md @@ -469,3 +469,13 @@ - **Consequences:** users copy the draft or open Job email and review provider/from/recipient/content before sending. Old API callers receive an explicit terminal response and must migrate; no correspondence/follow-up date is falsely recorded as sent. - **User approval required:** No; this is the smallest safe completion of the already active MAIL-001 programme and sends no email. - **Reversible:** Yes by reverting `8fe3903`, but that reintroduces the unsafe SMTP bypass. Prefer forward migration of any remaining caller to `/api/email/send` with explicit confirmation. + +## DEC-048 — Export delivery state, not content fingerprints + +- **Date:** 2026-08-10 +- **Decision:** Add one explicit send-attempt export record to both existing owner export surfaces. Include provider/request/status/provider-message/failure/timestamps, but omit the internal payload hash. Verify the existing job foreign-key cascade with real SQLite; leave complete identity/account deletion to SEC-009. +- **Reason/evidence:** users need readable delivery history, while the ledger intentionally stores no recipient, subject or body. The payload hash exists only for deduplication/conflict checks and is not meaningful portable data. Two-owner daily files and decrypted backup tests prove coverage/isolation; the cascade test proves one hard job deletion does not affect the other tenant. +- **Alternatives considered:** export the entity directly; include the payload hash; omit attempts; claim UserManager identity deletion is complete; add a second cleanup routine. These expose internal correlation data, lose audit history, overstate the current account lifecycle or duplicate the database cascade. +- **Consequences:** export schemas gain an additive `EmailSendAttempts` collection. Complete account/database/file/token/backup deletion remains an explicit SEC-009 release item rather than hidden in MAIL-001. +- **User approval required:** No; this is the approved MAIL-001 export/cascade requirement using synthetic local data only. +- **Reversible:** Yes. Revert `aff34cc`; no schema or stored data changes. Existing export files remain valid historical artifacts under their configured retention. diff --git a/docs/work-programmes/master-progress.md b/docs/work-programmes/master-progress.md index 8da8459..0de7462 100644 --- a/docs/work-programmes/master-progress.md +++ b/docs/work-programmes/master-progress.md @@ -2,8 +2,8 @@ Updated: 2026-08-10 -- **Overall programme status:** Active. Seven packages are locally verified; nineteen packages through CAREER-002 are implemented with automated/runtime evidence but blocked from applicable browser/provider/production gates; MAIL-001 is in progress with nine committed implementation increments. DEP-001 removed the frontend advisory deployment gate locally and is pushed for CI/live verification. -- **Current work package:** `MAIL-001` — consolidated job-email hub and explicit sending (`IN PROGRESS`); routing/reads/detail, ledger, Gmail/Graph delivery/re-consent, safe send API/UI, cross-owner-safe interrupted-attempt recovery and legacy SMTP retirement are committed. Export/deletion coverage is the next dependency-correct increment. +- **Overall programme status:** Active. Seven packages are locally verified; nineteen packages through CAREER-002 are implemented with automated/runtime evidence but blocked from applicable browser/provider/production gates; MAIL-001 is in progress with ten committed implementation increments. DEP-001 removed the frontend advisory deployment gate locally and is pushed for CI/live verification. +- **Current work package:** `MAIL-001` — consolidated job-email hub and explicit sending (`IN PROGRESS`); routing/reads/detail, ledger, Gmail/Graph delivery/re-consent, safe send API/UI, recovery, legacy SMTP retirement and content-free export/job-cascade coverage are committed. Shared provider actions/capability behavior is the next repository increment; full account deletion stays SEC-009. - **Completed work packages:** None are `DONE`; all repository security/AI packages still have applicable browser, provider and/or production gates. - **Locally verified work:** SEC-001, SEC-002, SEC-003, SEC-005A, CORE-001, PROD-002 and DEP-001 (`VERIFIED LOCALLY`). - **Implemented, verification incomplete:** SEC-004, SEC-005B, SEC-008, CORE-002, BG-001, OPS-001A/B/C, POL-001/002, AI-001/002/003/004, UX-001/002, QA-001, CAREER-001 and CAREER-002 (`IMPLEMENTED — NOT VERIFIED`). CAREER-002 now protects unsaved edits and provides tested structured custom-entry, profile-override and preview-error interactions; all automated/build gates pass. @@ -12,7 +12,7 @@ Updated: 2026-08-10 - **Deferred work:** None. Conditional multi-replica coordination, model deletion, realtime operation delivery and unrelated production changes remain outside current packages. - **Next five work packages:** MAIL-001 consolidated email experience; JOBS-001 job-search/application redesign; HOME-001 homepage/Pro promotion; UX-003 authentication/profile polish; PRODUCT-001 homepage/Pro claims. SEC-006/007 resume after package-index permission. - **Status counts:** 7 `VERIFIED LOCALLY`; 19 `IMPLEMENTED — NOT VERIFIED`; 1 `IN PROGRESS`; 8 `NOT STARTED`; 5 `BLOCKED`; 0 `DONE`; 0 `DEFERRED`. -- **Test status:** backend 621/621; frontend 49/49 suites and 190/190 tests; npm audit 0 vulnerabilities; DEP-001 focused router 24/24 and production build pass; MAIL-001 recovery/send focused 10/10, legacy follow-up/backend worker 10/10, legacy UI 2/2, composer 7/7, delivery/capability 18/18, provider/correspondence 5/5 and hub detail 5/5. Jest open-handle/slow-run behavior is recorded in V-127/V-128/V-130/V-131/V-135. +- **Test status:** backend 622/622; frontend 49/49 suites and 190/190 tests; npm audit 0 vulnerabilities; DEP-001 focused router 24/24 and production build pass; MAIL-001 export/cascade 16/16, recovery/send 10/10, legacy follow-up/backend worker 10/10, legacy UI 2/2, composer 7/7, delivery/capability 18/18, provider/correspondence 5/5 and hub detail 5/5. Jest open-handle/slow-run behavior is recorded in V-127/V-128/V-130/V-131/V-135. - **Deployment status:** `b55a592` is pushed to remove the frontend audit blocker; remote CI/live result is pending. No deployment was performed directly, no production migrations were run and the AI operation worker remains disabled by default. - **Production status:** Unchanged and unverified. No provider/model call, model pull, external request or paid API occurred. - **Known regressions:** None found by automated suites. Jest still needs `--forceExit` and reports its existing open-handle notice. Email-provider/send tests are fake/local only; real delivery is not claimed. Interrupted attempts are aged after 15 minutes and notified without retry; the five-minute scan is unmeasured on a large ledger. Direct clean EF-only SQLite migration still hits the pre-existing historical blank-chain defect before later migrations; normal startup owns reconciliation. Cross-feature monthly AI usage accounting remains a rollout gap. diff --git a/docs/work-programmes/master-work-plan.md b/docs/work-programmes/master-work-plan.md index c683dda..2e88bfb 100644 --- a/docs/work-programmes/master-work-plan.md +++ b/docs/work-programmes/master-work-plan.md @@ -651,9 +651,9 @@ Ordering differences from the suggested list: - **Required production verification:** provider read/draft/send requires explicit authorized synthetic account; never real unsolicited email. - **Status:** `IN PROGRESS`. - **Blocker:** real provider verification external; mocked/local implementation not blocked after dependencies. -- **Evidence:** `docs/verification/mail-001-job-email-hub.md`; V-126–V-138. Recovery/send focused 10/10; legacy follow-up/worker 10/10; composer 7/7; delivery/capability 18/18; provider/correspondence 5/5; hub detail 5/5; backend 621/621; frontend 49/49 suites and 190/190 tests plus build/audit. -- **Commit:** `6008b4a` (hub), `536d403` (neutral reads), `a20775c` (safe detail), `653f011` (ledger), `e9937ac` (Gmail/Graph delivery adapters and consent), `123fc55` (explicit-confirmed send API), `449faeb` (confirmed reply composer), `ee5ef7e` (interrupted-send recovery), `8fe3903` (legacy SMTP retirement). -- **Remaining work:** export/deletion coverage; durable/new-message drafts; shared thread/application actions and category capabilities; free/pro and browser/production verification. Existing connections need explicit re-consent; IMAP remains read-only. No real email; uncertain sends need manual reconciliation. +- **Evidence:** `docs/verification/mail-001-job-email-hub.md`; V-126–V-139. Export/cascade focused 16/16; recovery/send focused 10/10; legacy follow-up/worker 10/10; composer 7/7; delivery/capability 18/18; provider/correspondence 5/5; hub detail 5/5; backend 622/622; frontend 49/49 suites and 190/190 tests plus build/audit. +- **Commit:** `6008b4a` (hub), `536d403` (neutral reads), `a20775c` (safe detail), `653f011` (ledger), `e9937ac` (Gmail/Graph delivery adapters and consent), `123fc55` (explicit-confirmed send API), `449faeb` (confirmed reply composer), `ee5ef7e` (interrupted-send recovery), `8fe3903` (legacy SMTP retirement), `aff34cc` (content-free export and cascade evidence). +- **Remaining work:** full account deletion remains SEC-009; durable/new-message drafts; shared thread/application actions and category capabilities; free/pro and browser/production verification. Existing connections need explicit re-consent; IMAP remains read-only. No real email; uncertain sends need manual reconciliation. ### JOBS-001 — Job-search source and assessment redesign diff --git a/docs/work-programmes/session-handoff.md b/docs/work-programmes/session-handoff.md index fb1ca7f..97da1d0 100644 --- a/docs/work-programmes/session-handoff.md +++ b/docs/work-programmes/session-handoff.md @@ -2,17 +2,17 @@ Updated: 2026-08-10 -- **Exact current task:** MAIL-001 — inventory and add non-sensitive `EmailSendAttempt` coverage to readable account export and complete deletion verification. -- **Last completed step:** legacy follow-up SMTP retirement was committed/pushed as `8fe3903`; follow-up drafts route to canonical Job email and the old direct-delivery API returns 410 without an SMTP dependency. -- **Files currently modified:** MAIL-001/DEP-001 verification and tracking documents only; application/dependency changes are committed. -- **Commands already run:** dependency tree/advisory review; `npm audit`; six focused router suites; full frontend; two production builds; legacy follow-up/backend worker focused tests; full backend; focused legacy UI. See V-126–V-137; legacy evidence is pending V-138. -- **Test results:** npm audit 0 vulnerabilities; router focused 24/24; frontend 49/49 suites and 190/190 tests; production build passes. MAIL-001 legacy follow-up/backend worker 10/10, focused UI 2/2 and backend 621/621 passed before the dependency upgrade; full frontend/build also pass with both working-tree changes present. +- **Exact current task:** MAIL-001 — trace shared provider-neutral thread/application actions and implement only capabilities the existing providers can safely support. +- **Last completed step:** content-free send-attempt export and hard-job-delete cascade coverage was committed/pushed as `aff34cc`; encrypted/daily exports exclude the internal payload hash and two-owner tests pass. +- **Files currently modified:** MAIL-001 export/cascade verification and tracking documents only; application/dependency changes are committed. +- **Commands already run:** dependency tree/advisory review; `npm audit`; router/full frontend/build; legacy follow-up/backend worker/UI; export/backup/daily worker/cascade focused tests; full backend. See V-126–V-139. +- **Test results:** npm audit 0 vulnerabilities; router focused 24/24; frontend 49/49 suites and 190/190 tests; production build passes. MAIL-001 export/cascade focused 16/16, legacy follow-up/backend worker 10/10, legacy UI 2/2 and full backend 622/622 pass. - **Services currently running:** none started intentionally. Exact task-owned hung Jest/build Node processes were stopped; Codex browser runtimes were not touched. Pre-existing Docker services were not changed. - **Temporary files or processes:** none. No provider account, private email, external model, paid service or production service was accessed. - **Production changes currently active:** none. No deployment, migration, provider connection/sync/send or production payload occurred. - **Rollback status:** revert `ee5ef7e` to stop recovery, then `449faeb` to remove the composer; keep admission disabled before reverting `123fc55`/`e9937ac` and downgrade the ledger before reverting `653f011`. No production migration/deploy/provider grant occurred. -- **Uncommitted changes:** MAIL-001 legacy-send evidence/tracking only; commit/push before editing export/deletion code. +- **Uncommitted changes:** MAIL-001 export/cascade evidence/tracking only; commit/push before the next application increment. - **Known failures:** durable/new-message drafts, export coverage, full thread/category actions and non-Gmail review remain; existing accounts need re-consent and IMAP stays read-only. Browser/provider/MariaDB/production unavailable or unverified; recovery scan performance is unmeasured at large ledger scale; Jest open handles; SEC-006 parser dependency work is still separately gated; parser isolation remains SEC-007. DEP-001 still needs remote CI/live confirmation. -- **Exact next action:** commit/push V-138 tracking, then trace export DTO/archive and account/job deletion cascades for `EmailSendAttempt`; implement the smallest owner-readable metadata export and regression tests without exporting recipient/subject/body (which are not stored in the ledger). +- **Exact next action:** commit/push V-139 tracking, then inventory Gmail/Graph/IMAP read/unread/archive/pin/read-later/spam/trash contracts and job-workspace embedding. Do not invent unsupported cross-provider actions; expose capability differences and reuse the canonical detail/link domain. - **Work that can continue independently:** remaining MAIL-001 repository work and later UX packages. SEC-006/007 await package-index permission; PROD-001/003/004 await production access. - **Decisions still required from the user:** none for synthetic/code-inspected repository work. Any provider connection or send test, internet/package upgrades, private data, external/paid providers and production actions retain explicit approval/safety gates; SEC-009 retention/legal policy remains unresolved.