feat(backend): implement structured Winston logging and align test suite#54
Open
Aayuiiitmg wants to merge 2 commits into
Open
feat(backend): implement structured Winston logging and align test suite#54Aayuiiitmg wants to merge 2 commits into
Aayuiiitmg wants to merge 2 commits into
Conversation
Collaborator
|
@Aayuiiitmg add the issue number. |
Collaborator
|
@Aayuiiitmg, update the PR description with correct issue number present in the PR template. I will review and can assign another issue after this. |
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.
Description
Implemented structured, secure logging using the Winston logging library and resolved test suite integration issues.
Key Changes:
warnin production,debugin development), and colorized console output in development.db.js,server.js, andaiController.jsto eliminate direct, un-bracketedconsole.logandconsole.errorcalls, ensuring that sensitive internals and PII are protected in production.tests/lifecycle.test.jsStep 4 to match the actual controller database query sequence by mocking the intermediaterequestDataQuerylookup.tests/lifecycle.test.jsStep 5 to query a valid UUIDv4 path to comply with route parameter validation middleware, and added proper mocking for thesupabaseAdminclient.Type of Change
Testing
How did you test this?
Both
auth.test.jsandlifecycle.test.jswere run locally using Jest with simulated Redis and PostgreSQL environments, and all 10 tests passed successfully.Checklist
Screenshots (if UI changes)
No UI changes.
Related Issue
Fixes backend console data leak issue / structured logging request. Assigned under GSSoC'26.
🏷️ Request to Maintainers: Difficulty Labeling (Intermediate / Advanced)
Dear Maintainers,
Could you please label this PR as Intermediate or Advanced?
Justification for Complexity Labeling:
warnlevel in production for security,debugin development for trace visibility), standardizes JSON outputs, and sets up robust log file rotation (maxsize: 5MB,maxFiles: 5) to prevent disk exhaustion.console.logstatements in controllers, DB configs, and startup hooks that were leaking sensitive system internals, query blueprints, and user metadata.developmentchecks. This prevents active Jest query queues from being hijacked during unit tests.supabaseAdminclient dynamically within Jest's module scope.