docs(manual): batch 6 review — handler types table was imprecise (mixed onCreate/onWritten/onUpdate)

The Cloud Functions Handler types table had a single row labelled
'Firestore onCreate / onDocumentWritten' that mixed three distinct
trigger types:
  - onDocumentCreated: onAnswerWritten, onMessageWritten,
    notifyOnDateMatch, onDateHistoryCreated, onDateReflectionWritten,
    onRestoreRequested
  - onDocumentUpdated: onCoupleLeave, onAnswerRevealed,
    onDateReflectionRevealed, onRestoreFulfilled
  - onDocumentWritten (fires on both create and update):
    onEntitlementChanged, onGameSessionUpdate, onThisOrThatPartFinished,
    onWheelPartFinished, onHowWellPartFinished, onDesireSyncPartFinished

The old row put onEntitlementChanged in a separate 'Firestore onUpdate'
row, but the source actually uses onDocumentWritten (which fires on
both create and update). Replaced the two rows with three precise
rows - one per trigger type - and listed the actual handler in each.

Also moved onUserDelete from the Firestore row to the new
'Auth onDelete' row (which was already there but unused) so each
handler appears in exactly one place.

Other Batch 6 claims verified clean:
- Every export name in the table (createInviteCallable,
  acceptInviteCallable, syncEntitlement, submitOutcomeCallable,
  leaveCoupleCallable, checkDeviceIntegrity,
  assignDailyQuestionCallable, wrapReleaseKeyCallable,
  sendGentleReminderCallable, sendThinkingOfYouCallable,
  assignDailyQuestion, scheduledOutcomesReminder,
  sendDailyQuestionProactiveReminder, sendReengagementReminder,
  sendStreakReminder, unlockDueMemoryCapsules,
  sendChallengeDayReminders, aggregateOutcomeStats) exists in the
  source and is re-exported from functions/src/index.ts.
- revenueCatWebhook is in source but its export is commented out in
  index.ts (the not-deployed note is correct).
This commit is contained in:
null 2026-07-08 23:25:34 -05:00
parent 5f7c785f5c
commit aa35614840
1 changed files with 4 additions and 3 deletions

View File

@ -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 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`. | | 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 onDocumentCreated | `onAnswerWritten`, `onMessageWritten`, `notifyOnDateMatch` (under `createDateMatch.ts`), `onDateHistoryCreated`, `onDateReflectionWritten`, `onRestoreRequested` | Create-only; one delivery per new doc. |
| 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. | | Firestore onDocumentUpdated | `onCoupleLeave`, `onAnswerRevealed`, `onDateReflectionRevealed`, `onRestoreFulfilled` | Update-only; fires when the matched doc changes. |
| Auth onDelete | `onUserDelete` | Auth user deletion cascade (v1). | | 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). | | 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 ### Per-module responsibilities