diff --git a/docs/Engineering_Reference_Manual.md b/docs/Engineering_Reference_Manual.md index de5fd320..ad673632 100644 --- a/docs/Engineering_Reference_Manual.md +++ b/docs/Engineering_Reference_Manual.md @@ -821,9 +821,10 @@ Every function module follows the same shape: | --- | --- | --- | | HTTPS onRequest | (none deployed) | The old `revenueCatWebhook` onRequest handler is in source but **not exported from `index.ts`** - see [Billing](#billing) for the enable steps. The unauthenticated `health` endpoint was removed in an earlier security review. | | HTTPS onCall | `createInviteCallable`, `acceptInviteCallable`, `syncEntitlement`, `submitOutcomeCallable`, `leaveCoupleCallable`, `checkDeviceIntegrity`, `assignDailyQuestionCallable`, `wrapReleaseKeyCallable`, `sendGentleReminderCallable`, `sendThinkingOfYouCallable` | Caller must be authenticated. Errors throw `HttpsError`. All v2 → `us-central1` via global `options.ts`. | -| Firestore onCreate / onDocumentWritten | `onAnswerWritten`, `onAnswerRevealed`, `onMessageWritten`, `onCoupleLeave`, `onUserDelete` (v1), `onGameSessionUpdate`, `onThisOrThatPartFinished`, `onWheelPartFinished`, `onHowWellPartFinished`, `onDesireSyncPartFinished`, `notifyOnDateMatch` (under `createDateMatch.ts`), `onDateReflectionWritten`, `onDateReflectionRevealed`, `onDateHistoryCreated`, `onRestoreRequested`, `onRestoreFulfilled` | Event-driven; best-effort. `onUserDelete` is intentionally v1 (gen 2 has no `auth.user().onDelete`). | -| Firestore onUpdate | `onEntitlementChanged` | Fires when `users/{uid}/entitlements/premium` changes; sends a partner-facing FCM when the user gains premium. It does NOT mirror premium state to the user root doc. | -| Auth onDelete | `onUserDelete` | Auth user deletion cascade (v1). | +| Firestore onDocumentCreated | `onAnswerWritten`, `onMessageWritten`, `notifyOnDateMatch` (under `createDateMatch.ts`), `onDateHistoryCreated`, `onDateReflectionWritten`, `onRestoreRequested` | Create-only; one delivery per new doc. | +| Firestore onDocumentUpdated | `onCoupleLeave`, `onAnswerRevealed`, `onDateReflectionRevealed`, `onRestoreFulfilled` | Update-only; fires when the matched doc changes. | +| Firestore onDocumentWritten (create+update) | `onEntitlementChanged`, `onGameSessionUpdate`, `onThisOrThatPartFinished`, `onWheelPartFinished`, `onHowWellPartFinished`, `onDesireSyncPartFinished` | Fires on both create and update; the handler distinguishes via `event.data.before`/`after` or by reading the doc state. | +| Auth onDelete | `onUserDelete` (v1) | Auth user deletion cascade. Intentionally v1 (gen 2 has no `auth.user().onDelete`). | | Pub/Sub schedule | `assignDailyQuestion`, `scheduledOutcomesReminder`, `sendDailyQuestionProactiveReminder`, `sendReengagementReminder`, `sendStreakReminder`, `unlockDueMemoryCapsules`, `sendChallengeDayReminders`, `aggregateOutcomeStats` | Cron expression; timezone is `America/Chicago` only where explicitly set (all the daily-cron senders do). | ### Per-module responsibilities