Skip to content

[Contracts] Add stale contract human follow-up notification - #14505

Open
mattsoh wants to merge 15 commits into
hackclub:mainfrom
mattsoh:mattsoh-stale-application-onboarder-notification
Open

[Contracts] Add stale contract human follow-up notification#14505
mattsoh wants to merge 15 commits into
hackclub:mainfrom
mattsoh:mattsoh-stale-application-onboarder-notification

Conversation

@mattsoh

@mattsoh mattsoh commented Aug 5, 2026

Copy link
Copy Markdown
Member

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::OperationsUpdateJob and a new Contract::PartyMailer#operations_update action/subject for HCB-party notifications.
  • Schedule the operations update 1 month after a Fiscal Sponsorship contract transitions to sent, plus a MaintenanceTasks backfill for existing sent contracts.
  • 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.

Comment thread app/tasks/maintenance/schedule_contract_operations_updates_task.rb
Comment thread app/jobs/contract/human_follow_up_job.rb
Comment thread app/mailers/contract/party_mailer.rb Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 around Contract::OperationsUpdateJob (and/or the Contract::FiscalSponsorship callback) 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_update sets template_name: "operations_update_#{@party.role}", but there are no corresponding view templates under app/views/contract/party_mailer/ (unlike the existing remind_* templates). This will raise ActionView::MissingTemplate when the job tries to send the email. Add at least operations_update_hcb.html.erb (since the job targets party(: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

@mattsoh
mattsoh requested a review from Copilot August 5, 2026 23:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mattsoh
mattsoh requested a review from Copilot August 5, 2026 23:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread app/tasks/maintenance/schedule_contract_human_follow_ups_task.rb

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread app/jobs/contract/human_follow_up_job.rb
@mattsoh mattsoh changed the title [Contracts] Add stale application onboarder notification [Contracts] Add stale contract onboarder notification Aug 8, 2026
@mattsoh mattsoh changed the title [Contracts] Add stale contract onboarder notification [Contracts] Add stale contract human follow-up notification Aug 8, 2026
@mattsoh
mattsoh requested a review from garyhtou August 8, 2026 02:03
@mattsoh
mattsoh requested a balanced review from Copilot August 8, 2026 02:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants