add Recommendation Feedback Persistence with Supabase Storage#34
Merged
Adilislam0 merged 3 commits intoJun 22, 2026
Merged
Conversation
cb53017 to
d66adb6
Compare
d66adb6 to
2e9e538
Compare
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.
Overview
This PR completes the recommendation feedback persistence workflow for the LPI Recommendation Engine. Users can now record whether a recommendation was accepted or dismissed, and the feedback is securely stored in Supabase for future analysis and recommendation refinement.
The implementation introduces persistent feedback storage, request validation, authenticated ownership checks, database migration support, and test stability improvements while preserving the existing recommendation generation pipeline.
What was implemented
1. Recommendation Feedback Persistence
Implemented persistent storage for recommendation feedback instead of returning temporary in-memory responses.
Each feedback record stores:
accepted/dismissed)2. Feedback API Endpoint
Completed the feedback endpoint:
The endpoint now:
3. Database Integration
Added Aryan's Supabase migration to create the
recommendation_feedbacktable.The persistence layer now inserts feedback directly into the database using the existing Supabase client.
4. Store Layer
Added a new storage helper:
Responsibilities:
5. Data Models
Extended the models with support for recommendation feedback.
Added:
These separate request payload validation from the persisted database object.
6. Recommendation Engine Integration
Updated the recommendation pipeline to support persistent feedback without affecting recommendation generation.
Recommendation IDs are now treated as first-class identifiers that can later be used for:
7. Authentication & Authorization
Implemented ownership validation before storing feedback.
Only the authenticated owner of a recommendation can submit feedback.
Requests from other users correctly return:
8. Database Migration
Added migration:
which creates the new feedback table required by the persistence layer.
9. Test Stability Improvement
Pytest execution was intermittently failing because the in-memory rate limiter accumulated request counts across tests.
Instead of modifying the rate limiter logic, the test environment now clears the in-memory rate limiter state before and after each test through the shared pytest fixtures.
This preserves production behavior while ensuring deterministic test execution.
Files Modified
src/lpi/models.pysrc/lpi/store.pysrc/lpi/routers/recommendations.pysrc/lpi/recommendation_engine.pytests/conftest.pysupabase/migrations/20260621000000_create_recommendation_feedback.sqlTesting
Executed the full project test suite.
Result:
Additionally verified:
Outcome
This PR completes the persistence layer for recommendation feedback, enabling recommendation decisions to be recorded permanently in Supabase while maintaining compatibility with the existing recommendation engine and ensuring full test suite stability.