-
Notifications
You must be signed in to change notification settings - Fork 0
feat(contracts): add Logger.child() and fix AssertionError category #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: p3-6/config/env-validation
Are you sure you want to change the base?
Conversation
8d043eb to
62826b8
Compare
a8afb46 to
0f0a5d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62826b82f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
0f0a5d8 to
809e837
Compare
62826b8 to
71b347d
Compare
Greptile Summary
|
| Filename | Overview |
|---|---|
| packages/contracts/src/handler.ts | Adds child(context) method to Logger interface with comprehensive TSDoc explaining context merging and composability |
| packages/contracts/src/errors.ts | Changes AssertionError category from 'validation' to 'internal' with detailed rationale for invariant violation handling |
Confidence score: 5/5
- This PR is safe to merge with minimal risk as it primarily adds new functionality and corrects error categorization
- Score reflects well-documented changes with comprehensive test coverage and clear adherence to project architecture patterns
- No files require special attention as the changes are straightforward interface additions and error category corrections
Sequence Diagram
sequenceDiagram
participant User
participant Logger
participant ChildLogger
participant AssertionHandler
participant ErrorSystem
User->>Logger: "child({ requestId: 'abc123' })"
Logger->>ChildLogger: "create with inherited context"
Logger-->>User: "return ChildLogger"
User->>ChildLogger: "info('Processing request')"
ChildLogger->>ChildLogger: "merge parent + child context"
ChildLogger->>ChildLogger: "log with full context"
User->>ChildLogger: "child({ operation: 'create' })"
ChildLogger->>ChildLogger: "create nested child"
ChildLogger-->>User: "return nested ChildLogger"
User->>AssertionHandler: "invariant violation detected"
AssertionHandler->>ErrorSystem: "new AssertionError({ message: 'Invariant violated' })"
ErrorSystem->>ErrorSystem: "set category = 'internal'"
ErrorSystem->>ErrorSystem: "map to HTTP 500/exit code 8"
ErrorSystem-->>User: "return AssertionError"
809e837 to
213ff0b
Compare
71b347d to
3820a22
Compare
|
Aligned contracts Logger interface with logging by adding trace/fatal and updating no-op/test loggers to match. |
3820a22 to
255548c
Compare
213ff0b to
fb1e133
Compare
|
Resubmitted after restack. Logger.child compatibility is handled upstack in PR #73 (logging adds child to LoggerInstance), so no additional changes were needed in this contracts PR. |
Adds child() method to LoggerInstance that: - Merges parent context with child bindings (child takes precedence) - Returns new logger instance with combined context - Preserves level, redaction, sinks from parent - Supports nested children (composable) Fixes P1 review feedback from PR #69 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add child(context) method to Logger interface for context inheritance - Update noopLogger to include child() method - Change AssertionError category from 'validation' to 'internal' - Add TSDoc explaining category rationale (invariant violations, not user input) - Add 8 new tests for Logger.child and AssertionError behavior Closes #53, #54 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
255548c to
85956cf
Compare
|
Resubmitted after downstack updates; no new feedback found on this PR. |

Closes #53, #54
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com