[Contracts] Add stale contract human follow-up notification - #14505
[Contracts] Add stale contract human follow-up notification#14505mattsoh wants to merge 15 commits into
Conversation
Removed fallback instructions for uploading receipts.
There was a problem hiding this comment.
Pull request overview
This PR adds an automated “stale contract” reminder for Fiscal Sponsorship contracts that remain in the sent state, intended to prompt HCB Ops follow-up after ~1 month, and also updates the receipt-upload email to include a fallback raw link.
Changes:
- Add
Contract::OperationsUpdateJoband a newContract::PartyMailer#operations_updateaction/subject for HCB-party notifications. - Schedule the operations update 1 month after a Fiscal Sponsorship contract transitions to
sent, plus a MaintenanceTasks backfill for existingsentcontracts. - Add a fallback “copy/paste link” block to the receipt attachment email partial.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/views/canonical_pending_transaction_mailer/_attach_receipt.html.erb | Adds a fallback receipt-upload link under the button. |
| app/tasks/maintenance/schedule_contract_operations_updates_task.rb | Backfills scheduling for existing sent Fiscal Sponsorship contracts. |
| app/models/contract/party.rb | Adds a new email subject helper for operations update notifications. |
| app/models/contract/fiscal_sponsorship.rb | Introduces OPERATIONS_UPDATE_AFTER and schedules the operations update on transition to sent. |
| app/mailers/contract/party_mailer.rb | Adds a new operations_update mailer action selecting an operations_update_* template. |
| app/jobs/contract/operations_update_job.rb | Enqueues the operations update notification when the contract is still sent. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (2)
app/jobs/contract/operations_update_job.rb:18
- This introduces a new delayed notification path (job + scheduling callback) but there’s no spec coverage ensuring (1) the job only emails when the contract is still
sent?, and (2) sending a fiscal sponsorship contract enqueues the operations update job with the intended delay. Adding an RSpec example aroundContract::OperationsUpdateJob(and/or theContract::FiscalSponsorshipcallback) would help prevent regressions and accidental spam.
def perform(contract)
return unless contract.sent?
party = contract.party(:hcb)
return if party.nil?
Contract::PartyMailer.with(party:).operations_update.deliver_later
end
app/mailers/contract/party_mailer.rb:31
operations_updatesetstemplate_name: "operations_update_#{@party.role}", but there are no corresponding view templates underapp/views/contract/party_mailer/(unlike the existingremind_*templates). This will raiseActionView::MissingTemplatewhen the job tries to send the email. Add at leastoperations_update_hcb.html.erb(since the job targetsparty(:hcb)) or adjust the mailer to use an existing template naming scheme that’s actually present.
def operations_update
mail to: @party.email,
subject: @party.operations_update_email_subject,
template_name: "operations_update_#{@party.role}"
end
…tps://github.com/mattsoh/hcb into mattsoh-stale-application-onboarder-notification
…tps://github.com/mattsoh/hcb into mattsoh-stale-application-onboarder-notification
There was a problem hiding this comment.
I would actually separate this from the concept of a contract party. I would have this live in the contract itself. This is because contract parties are intended to be generic and work for all types of parties, including the organizer, co-signer, and HCB operations. Instead, what we're looking for here is stale contracts, and I would say that it's more of a contract-level concept rather than per party. My recommendation is that you move this to the contract mailer.
Summary of the problem
Sometimes contracts get forgotten (maybe by the ops team or by the contract signees)
Describe your changes
Send a reminder after 1 month to HCB Ops to see if a follow up is required.