feat(post-audit): Phase 3 EOI overrides + 3c spawn + 3d promote + Phase 4 worker
Phase 3b — EOI dialog field overrides:
- New EoiOverridesInput shape (clientEmail / clientPhone / yachtName)
threaded through generate-and-sign validator + both pathways
(in-app pdf-lib fill, Documenso template generate).
- src/lib/services/eoi-overrides.service.ts applies side-effects in one
transaction: useOnlyForThisEoi writes documents.override_* and stops;
setAsDefault demotes the prior primary + promotes (existing contactId)
or inserts + promotes (fresh value); neither flag inserts a non-primary
client_contacts row for future dropdown reuse.
- Document override columns persisted post-insert, with a 1-minute
source_document_id backfill on freshly inserted contact rows.
- eoi-context route returns available.{emails, phones} so the dialog
can render combobox options.
- <OverridableContactField> in eoi-generate-dialog.tsx renders the
combobox + manual input + 2 checkboxes per field with mutually
exclusive intent semantics.
Phase 3c — yacht spawn from EOI dialog:
- YachtForm gains createExtras + onCreated callbacks; the EOI dialog
opens it as a nested Sheet pre-filled with the linked client as owner.
On save the new yacht is stamped source='eoi-generated' and the
interest is PATCHed with the new yachtId so the EOI context reflows.
Phase 3d — promote-to-primary + audit + [EOI] badge:
- POST /api/v1/clients/:id/contacts/:contactId/promote-to-primary
(transactional demote+promote via promoteContactToPrimary).
- src/lib/audit.ts AuditAction type adds eoi_field_override,
promote_to_primary, eoi_spawn_yacht (DB column is free-text).
- ContactsEditor surfaces an [EOI] badge on non-primary rows where
source='eoi-custom-input'.
Phase 4 — worker + TOD picker:
- processOverdueReminders refactored to UPDATE...RETURNING with a
fired_at IS NULL gate so parallel workers can't double-fire. Uses
the idx_reminders_due_unfired partial index from migration 0072.
- /settings gets a "Default reminder time" time-of-day picker; the
value lands in user_profiles.preferences.digestTimeOfDay (validated
HH:MM at the route). <ReminderForm> seeds its dueAt from this
preference via a React-Query me-prefs fetch.
Phase 6 hardening:
- IMAP bounce poller strips whitespace from IMAP_PASS so a copy-paste
of Google Workspace's 16-char App Password formatted as
"abcd efgh ijkl mnop" still authenticates. Workspace activation
procedure documented in MASTER-PLAN §Phase 6 (was previously written
to CLAUDE.md, which was bloat — moved to the plan).
Quality gates: 1374/1374 vitest, tsc clean, lint 0 errors.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -868,19 +868,36 @@ Deferred:
|
||||
Returns the 3 dates on the API response; `interest-detail-header` threads them
|
||||
through to `<DealPulseChip>`. Chosen over new schema columns to keep the master
|
||||
plan's "no new tables" promise. Documented in CLAUDE.md.
|
||||
- ◐ Phase 3 — EOI field overrides (schema only; 9f57868)
|
||||
- ◐ Phase 3 — EOI field overrides (9f57868 + session 2026-05-18 PM)
|
||||
- ☑ 3a — Schema migration 0073, Drizzle additions, audit_actions free-text verbs
|
||||
- ☐ 3b — EOI dialog UI (combobox + 2 checkboxes per field)
|
||||
- ☐ 3c — Yacht spawn from EOI (inline Sheet + YachtForm)
|
||||
- ☐ 3d — Audit surfacing + client/yacht detail badges + set-primary endpoint
|
||||
- ◐ Phase 4 — Reminders (schema + service + form; fb4a09e + session 2026-05-18 PM)
|
||||
- ☑ 3b — EOI dialog UI overrides for email/phone/yacht-name; service-level
|
||||
side-effects (create non-primary contact, promote-to-primary, write
|
||||
documents.override\_\*) inside a single transaction via
|
||||
`src/lib/services/eoi-overrides.service.ts`. Both pathways (inapp +
|
||||
Documenso template) layer overrides onto the in-memory EoiContext
|
||||
before render. Audit verbs `eoi_field_override` + `promote_to_primary`
|
||||
- `eoi_spawn_yacht` formalised in `src/lib/audit.ts`. Address
|
||||
overrides + per-yacht detail badge deferred.
|
||||
- ☑ 3c — "+ New yacht" button next to yacht-name field opens nested
|
||||
`<YachtForm>` Sheet (pre-fills owner = current client, stamps
|
||||
`source='eoi-generated'`); on save, the interest's yachtId is patched
|
||||
so the EOI's yacht block populates without a manual re-link.
|
||||
- ☑ 3d — `POST /api/v1/clients/:id/contacts/:contactId/promote-to-primary`
|
||||
(transactional demote+promote via `promoteContactToPrimary`); `[EOI]`
|
||||
badge on non-primary contact rows in `<ContactsEditor>` with title-attr
|
||||
explainer. Yacht detail-page badge deferred.
|
||||
- ◐ Phase 4 — Reminders (fb4a09e + session 2026-05-18 PM)
|
||||
- ☑ Schema migration 0072: reminders.yacht_id + fired_at + interests.reminder_note
|
||||
- ☑ Service + validators accept yachtId with port-scoping check
|
||||
- ☑ Dialog UI extended with YachtPicker (free-text search, no clientId scope)
|
||||
- ☑ `<ReminderCard>` shows yacht subtitle (Ship icon + yacht name)
|
||||
- ☑ `listReminders` now filters by query.yachtId; `getReminder` joins yacht relation
|
||||
- ☐ Worker scheduler refactor (fired_at gate; cron tick)
|
||||
- ☐ user_profiles.preferences.digest_time_of_day picker in /settings
|
||||
- ☑ `listReminders` filters by query.yachtId; `getReminder` joins yacht relation
|
||||
- ☑ Worker `processOverdueReminders` claims due rows via `UPDATE...RETURNING`
|
||||
with `fired_at IS NULL` race-safe gate, so parallel workers can't
|
||||
double-fire the same reminder.
|
||||
- ☑ `user_profiles.preferences.digestTimeOfDay` picker on `/settings`
|
||||
(time input + help text). `<ReminderForm>` honours the preference via
|
||||
a React-Query me-prefs fetch keyed `['me', 'preferences']`.
|
||||
- ☐ Per-entity-page `[+ Task]` buttons threading `defaultYachtId` (etc.)
|
||||
- ◐ Phase 5 — Email-copy refactor (branding chain only; df1594d)
|
||||
- ☑ Per-port background URL — closes the last hard-coded portnimara.com asset
|
||||
@@ -898,6 +915,18 @@ Deferred:
|
||||
- ☐ Interest-detail "Emails" tab — surface tab doesn't exist yet; bounce banner
|
||||
would live there when the tab lands (deferred to a wider emails-surface session)
|
||||
- ☐ Manual round-trip test against real bounced delivery
|
||||
- **Workspace activation:** set `IMAP_HOST=imap.gmail.com`,
|
||||
`IMAP_PORT=993`, `IMAP_USER=<workspace-account>`, `IMAP_PASS=<app-password>`
|
||||
in the worker env. App Passwords are generated at Account → Security
|
||||
→ 2-Step Verification → App passwords. Google displays the password
|
||||
as **16 characters in 4 groups of 4 separated by spaces** (e.g.
|
||||
`abcd efgh ijkl mnop`). Per Google's own docs the spaces are visual
|
||||
only — paste the 16-char unbroken string into `.env`. The poller
|
||||
strips whitespace defensively (`src/jobs/processors/imap-bounce-poller.ts`)
|
||||
so a copy-paste with spaces still works. Bounces land in the
|
||||
envelope sender's mailbox (the SMTP user account), so pointing the
|
||||
poller at that single mailbox catches every automated-email bounce
|
||||
in one place.
|
||||
- ◐ Phase 7 — PDF template editor (field-map types only; 9f57868)
|
||||
- ☑ FieldMap type definitions + Zod validators + page-count cross-validator
|
||||
- ☐ 7.1 Read + place (~2 weeks): editor shell, page picker, marker drop
|
||||
|
||||
Reference in New Issue
Block a user