Work / Chitragupt / Wiki / Decisions
2026-07-06-rename-on-consult-request-written-trigger
Decisioncanonicalverified 2026-07-06
DECISION.2026-07-06.RENAME-ON-CONSULT-REQUEST-WRITTEN-TRIGGERRename onConsultRequestPaidWritten → onConsultRequestWritten
Decision
Rename the Firestore trigger that mints an engagement when a consult request flips to paid_pending_assignment. Old export: onConsultRequestPaidWritten (file on-consult-request-paid-written.ts). New export: onConsultRequestWritten (file on-consult-request-written.ts).
Why
Same failure as 2026-07-05-rename-on-consult-request-paid-trigger — prod still holds an HTTPS callable at the poisoned name, so CI is red on main with:
[onConsultRequestPaidWritten(asia-south1)] Changing from an HTTPS function to a background triggered function is not allowed.
The previous rename to onConsultRequestPaidWritten was defeated the same way the one before it was — the intermediate deploy that would have converted the trigger type never landed cleanly, so the name stayed on prod as HTTPS. Firebase does not allow swapping a function's trigger type in place, so the only fix is another rename to an unused name; firebase deploy --force drops the orphan HTTPS onConsultRequestPaidWritten in the same run that lands the fresh trigger.
The new name is shorter and matches the collection it listens to (consult_requests/{consultId}), following the same on<Doc>Written pattern as onLedgerEntryWritten, onAnalyzeOutputWritten, onCaRatingWritten, onQuickCheckAnswerWritten.
Impact
apps/functions/src/triggers/firestore/on-consult-request-paid-written.ts→ renamed toon-consult-request-written.ts; export renamed accordingly.apps/functions/src/index.tsre-export updated.packages/shared/src/schemas/consult-request.tsdoc comment updated.- No callable-contract or Firestore-schema change — the trigger listens to the same
users/{uid}/consult_requests/{consultId}path. - Affects the pillar-marketplace Get-a-CA flow. Idempotency is preserved (still keyed on
consult_${consultId}). - If this rename fails the same way, next attempt should add a pre-deploy
firebase functions:delete onConsultRequestWritten --region asia-south1 --force || trueinapps/functions/scripts/deploy.mjsto guarantee the orphan is dropped before deploy — one-shot cleanup, remove after next green.
Status
Active.
Sources
- CI failure on Firebase deploy step — same trigger-type-change error as 2026-07-05-rename-on-consult-request-paid-trigger.
apps/functions/src/triggers/firestore/on-consult-request-written.ts— trigger implementation.
Every project of mine is written down like this.
Read the résumé