Repository navigation
Conversation
Rebuilt on current main after the frontend/ML monorepo merge — the original commits were based on the pre-merge root-level layout. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
✅ Deploy Preview for p-ickup ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The matching service now runs as its own AWS Lambda (Function URL) instead of behind the aspc-website-v2 backend proxy, so .env.example points ALGORITHM_SERVICE_URL/ALGORITHM_SERVICE_API_KEY at it. /run now sends subsidized_periods, built from SERVICE_PERIODS by the new getSubsidizedPeriodRanges() helper, so the matcher subsidizes exactly the dates students are shown instead of keeping its own hardcoded list (which had drifted: it was missing Thanksgiving 2026 entirely). Also strips a trailing slash from ALGORITHM_SERVICE_URL (Function URLs are shown with one, which made the request path //run) and only passes string error details through to the UI (FastAPI 422s are lists). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Adds the admin UI for running the ride-matching algorithm. The algorithm runs as its own AWS Lambda function (Function URL), separate from this Netlify app. This PR only adds the frontend page and the server-side routes that call it; the Lambda's code and deploy steps live outside this repo.
This replaces the earlier plan of running the service behind the aspc-website-v2 backend (aspc/aspc-website-v2#254, now closed).
Describe your changes
frontend/src/app/admin/matching/page.tsx: new/admin/matchingroute, behind the existing admin auth layout.frontend/src/components/admin/MatchingAlgorithm.tsx: "Run Matching" UI. Pulls riders from the database and commits the result through the Lambda's/runendpoint, which writes groups and matches to Supabase and consumes vouchers. Shows a confirmation dialog first, since a run can't be undone or previewed from here.frontend/src/app/api/admin/matching/run/route.tsand.../status/route.ts: server-only routes. The browser never talks to the Lambda directly; these callALGORITHM_SERVICE_URLwithALGORITHM_SERVICE_API_KEY./runsendssubsidized_periods, built fromSERVICE_PERIODSby the newgetSubsidizedPeriodRanges()inservicePeriodHelpers.ts. The matcher subsidizes exactly the dates students see on the site, instead of keeping its own hardcoded list, which had drifted and was missing Thanksgiving 2026. Changing break dates now only means editingservicePeriods.ts.frontend/src/components/admin/AdminDashboard.tsx: a "Run Matching Algorithm" button next to "View & Manage Groups".frontend/.env.example: documents the two server-only env vars.Before this works in prod
ALGORITHM_SERVICE_URL: the Lambda Function URLALGORITHM_SERVICE_API_KEY: the same value as the Lambda'sSERVICE_API_KEYUntil then,
/admin/matchingshows a "not configured" banner and nothing runs.Testing
tsc --noEmit,eslint, andprettier --checkare clean on every changed file.getSubsidizedPeriodRanges(): it matchesSERVICE_PERIODS, and every range boundary agrees withisDateCovered.subsidized_periodsis rejected with 422./runagainst the deployed Lambda and Supabase.🤖 Generated with Claude Code