Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e514272e1 | |||
| 1dabbeb233 |
@@ -853,6 +853,35 @@ public sealed class GmailControllerTests
|
|||||||
Assert.Equal("Need manual review", decision.Note);
|
Assert.Equal("Need manual review", decision.Note);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Unlink_thread_cannot_remove_another_users_messages()
|
||||||
|
{
|
||||||
|
await using var db = CreateDb();
|
||||||
|
var company = new Company { Name = "Other company", OwnerUserId = "user-2" };
|
||||||
|
db.Companies.Add(company);
|
||||||
|
await db.SaveChangesAsync();
|
||||||
|
|
||||||
|
var job = new JobApplication { JobTitle = "Private role", CompanyId = company.Id, OwnerUserId = "user-2" };
|
||||||
|
db.JobApplications.Add(job);
|
||||||
|
await db.SaveChangesAsync();
|
||||||
|
db.Correspondences.Add(new Correspondence
|
||||||
|
{
|
||||||
|
JobApplicationId = job.Id,
|
||||||
|
From = "Company",
|
||||||
|
Content = "Private message",
|
||||||
|
ExternalMessageId = "other-message",
|
||||||
|
ExternalThreadId = "other-thread"
|
||||||
|
});
|
||||||
|
await db.SaveChangesAsync();
|
||||||
|
|
||||||
|
var controller = CreateController(db, Mock.Of<IGmailOAuthService>(), "user-1");
|
||||||
|
var result = await controller.UnlinkThread(new UnlinkGmailThreadRequest(job.Id, "other-thread", null, "review"), CancellationToken.None);
|
||||||
|
|
||||||
|
Assert.IsType<NotFoundObjectResult>(result.Result);
|
||||||
|
Assert.Single(await db.Correspondences.IgnoreQueryFilters().ToListAsync());
|
||||||
|
Assert.Empty(await db.GmailReviewDecisions.IgnoreQueryFilters().ToListAsync());
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Relink_thread_can_move_messages_from_other_jobs()
|
public async Task Relink_thread_can_move_messages_from_other_jobs()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -174,3 +174,4 @@ Output was reduced to filenames and commit counts. The token artifact appears un
|
|||||||
| V-140 | Running local API/frontend plus in-app browser at `/correspondence` and `/correspondence/review`; DOM/URL/layout/server-log inspection; screenshots | Local development environment | Verify authenticated empty Job email, disconnected capability states, view navigation and compatibility redirect in a real browser | PASS/PARTIAL — linked view and review view render; provider states are explicit; direct legacy route canonicalizes to `?view=review`; 1280×720 document width equals viewport; expected disconnected Gmail 409s are handled without 5xx; screenshots saved | Disposable local account/database only. No provider/send. Browser could not resize or dispatch native Tab traversal, so required widths/themes/keyboard and production remain blocked | Browser/tool/provider limitation |
|
| V-140 | Running local API/frontend plus in-app browser at `/correspondence` and `/correspondence/review`; DOM/URL/layout/server-log inspection; screenshots | Local development environment | Verify authenticated empty Job email, disconnected capability states, view navigation and compatibility redirect in a real browser | PASS/PARTIAL — linked view and review view render; provider states are explicit; direct legacy route canonicalizes to `?view=review`; 1280×720 document width equals viewport; expected disconnected Gmail 409s are handled without 5xx; screenshots saved | Disposable local account/database only. No provider/send. Browser could not resize or dispatch native Tab traversal, so required widths/themes/keyboard and production remain blocked | Browser/tool/provider limitation |
|
||||||
| V-141 | Gitea commit status and public run 608/609 log/status inspection; focused `e2e/smoke.spec.ts` assertion review; `npm run test:e2e`; `git diff --check` | Repository root / `job-tracker-ui` | Verify the reported deployment audit remediation remotely and correct the next evidence-backed CI failure | PASS/PARTIAL — run 608 passed the audit then exposed stale Career Workspace copy; the behavior-based correction passes Playwright 4/4 locally and replacement run 609 passes the complete pull-request CI job in 4m20s | Merge-to-main live deploy remains pending; deploy was correctly skipped for the pull request and no production action occurred | Remote CI verified; live pending |
|
| V-141 | Gitea commit status and public run 608/609 log/status inspection; focused `e2e/smoke.spec.ts` assertion review; `npm run test:e2e`; `git diff --check` | Repository root / `job-tracker-ui` | Verify the reported deployment audit remediation remotely and correct the next evidence-backed CI failure | PASS/PARTIAL — run 608 passed the audit then exposed stale Career Workspace copy; the behavior-based correction passes Playwright 4/4 locally and replacement run 609 passes the complete pull-request CI job in 4m20s | Merge-to-main live deploy remains pending; deploy was correctly skipped for the pull request and no production action occurred | Remote CI verified; live pending |
|
||||||
| V-142 | Provider-scope/contract inventory; focused correspondence context/inbox/job-detail Jest; full frontend Jest; production build; `git diff --check` | Repository root / `job-tracker-ui` | Verify the shared Application Workspace passes real job context without inventing unsupported provider actions | PASS — removed `null as any`; both application surfaces use one small context contract; focused 3/3 suites and 10/10 tests; full 50/50 suites and 192/192 tests; production build/TypeScript pass; `ff547df` committed | Gmail/Graph installed scopes do not include mutation and IMAP is read-only; no provider/network/browser/production action occurred | Provider mutation remains unsupported and honestly deferred |
|
| V-142 | Provider-scope/contract inventory; focused correspondence context/inbox/job-detail Jest; full frontend Jest; production build; `git diff --check` | Repository root / `job-tracker-ui` | Verify the shared Application Workspace passes real job context without inventing unsupported provider actions | PASS — removed `null as any`; both application surfaces use one small context contract; focused 3/3 suites and 10/10 tests; full 50/50 suites and 192/192 tests; production build/TypeScript pass; `ff547df` committed | Gmail/Graph installed scopes do not include mutation and IMAP is read-only; no provider/network/browser/production action occurred | Provider mutation remains unsupported and honestly deferred |
|
||||||
|
| V-143 | Focused correspondence-inbox Jest; focused Gmail unlink API tests; full backend/frontend; production build; `git diff --check` | Repository root / `job-tracker-ui` | Verify canonical-hub Gmail unlink confirmation, provider-copy disclosure and cross-user isolation | PASS — hub 8/8; unlink API 2/2 including real-database User A/User B denial; backend 623/623; frontend 50/50 suites and 193/193 tests; build/TypeScript pass; `1dabbeb` committed | Mocked UI and local SQLite only; no provider message was deleted and no provider/network/production action occurred | Browser/provider/production verification remains |
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ Status: `IN PROGRESS`. Canonical hub routing, provider-neutral reads, explicit-c
|
|||||||
- Confirmed composer focused tests: 7/7.
|
- Confirmed composer focused tests: 7/7.
|
||||||
- Full backend: 620/620; full frontend: 49/49 suites, 190/190 tests.
|
- Full backend: 620/620; full frontend: 49/49 suites, 190/190 tests.
|
||||||
- Production build/TypeScript and `git diff --check`: pass.
|
- Production build/TypeScript and `git diff --check`: pass.
|
||||||
- Implementation commits: `6008b4a`, `536d403`, `a20775c`, `653f011`, `e9937ac`, `123fc55`, `449faeb`, `ee5ef7e`, `8fe3903`, `aff34cc`, `ff547df`.
|
- Implementation commits: `6008b4a`, `536d403`, `a20775c`, `653f011`, `e9937ac`, `123fc55`, `449faeb`, `ee5ef7e`, `8fe3903`, `aff34cc`, `ff547df`, `1dabbeb`.
|
||||||
|
|
||||||
## Implemented editable composer increment
|
## Implemented editable composer increment
|
||||||
|
|
||||||
@@ -114,9 +114,17 @@ Status: `IN PROGRESS`. Canonical hub routing, provider-neutral reads, explicit-c
|
|||||||
- This does not broaden Gmail/Graph scopes or claim read/unread/archive/spam/trash mutation support. Current installed provider contracts remain read plus explicit-confirmed Gmail/Graph send only.
|
- This does not broaden Gmail/Graph scopes or claim read/unread/archive/spam/trash mutation support. Current installed provider contracts remain read plus explicit-confirmed Gmail/Graph send only.
|
||||||
- Focused correspondence/context tests pass 10/10; full frontend passes 50/50 suites and 192/192 tests; production build/TypeScript passes.
|
- Focused correspondence/context tests pass 10/10; full frontend passes 50/50 suites and 192/192 tests; production build/TypeScript passes.
|
||||||
|
|
||||||
|
## Implemented canonical-hub unlink increment
|
||||||
|
|
||||||
|
- Gmail-linked rows in the canonical Job email hub now expose the same existing unlink domain used by the per-job view; Outlook, IMAP and manual rows do not display a capability they lack.
|
||||||
|
- Unlink requires the app-owned destructive confirmation and states that only the JobTracker link/import is removed; the provider copy is not deleted.
|
||||||
|
- A confirmed action returns the thread to recruitment review, refreshes the canonical inbox and clears any open detail for the removed row. Cancelling invokes no API.
|
||||||
|
- The existing API resolves the job through the authenticated owner before deleting linked rows. A real-database two-user regression proves User A receives not-found and cannot remove User B's correspondence or create a review decision.
|
||||||
|
- Focused hub UI passes 8/8 and unlink API passes 2/2; full backend passes 623/623, full frontend 50/50 suites and 193/193 tests, and production build/TypeScript passes.
|
||||||
|
|
||||||
## Remaining MAIL-001 work
|
## Remaining MAIL-001 work
|
||||||
|
|
||||||
- Extend shared provider-neutral thread navigation and application embedding while preserving provider capability differences.
|
- Extend shared provider-neutral thread navigation while preserving provider capability differences; application context and Gmail unlink are now shared.
|
||||||
- Surface provider identity, reauthorization, read/unread, pin/read-later/archive/spam/trash only where the provider supports it.
|
- 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.
|
- 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.
|
- Add durable draft/refresh recovery and compose-new-message behavior if confirmed by the remaining workflow inventory; replies are implemented.
|
||||||
|
|||||||
@@ -499,3 +499,13 @@
|
|||||||
- **Consequences:** both application surfaces now generate the same optional contextual searches without automatic linking. Provider category mutations remain explicit remaining work that requires a separately reviewed scope/re-consent design.
|
- **Consequences:** both application surfaces now generate the same optional contextual searches without automatic linking. Provider category mutations remain explicit remaining work that requires a separately reviewed scope/re-consent design.
|
||||||
- **User approval required:** No; this is a local shared-view correction inside active MAIL-001 and invokes no provider.
|
- **User approval required:** No; this is a local shared-view correction inside active MAIL-001 and invokes no provider.
|
||||||
- **Reversible:** Yes. Revert the context-prop changes and test; stored data, scopes and provider grants are unchanged.
|
- **Reversible:** Yes. Revert the context-prop changes and test; stored data, scopes and provider grants are unchanged.
|
||||||
|
|
||||||
|
## DEC-051 — Unlink the app relationship, never the provider copy
|
||||||
|
|
||||||
|
- **Date:** 2026-08-10
|
||||||
|
- **Decision:** Expose confirmed Gmail unlink in the canonical hub through the existing owner-scoped unlink endpoint. Label the data effect explicitly and show no equivalent action for providers without a supported link domain.
|
||||||
|
- **Reason/evidence:** unlink already existed in the per-job component but not the hub, creating inconsistent copies of the same workflow. The endpoint removes imported JobTracker correspondence for the owned job and returns the thread to review; it does not call Gmail deletion. UI confirmation and real-SQLite two-user tests pass.
|
||||||
|
- **Alternatives considered:** delete provider mail; implement a duplicate endpoint; show disabled Outlook/IMAP actions; remove unlink from the per-job view. These broaden authority, duplicate behavior, mislead users or regress a supported workflow.
|
||||||
|
- **Consequences:** a thread can be reconsidered in recruitment review after unlink. Imported JobTracker copies are removed only after confirmation, while the mailbox remains untouched. Relink/move stays on the existing per-job management surface for now.
|
||||||
|
- **User approval required:** No; this is local implementation of the approved MAIL-001 unlink workflow and uses only mocked/synthetic data.
|
||||||
|
- **Reversible:** Yes. Revert `1dabbeb`; the endpoint and per-job unlink remain available, with no schema/provider grant change.
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
Updated: 2026-08-10
|
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 eleven committed implementation increments. Gitea run 609 passes complete pull-request CI in 4m20s; DEP-001 now awaits approved merge-to-main and production verification only.
|
- **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 twelve committed implementation increments. Gitea run 609 passes complete pull-request CI in 4m20s; DEP-001 now awaits approved merge-to-main and production verification only.
|
||||||
- **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. The dedicated Application Workspace now supplies the same contextual suggestion contract as the job dialog. Shared provider actions/capability behavior is next; full account deletion stays SEC-009.
|
- **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. The dedicated Application Workspace shares contextual suggestions, and the hub now confirms Gmail unlink with two-user isolation. Explicit capability reporting and remaining provider actions are next; 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.
|
- **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`).
|
- **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.
|
- **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.
|
- **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.
|
- **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`.
|
- **Status counts:** 7 `VERIFIED LOCALLY`; 19 `IMPLEMENTED — NOT VERIFIED`; 1 `IN PROGRESS`; 8 `NOT STARTED`; 5 `BLOCKED`; 0 `DONE`; 0 `DEFERRED`.
|
||||||
- **Test status:** backend 622/622; frontend 50/50 suites and 192/192 tests; Playwright smoke 4/4; npm audit 0 vulnerabilities; DEP-001 focused router 24/24 and production build pass; MAIL-001 shared context 10/10, 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/V-142.
|
- **Test status:** backend 623/623; frontend 50/50 suites and 193/193 tests; Playwright smoke 4/4; npm audit 0 vulnerabilities; DEP-001 focused router 24/24 and production build pass; MAIL-001 hub unlink 8/8 UI and 2/2 API, shared context 10/10, 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/V-142/V-143.
|
||||||
- **Deployment status:** Gitea pull-request run 609 passed the complete CI job in 4m20s. Deploy was intentionally skipped because the workflow deploys only a `push` to `main`; live remains unchanged. No merge/deployment was performed directly, no production migrations were run and the AI operation worker remains disabled by default.
|
- **Deployment status:** Gitea pull-request run 609 passed the complete CI job in 4m20s. Deploy was intentionally skipped because the workflow deploys only a `push` to `main`; live remains unchanged. No merge/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.
|
- **Production status:** Unchanged and unverified. No provider/model call, model pull, external request or paid API occurred.
|
||||||
- **Known regressions:** None found by automated/local browser checks. Jest still needs `--forceExit` and reports its existing open-handle notice. Email-provider/send tests are fake/local only; real delivery is not claimed. Current MAIL browser evidence is 1280×720 only because the browser surface could not resize or perform native Tab traversal. 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.
|
- **Known regressions:** None found by automated/local browser checks. Jest still needs `--forceExit` and reports its existing open-handle notice. Email-provider/send tests are fake/local only; real delivery is not claimed. Current MAIL browser evidence is 1280×720 only because the browser surface could not resize or perform native Tab traversal. 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.
|
||||||
|
|||||||
@@ -651,8 +651,8 @@ Ordering differences from the suggested list:
|
|||||||
- **Required production verification:** provider read/draft/send requires explicit authorized synthetic account; never real unsolicited email.
|
- **Required production verification:** provider read/draft/send requires explicit authorized synthetic account; never real unsolicited email.
|
||||||
- **Status:** `IN PROGRESS`.
|
- **Status:** `IN PROGRESS`.
|
||||||
- **Blocker:** real provider verification is external; required 375/768/1440/theme/keyboard browser gates were unavailable in the current browser surface. Mocked/local repository implementation remains unblocked.
|
- **Blocker:** real provider verification is external; required 375/768/1440/theme/keyboard browser gates were unavailable in the current browser surface. Mocked/local repository implementation remains unblocked.
|
||||||
- **Evidence:** `docs/verification/mail-001-job-email-hub.md`; V-126–V-142. Shared application context focused 10/10; 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 50/50 suites and 192/192 tests plus build/audit; local empty/disconnected and compatibility-route browser smoke at 1280×720.
|
- **Evidence:** `docs/verification/mail-001-job-email-hub.md`; V-126–V-143. Hub unlink 8/8 UI and 2/2 API; shared application context focused 10/10; 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 623/623; frontend 50/50 suites and 193/193 tests plus build/audit; local empty/disconnected and compatibility-route browser smoke at 1280×720.
|
||||||
- **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), `ff547df` (shared application context).
|
- **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), `ff547df` (shared application context), `1dabbeb` (confirmed hub unlink).
|
||||||
- **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.
|
- **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
|
### JOBS-001 — Job-search source and assessment redesign
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
Updated: 2026-08-10
|
Updated: 2026-08-10
|
||||||
|
|
||||||
- **Exact current task:** MAIL-001 — trace shared provider-neutral thread/application actions and implement only capabilities the existing providers can safely support.
|
- **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:** Gitea run 609 passed complete pull-request CI in 4m20s. MAIL-001 shared application context then removed the workspace `null as any`; focused 10/10, full frontend 192/192 and production build pass.
|
- **Last completed step:** canonical Job email now confirms Gmail unlink, returns the thread to review and protects cross-user records; `1dabbeb` is committed and backend 623/623/frontend 193/193/build pass.
|
||||||
- **Files currently modified:** DEP-001/MAIL tracking only; shared context implementation is committed as `ff547df`.
|
- **Files currently modified:** MAIL-001/DEP tracking only; unlink implementation is committed as `1dabbeb`.
|
||||||
- **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; Gitea status/log inspection; full `npm run test:e2e`; MAIL context focused/full frontend/build. See V-126–V-142.
|
- **Commands already run:** dependency/audit/router/full frontend/build; legacy follow-up/export/recovery/provider suites; full backend; Gitea run inspection; Playwright; MAIL shared-context and hub-unlink focused/full suites/build. See V-126–V-143.
|
||||||
- **Test results:** npm audit 0 vulnerabilities; Gitea pull-request CI PASS in 4m20s; router focused 24/24; frontend 50/50 suites and 192/192 tests; Playwright 4/4; production build passes. MAIL-001 shared context 10/10, export/cascade focused 16/16, legacy follow-up/backend worker 10/10, legacy UI 2/2 and full backend 622/622 pass.
|
- **Test results:** npm audit 0 vulnerabilities; Gitea pull-request CI PASS in 4m20s; backend 623/623; frontend 50/50 suites and 193/193 tests; Playwright 4/4; production build passes. MAIL unlink 8/8 UI and 2/2 API; shared context 10/10; export/cascade 16/16.
|
||||||
- **Services currently running:** none on task-owned ports 3000/5202. Playwright stopped its disposable API/Next servers. Pre-existing Docker services were not changed.
|
- **Services currently running:** none on task-owned ports 3000/5202. Playwright stopped its disposable API/Next servers. Pre-existing Docker services were not changed.
|
||||||
- **Temporary files or processes:** disposable local user `audit-mail-20260810@example.test`, its local session, two synthetic screenshots and a startup-created local database backup. The API applied already-committed pending development migrations to the local development database. No provider account, real email, private content, paid service or production service was accessed.
|
- **Temporary files or processes:** disposable local user `audit-mail-20260810@example.test`, its local session, two synthetic screenshots and a startup-created local database backup. The API applied already-committed pending development migrations to the local development database. No provider account, real email, private content, paid service or production service was accessed.
|
||||||
- **Production changes currently active:** none. No deployment, migration, provider connection/sync/send or production payload occurred.
|
- **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.
|
- **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:** tracking for `ff547df` and remote CI run 609 only; commit and push before the next implementation increment.
|
- **Uncommitted changes:** tracking for `1dabbeb` only; commit and push before the next implementation increment.
|
||||||
- **Known failures:** live deployment is not verified because PR deploy is intentionally skipped and the active branch is not approved for merge. Durable/new-message drafts, 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.
|
- **Known failures:** live deployment is not verified because PR deploy is intentionally skipped and the active branch is not approved for merge. Durable/new-message drafts, 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.
|
||||||
- **Exact next action:** commit/push the tracking for `ff547df`, then design explicit provider capability reporting before any Gmail modify/Graph read-write scope expansion. Do not invent unsupported cross-provider actions.
|
- **Exact next action:** commit/push the tracking for `1dabbeb`, then design explicit provider capability reporting before any Gmail modify/Graph read-write scope expansion. Do not invent unsupported cross-provider actions.
|
||||||
- **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.
|
- **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.
|
- **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.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import '@testing-library/jest-dom';
|
import '@testing-library/jest-dom';
|
||||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
||||||
import { MemoryRouter, Navigate, Route, Routes } from 'react-router-dom';
|
import { MemoryRouter, Navigate, Route, Routes } from 'react-router-dom';
|
||||||
import { ToastProvider } from './toast';
|
import { ToastProvider } from './toast';
|
||||||
import { ConfirmProvider } from './confirm';
|
import { ConfirmProvider } from './confirm';
|
||||||
@@ -120,6 +120,27 @@ describe('CorrespondenceInboxPage', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('unlinks a Gmail thread only after confirmation and returns it to review', async () => {
|
||||||
|
mockedApi.post.mockResolvedValue({ data: { threadId: 'thread-1', jobApplicationId: 42, removedMessages: 1, decision: 'review' } } as any);
|
||||||
|
renderPage();
|
||||||
|
|
||||||
|
fireEvent.click(await screen.findByRole('button', { name: /^unlink thread$/i }));
|
||||||
|
expect(mockedApi.post).not.toHaveBeenCalled();
|
||||||
|
|
||||||
|
const dialog = await screen.findByRole('dialog');
|
||||||
|
expect(within(dialog).getByText(/provider copy is not deleted/i)).toBeInTheDocument();
|
||||||
|
fireEvent.click(within(dialog).getByRole('button', { name: /^unlink thread$/i }));
|
||||||
|
|
||||||
|
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledWith('/gmail/unlink-thread', {
|
||||||
|
jobApplicationId: 42,
|
||||||
|
threadId: 'thread-1',
|
||||||
|
note: 'Unlinked from Job email hub',
|
||||||
|
nextDecision: 'review',
|
||||||
|
}));
|
||||||
|
await waitFor(() => expect(mockedApi.get).toHaveBeenCalledWith('/correspondence', expect.anything()));
|
||||||
|
expect(await screen.findByText(/returned to recruitment review/i)).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
test('falls back to the saved copy when provider detail is unavailable', async () => {
|
test('falls back to the saved copy when provider detail is unavailable', async () => {
|
||||||
const original = mockedApi.get.getMockImplementation();
|
const original = mockedApi.get.getMockImplementation();
|
||||||
mockedApi.get.mockImplementation((url: string, config?: any) => {
|
mockedApi.get.mockImplementation((url: string, config?: any) => {
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ export default function CorrespondenceInboxPage() {
|
|||||||
const [sendResult, setSendResult] = useState<EmailSendResult | null>(null);
|
const [sendResult, setSendResult] = useState<EmailSendResult | null>(null);
|
||||||
const [sendError, setSendError] = useState<string | null>(null);
|
const [sendError, setSendError] = useState<string | null>(null);
|
||||||
const [sending, setSending] = useState(false);
|
const [sending, setSending] = useState(false);
|
||||||
|
const [unlinkingThreadId, setUnlinkingThreadId] = useState<string | null>(null);
|
||||||
|
|
||||||
const load = useCallback(async () => {
|
const load = useCallback(async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -281,6 +282,37 @@ export default function CorrespondenceInboxPage() {
|
|||||||
setSendError(null);
|
setSendError(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const unlinkGmailThread = async (item: CorrespondenceInboxItem) => {
|
||||||
|
if (item.provider !== "gmail" || !item.externalThreadId || unlinkingThreadId) return;
|
||||||
|
if (!(await confirm({
|
||||||
|
title: "Unlink Gmail thread?",
|
||||||
|
message: `Remove this Gmail thread from ${item.companyName || "this job"} and return it to recruitment review? The provider copy is not deleted.`,
|
||||||
|
confirmLabel: "Unlink thread",
|
||||||
|
destructive: true,
|
||||||
|
}))) return;
|
||||||
|
|
||||||
|
setUnlinkingThreadId(item.externalThreadId);
|
||||||
|
try {
|
||||||
|
await api.post("/gmail/unlink-thread", {
|
||||||
|
jobApplicationId: item.jobApplicationId,
|
||||||
|
threadId: item.externalThreadId,
|
||||||
|
note: "Unlinked from Job email hub",
|
||||||
|
nextDecision: "review",
|
||||||
|
});
|
||||||
|
if (selectedMessageId === item.id) {
|
||||||
|
detailRequest.current += 1;
|
||||||
|
setSelectedMessageId(null);
|
||||||
|
setMessageDetail(null);
|
||||||
|
}
|
||||||
|
await load();
|
||||||
|
toast("Gmail thread returned to recruitment review.", "success");
|
||||||
|
} catch (error) {
|
||||||
|
toast(getApiErrorMessage(error, "Failed to unlink the Gmail thread."), "error");
|
||||||
|
} finally {
|
||||||
|
setUnlinkingThreadId(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper
|
<Paper
|
||||||
sx={{
|
sx={{
|
||||||
@@ -401,6 +433,11 @@ export default function CorrespondenceInboxPage() {
|
|||||||
{item.attachmentCount > 0 ? <Chip size="small" label={`${item.attachmentCount} attachments`} variant="outlined" /> : null}
|
{item.attachmentCount > 0 ? <Chip size="small" label={`${item.attachmentCount} attachments`} variant="outlined" /> : null}
|
||||||
<Button size="small" variant="text" onClick={() => void showMessage(item)}>{selectedMessageId === item.id ? "Hide message" : "View message"}</Button>
|
<Button size="small" variant="text" onClick={() => void showMessage(item)}>{selectedMessageId === item.id ? "Hide message" : "View message"}</Button>
|
||||||
<Button size="small" variant="text" onClick={() => navigate(`/jobs?open=${item.jobApplicationId}`)}>Open job</Button>
|
<Button size="small" variant="text" onClick={() => navigate(`/jobs?open=${item.jobApplicationId}`)}>Open job</Button>
|
||||||
|
{item.provider === "gmail" && item.externalThreadId ? (
|
||||||
|
<Button size="small" color="warning" variant="text" disabled={unlinkingThreadId === item.externalThreadId} onClick={() => void unlinkGmailThread(item)}>
|
||||||
|
{unlinkingThreadId === item.externalThreadId ? "Unlinking…" : "Unlink thread"}
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
{selectedMessageId === item.id ? (
|
{selectedMessageId === item.id ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user