Feature/smart engine - #769
Open
jdelagarzaf wants to merge 96 commits into
Open
Conversation
Debug 503 responses from /up health check - log the actual exception class and message to identify what's failing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Same fix applied in production.rb — use credentials.dig(:staging, :host) instead of credentials.dig(:staging)[:host] which crashes when the staging credentials section doesn't exist. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- HealthController: inherit from ActionController::Base to skip authenticate_user! and Pundit — health checks must work without auth - Move Rack::Attack health-check safelist to rack_attack.rb initializer - Replace `defined?(Rake)` guard with `SECRET_KEY_BASE` build check - Fix shared mutable redis_config hash in sidekiq.rb (use method) - Puma: default to 0 workers in development to avoid forking issues - Dockerfile: add comment noting x86_64-specific jemalloc path - Fix asset_host: use string instead of hash in production.rb/staging.rb - Remove unused sentence-transformers from embedding-service requirements - Add trailing newline to .gitignore - Add request spec for health check endpoint Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
HealthController intentionally inherits from ActionController::Base to bypass Devise authentication for Kamal health checks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…iving-connection into feature/smart-engine
aliciapaz
approved these changes
Jul 22, 2026
Collaborator
There was a problem hiding this comment.
Add .compound-engineering to gitignore. Only keep docs or plans when relevant
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
Nonprofits on the platform are hard to discover for users who don't know what they're looking for. This PR introduces Smart Match — an AI-powered quiz that takes a user through 8–9 questions about their needs, interests, and location, then returns the 3 nonprofit organizations that best fit their profile.
Matching is driven by vector embeddings (semantic similarity via a Python microservice running BAAI/bge-large-en-v1.5) combined with attribute scoring (cause alignment, beneficiary match, geographic distance) so results are meaningful rather than just keyword-based.
What changed
Quiz wizard
3 user type flows (service seeker, volunteer, donor) with 8–9 steps each, session-based state, back navigation with pre-selection, animated progress bar, and mobile-responsive layout
Stimulus controller handles card selection, checkbox toggling, accordion expand/collapse, and Next button validation
Matching engine
SmartMatch::EmbeddingClient — HTTP client to the Python embedding service with retry and EmbeddingUnavailableError
SmartMatch::SimilarityQuery — PostGIS nearest-neighbor search with automatic radius expansion (5 → 10 → 25 → 50 mi → state-wide fallback)
SmartMatch::Scorer — composite ranking: 70% semantic similarity + 20% attribute bonus + 10% distance
SmartMatch::SubmissionProcessor — orchestrates the full quiz → embedding → match → persist pipeline
Models & jobs
QuizSubmission, OrganizationMatch, OrganizationEmbedding, UserIntent
EmbedOrganizationJob and EmbedAllOrganizationsJob keep org embeddings current; rake smart_match:embed_all backfills existing orgs
How to test it
References
ClickUp ticket