You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
packages/agents-core/vitest.config.ts has no explicit LOG_LEVEL override
This change applies the 'silent' behavior globally for any code using PinoLogger when ENVIRONMENT=test
Recommendation: Consider standardizing test logging configuration across all vitest configs rather than implicit environment-based logic. This would make the behavior more explicit and easier to debug.
Missing Test Coverage (High Priority)
This logging behavior change lacks test coverage:
// Suggested test in packages/agents-core/src/__tests__/utils/logger.test.tsdescribe('PinoLogger environment-based log levels',()=>{it('should set silent level when ENVIRONMENT=test and no LOG_LEVEL override',()=>{constoriginalEnv=process.env.ENVIRONMENT;deleteprocess.env.LOG_LEVEL;process.env.ENVIRONMENT='test';constlogger=newPinoLogger('test');expect(logger.getPinoInstance().level).toBe('silent');process.env.ENVIRONMENT=originalEnv;});it('should respect LOG_LEVEL override even in test environment',()=>{constoriginalValues={env: process.env.ENVIRONMENT,level: process.env.LOG_LEVEL};process.env.ENVIRONMENT='test';process.env.LOG_LEVEL='debug';constlogger=newPinoLogger('test');expect(logger.getPinoInstance().level).toBe('debug');Object.assign(process.env,originalValues);});});
🔍 Technical Implementation
Logic Correctness
The ternary logic is correct but could be more readable:
// Current (works but dense)
level: process.env.LOG_LEVEL||(process.env.ENVIRONMENT==='test' ? 'silent' : 'info')// More explicit alternative
level: process.env.LOG_LEVEL||getDefaultLogLevel()functiongetDefaultLogLevel(): string{returnprocess.env.ENVIRONMENT==='test' ? 'silent' : 'info';}
Environment Value Validation
The code doesn't validate the ENVIRONMENT value. While this works, it's less robust than using the validated env from packages/agents-core/src/env.ts which defines the schema:
Documentation: The change lacks a comment explaining why test environments get silent logging
Type Safety: Direct process.env access vs using typed env validation
🎯 Recommendations
For this PR:
Add tests for the new environment-based logic (High Priority)
Add inline comment explaining the test environment behavior
Follow-up considerations:
Standardize vitest configs to use consistent logging approaches
Consider using typed env imports for better type safety
Document logging strategy in development guidelines
✅ Approval Status
This change is functionally correct and addresses a legitimate issue. The implementation is simple and follows existing patterns. However, the missing test coverage should be addressed before merging.
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
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.
No description provided.