Skip to main content

Documentation Index

Fetch the complete documentation index at: https://grantmaster.dev/llms.txt

Use this file to discover all available pages before exploring further.

EventBus Gap Report

This document catalogues all known places in GrantMaster where the EventBus Rule (emit events for significant transactional data changes) is not satisfied. Each gap was identified during the feature-level documentation pass in March 2026.
EventBus Rule (from base-service-and-eventbus.md): Services MUST emit EventBus events for approval/rejection workflows, entity lifecycle events, critical business thresholds, compliance and audit events, and submission events requiring manager attention.
Gaps are grouped by domain, ordered by business impact (high → low).

Priority: High — Audit & Compliance Impact

1. grantors — No Funder Relationship Events

File: src/features/grantors/services/ Missing events:
Suggested EventTriggerWhy It Matters
GRANTOR_INTERACTION_LOGGEDcreateInteraction()Compliance audit trail for funder engagement
GRANTOR_FOLLOW_UP_COMPLETEDcompleteFollowUp()Relationship health tracking
GRANTOR_DEADLINE_CREATEDcreateDeadline()Deadline pipeline for compliance monitoring
GRANTOR_DEADLINE_COMPLETEDcompleteDeadline()Compliance close-out event
GRANTOR_ENGAGEMENT_CHANGEDcalculateEngagementScore() when level changesRisk escalation trigger
Where to add: GrantorRelationshipService, ReportingCalendarService Impact if missing: Compliance auditors cannot reconstruct funder engagement history from the EventBus; they must rely on auditLogs alone.

2. relations — No Contact Lifecycle Events

File: src/features/relations/services/ Missing events:
Suggested EventTriggerWhy It Matters
CONTACT_CREATEDcreateContact()CRM audit trail
CONTACT_INTERACTION_LOGGEDlogInteraction()Engagement history
CONTACT_SEGMENT_UPDATEDevaluateContactSegments() when segments changeDownstream marketing/comms triggers
Where to add: contactService, segmentService Impact if missing: No EventBus-sourced audit trail for contact management; no ability for downstream modules to react to CRM changes.

3. settings — No Policy Change Events

File: src/features/settings/services/settingsCanonical.ts and src/shared/auth/securityPolicyService.ts Missing events:
Suggested EventTriggerWhy It Matters
SECURITY_POLICY_UPDATEDMFA/password/session policy changeCompliance audit requirement
APPROVAL_ROUTING_CHANGEDApproval threshold or approver assignment changeAffects audit chain integrity
NOTIFICATION_PREFERENCES_UPDATEDOrg-wide notification setting changeLow priority — informational only
Where to add: securityPolicyService.updateMfaPolicy(), settingsCanonical.ts approval routing changes Impact if missing: Security policy changes are invisible to the EventBus. Auditors cannot detect if MFA was disabled or approval thresholds were lowered.

Priority: Medium — Business Process Integrity

4. partnerships — No Partnership Lifecycle Events

File: src/shared/partnerships/ Missing events:
Suggested EventTriggerWhy It Matters
PARTNER_JOINEDPartnerInvitationService.acceptInvitation()Partnership onboarding audit
REFERRAL_CREDIT_AWARDEDReferralCreditService.awardReferralCredits()Credit accounting audit trail
REVENUE_SHARE_PAIDRevenueShareService.markPayoutComplete()Financial reconciliation
Where to add: PartnerInvitationService, ReferralCreditService, RevenueShareService Impact if missing: Partnership and credit events are only traceable via Postmark emails — no in-system event history.

5. workflows — No Workflow Lifecycle Events

File: src/features/workflows/services/ Missing events:
Suggested EventTriggerWhy It Matters
WORKFLOW_CREATEDNew task/approval chain createdVisibility into operational workload
WORKFLOW_TASK_COMPLETEDIndividual task completedProgress tracking
WORKFLOW_APPROVAL_REQUESTEDApproval step triggeredAudit trail for approval chains
WORKFLOW_COMPLETEDAll steps doneBusiness process completion
WORKFLOW_OVERDUEDeadline passed without completionEscalation trigger
Where to add: workflowService, taskExecutionService Impact if missing: The workflows feature is purely a consumer and executor; it produces no observable events. Other features (compliance, reports) cannot react to workflow completions.

6. reports — No Report Generation Events

File: src/features/reports/services/ Missing events:
Suggested EventTriggerWhy It Matters
REPORT_GENERATEDReport created or exportedTemplate usage tracking (required by EventBus rule)
REPORT_SCHEDULEDAutomated report configuredAuditability of reporting cadence
REPORT_SHAREDReport distributed to external partyCompliance disclosure audit
Where to add: reportGenerationService, reportSchedulerService Impact if missing: Report generation is unobservable. The EventBus rule explicitly calls out template usage as a required emission trigger.

Priority: Low — Operational Observability

7. auth — No API Key or Session Policy Events

File: src/shared/auth/apiKeyService.ts, src/shared/auth/securityPolicyService.ts Missing events:
Suggested EventTriggerWhy It Matters
API_KEY_CREATEDcreateApiKey()Security audit trail
API_KEY_ROTATEDrotateApiKey()Key lifecycle tracking
API_KEY_REVOKEDrevokeApiKey()Immediate security event
Note: API_KEY_REVOKED may warrant High priority if used for emergency key invalidation. Where to add: apiKeyService — each lifecycle method.

8. integrations — No Third-Party Sync Events

File: src/shared/integrations/hubspot/, src/shared/integrations/xero/ Missing events:
Suggested EventTriggerWhy It Matters
HUBSPOT_SYNC_COMPLETEDHubSpotSyncService.runFullSync()Sync health monitoring
HUBSPOT_SYNC_FAILEDSync errorError alerting
XERO_SYNC_FAILEDXero sync errorFinancial data integrity alert
WEBHOOK_DELIVERY_FAILEDOutbound webhook failureIntegration reliability tracking
Where to add: HubSpotSyncService, XeroAuthService, integrationService.logWebhookEvent()

Implementation Notes

When adding missing events:
  1. Use emitCanonicalSystemEvent() from src/shared/events/canonicalEventEmitter.ts — not raw eventBus.emit().
  2. Add the new event type to SystemEventType in @grantmaster/shared/events.
  3. Add the payload type to EventPayloadMap in src/shared/events/canonicalEventMap.ts.
  4. Register a canonical consumer in src/shared/events/canonicalConsumers.ts if a downstream service should react.
  5. Emit after the Firestore write succeeds — never before (to avoid phantom events on failure).
  6. Use EventSeverity.INFO for lifecycle events, EventSeverity.WARNING for threshold/policy events, EventSeverity.CRITICAL for security events.
See shared/events API reference for the full emission pattern.

Summary Table

DomainMissing EventsPriorityEffort
grantors5 eventsHighMedium
relations3 eventsHighLow
settings / auth/security3 eventsHighLow
partnerships3 eventsMediumLow
workflows5 eventsMediumMedium
reports3 eventsMediumLow
auth/apiKeyService3 eventsLow–HighLow
integrations4 eventsLowMedium
Total29 events