3.7 KiB
3.7 KiB
Task EP.1.1 Activity Domain Foundation - 2026-07-10
Scope
- introduce the first additive
crm_activitieswrite model - add activity API, service, lightweight repository, and read-model shaping
- add foundational UI building blocks for sheet, form, detail, and badges
- preserve legacy lead, opportunity, and quotation follow-up implementations
Review Summary
Reviewed before implementation:
AGENTS.mdplans/task-ep1.1.mddocs/standards/task-contract-template.mddocs/standards/task-catalog.mddocs/standards/project-foundations.mddocs/standards/architecture-rules.mddocs/standards/ui-ux-rules.mddocs/standards/task-review-checklist.mddocs/security/crm-authorization-boundaries.mddocs/business/relationship-sales-workspace-blueprint-v1.mddocs/implementation/task-bu-r.0.1-workspace-activity-business-blueprint-2026-07-07.mddocs/implementation/task-ar.1-architecture-transition-plan-2026-07-07.mddocs/implementation/task-ar.2-epic-technical-design-2026-07-07.mddocs/implementation/task-ar.2-workspace-ui-ux-design-note-2026-07-07.mdplans/task-eng.0.md- existing follow-up services and route handlers under
src/features/crm/leads/**,src/features/crm/opportunities/**, andsrc/features/crm/quotations/** - existing CRM security, audit, and customer detail foundations
Foundations Reused
src/lib/auth/session.tssrc/features/crm/security/server/service.tssrc/features/foundation/audit-log/service.tssrc/features/foundation/display/server/display-resolver.ts- existing customer, lead, opportunity, and quotation detail services for primary-record access validation
Implementation Notes
crm_activitiesis additive and does not replace existing follow-up tables or audit-backed lead follow-up behavior.- activity visibility reuses resolved CRM scope plus owner/assignee visibility and an internal-only rule for manager/admin style access.
- pricing-sensitive activity content is redacted when tied to quotation or PO context without quotation pricing visibility.
- follow-up adapters are documented as candidate contracts only in this phase. No data migration or dual-write was introduced.
Follow-up Gap Analysis
- Lead follow-up is still audit-log-backed rather than row-backed, so migration needs an adapter that can translate immutable audit entries into activity candidates without rewriting history.
- Opportunity follow-up is row-backed and is the cleanest EP.1.2 consolidation seam.
- Quotation follow-up is row-backed and can follow the same adapter path as opportunity follow-up, but pricing visibility rules must stay active when notes expose commercial values.
- Dashboard and report consumers still read legacy follow-up data today, so EP.1.2 needs continuity checks before any shared activity projection becomes source input.
Migration Preparation Report
- prepared:
- shared activity write model
- route-handler boundary
- service-owned lifecycle validation
- repository/read-model split
- projection contract interfaces
- basic activity UI foundation
- deferred intentionally:
- timeline projection
- calendar projection
- notification fan-out
- legacy follow-up storage migration
- dashboard/report dataset swap
Verification Plan
- run
npm run typecheck - run
npm run db:generate - run targeted manual API smoke checks for create, update, assign, complete, cancel, reschedule, delete
Residual Risks
- current activity creation UI uses manual primary record id entry because source-record pickers are intentionally deferred to later workspace integration work
- contact primary-record validation remains lightweight and should be revisited when customer workspace activity embedding begins