Add feedback audit script and unit tests for feedback persistence#8
Open
ForisKuang wants to merge 2 commits intocBioPortal:v0.8.3-rc1-custom-v7from
Open
Conversation
Standalone MongoDB audit script (scripts/audit-feedback.js) to verify feedback write consistency — detects dropped or malformed feedback by querying messages and product feedback collections directly. Unit tests for message feedback (thumbs up/down store, clear, update) and product feedback (creation, validation, deduplication) using MongoMemoryServer. No existing LibreChat files modified.
Comment on lines
+39
to
+40
| mongoose.models.ProductFeedback || | ||
| mongoose.model('ProductFeedback', productFeedbackSchema); |
Check failure
Code scanning / ESLint
Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error test
Author
|
cc: @inodb . THis is unit test for the feedback persistance issue. This is in response to you wanting to know if it is consistently persisting feedback to mongodb or if they are being dropped silently. |
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.
Summary
▎ - Standalone MongoDB audit script (scripts/audit-feedback.js) — queries messages and product feedback collections to detect dropped/malformed feedback. Supports --since/--until
date filters, --json output, exits code 2 on anomalies.
▎ - Message feedback unit tests (api/models/tests/messageFeedback.spec.js) — 7 tests covering thumbs up/down store, clear, update, tag, text, non-existent message.
▎ - Product feedback unit tests (api/models/tests/productFeedback.spec.js) — 18 tests covering creation, validation, required fields, enum values, deduplication, optional
fields.
▎ All new files — zero modifications to existing LibreChat code to avoid upstream merge conflicts.
Motivation
▎ Verify MongoDB writes for feedback are consistent with feedback interactions, to detect if feedback is being silently dropped.
Test plan
▎ - cd api && npx jest models/tests/messageFeedback.spec.js — 7/7 passing
▎ - cd api && npx jest models/tests/productFeedback.spec.js — 18/18 passing
▎ - Run node scripts/audit-feedback.js --uri <mongo_uri> against a real database