Skip to content

ACHOO-114: Daily email summaries#23

Closed
jbickar wants to merge 19 commits into2.xfrom
ACHOO-114
Closed

ACHOO-114: Daily email summaries#23
jbickar wants to merge 19 commits into2.xfrom
ACHOO-114

Conversation

@jbickar
Copy link
Contributor

@jbickar jbickar commented Nov 26, 2025

READY FOR REVIEW

DO NOT MERGE

  • I've created an integration branch, 2.x-integration, that likely will become a 3.x. This PR is for review purposes.

Summary

  • Implements a complete daily email reporting system
  • Moves basic auth credentials to environment variables

Review By (Date)

  • 12.8.2025

Criticality

  • How critical is this PR on a 1-10 scale? 7/10

Review Tasks

Setup tasks and/or behavior to test

  1. Check out this branch
  2. Set environment variables locally or ensure that they are set in Vercel:
# Email Service
RESEND_API_KEY=re_xxxxxxxxxx
FROM_EMAIL=onboarding@resend.dev  # or verified domain
ADMIN_EMAIL=your-email@stanford.edu
CRON_SECRET=your-secure-random-key

# Basic Authentication (optional - fallback for auth)
BASIC_AUTH_USERNAME=your-username
BASIC_AUTH_PASSWORD=your-password

# Existing Acquia variables remain unchanged

Local testing

npm run dev
# Navigate to: http://localhost:3000/api/test/email
# Should return JSON success response and send email
# Verify accuracy of data

Vercel testing

# Visit: https://churro-git-achoo-114-sws-developers.vercel.app/api/test/email
# Should bypass all authentication and send email successfully
# Verify accuracy of data

Note that onboarding@resend.dev will only send emails to jbickar@stanford.edu with the API key that's configured in Vercel. I put in a SNOW ticket for DKIM validation for resend but haven't heard back yet.

Front End Validation

  • Is the markup using the appropriate semantic tags and passes HTML validation?
  • Cross-browser testing has been performed?
  • Automated accessibility scans performed?
  • Manual accessibility tests performed?
  • Design is approved by @ user?

Backend / Functional Validation

Code

  • Are the naming conventions following our standards?
  • Does the code have sufficient inline comments?
  • Is there anything in this code that would be hidden or hard to discover through the UI?
  • Are there any code smells?
  • Are tests provided? eg (unit, behat, or codeception)

Code security

General

  • Is there anything included in this PR that is not related to the problem it is trying to solve?
  • Is the approach to the problem appropriate?

Affected Projects or Products

  • Does this PR impact any particular projects, products, or modules?

Associated Issues and/or People

  • JIRA ticket(s): ACHOO-114

Resources

Copilot AI review requested due to automatic review settings November 26, 2025 21:58
@vercel
Copy link

vercel bot commented Nov 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
churro Ready Ready Preview, Comment Dec 15, 2025 5:21pm

Copy link
Contributor

Copilot AI left a comment

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 implements a comprehensive daily email reporting system for CHURRO that sends automated usage summaries via Resend.com, and moves basic authentication credentials from hardcoded values to configurable environment variables for improved security and flexibility.

Key Changes

  • Added daily email summary functionality with Resend integration for automated usage reporting
  • Moved basic HTTP authentication credentials to environment variables (BASIC_AUTH_USERNAME and BASIC_AUTH_PASSWORD)
  • Created cron job configuration in Vercel to run daily email summaries at 9 AM UTC

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
vercel.json Adds Vercel cron configuration to trigger daily email summaries
package.json Adds resend@6.5.2 dependency for email functionality
package-lock.json Lock file updates for new resend dependency and its sub-dependencies
middleware.ts Refactors basic auth to use environment variables and adds validation for missing credentials
lib/email-service.ts Implements core email generation logic with Acquia API integration and HTML email templates
lib/acquia-api.ts Enhances error logging for API calls with detailed error information
docs/EMAIL-CONFIGURATION.md Provides comprehensive documentation for email service setup and configuration
app/api/test/email/route.ts Creates test endpoint for manual email functionality testing
app/api/email/daily-summary/route.ts Implements cron endpoint with CRON_SECRET authentication for automated daily emails
.github/copilot-instructions.md Updates project documentation with email reporting patterns and configuration guidelines

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

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 9 out of 10 changed files in this pull request and generated 12 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jbickar jbickar requested a review from Copilot November 26, 2025 23:46
@jbickar jbickar added the ai-generated Code in this PR was partially or wholly generated by AI label Nov 26, 2025
Copy link
Contributor

Copilot AI left a comment

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 11 out of 12 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jbickar
Copy link
Contributor Author

jbickar commented Jan 13, 2026

Implemented in 3.x

@jbickar jbickar closed this Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Code in this PR was partially or wholly generated by AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant