Skip to content

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
ForisKuang:feature/feedback-audit-and-tests
Open

Add feedback audit script and unit tests for feedback persistence#8
ForisKuang wants to merge 2 commits intocBioPortal:v0.8.3-rc1-custom-v7from
ForisKuang:feature/feedback-audit-and-tests

Conversation

@ForisKuang
Copy link
Copy Markdown

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

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

Delete ⏎·····
@ForisKuang ForisKuang changed the base branch from main to v0.8.3-rc1-custom-v7 March 31, 2026 17:49
@ForisKuang
Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants