Skip to content

feat: ✨ Add request based logging and update dependencies#3

Closed
faizanazim11 wants to merge 1 commit intoexiorrealty:mainfrom
TechPrismatica:feat/request-id-based-logging
Closed

feat: ✨ Add request based logging and update dependencies#3
faizanazim11 wants to merge 1 commit intoexiorrealty:mainfrom
TechPrismatica:feat/request-id-based-logging

Conversation

@faizanazim11
Copy link
Copy Markdown
Collaborator

This pull request introduces several improvements and new features to the Jetpack microservice utility library, focusing on developer experience, code quality, and observability. The most significant changes include enhanced documentation (including a new Copilot instructions file and a changelog), upgrades to logging and response metadata with correlation ID support, improved error handling, expanded testing infrastructure, and updates to dependencies and project configuration.

Documentation & Developer Guidance:

  • Added a comprehensive .github/copilot-instructions.md file detailing code style, architecture patterns, testing strategies, file organization, and best practices for contributors and Copilot usage.
  • Introduced a CHANGELOG.md following Keep a Changelog format, documenting all notable changes and features for version history.
  • Expanded the README.md with a detailed overview, installation and usage instructions, environment variables, API reference, FastAPI integration examples, and contribution guidelines.

Logging & Observability:

  • Enhanced structured logging by integrating asgi-correlation-id for correlation ID propagation, adding a CorrelationIdFilter to log handlers, and updating log formats to include correlation IDs. [1] [2] [3] [4]
  • Updated dependencies to require asgi-correlation-id and ensured type hints and logging improvements are reflected in the configuration.

Response & Error Handling:

  • Refactored response schemas to use a new RequestMeta model with default factories for correlation ID and timestamp, ensuring every response includes traceable metadata.
  • Improved FastAPI request validation error handling to use the correct status code (422 Unprocessable Content) and provide error details in a standardized format.

Testing & CI/CD:

  • Added a new GitHub Actions workflow (.github/workflows/tests.yaml) for automated testing and coverage on pull requests, using uv for environment management.
  • Created tests/conftest.py with reusable pytest fixtures for environment isolation, temporary directories, and sample configurations, supporting comprehensive and reliable test coverage.
  • Updated development dependencies to include pytest-cov and configured coverage to omit test and script files.

Configuration & Dependency Management:

  • Improved configuration merging logic in config.py to handle None values gracefully for base paths and module names.
  • Upgraded pre-commit hooks and linting tools to latest versions for better code quality enforcement.
  • Bumped project version to 0.2.0 to reflect these significant enhancements.

These changes collectively improve Jetpack's reliability, maintainability, and developer experience, setting a strong foundation for future development.

Copilot AI review requested due to automatic review settings September 25, 2025 18:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Introduces comprehensive testing infrastructure, request-based logging with correlation IDs, enhanced response schemas, and updated dependencies for improved observability and developer experience.

  • Adds correlation ID integration for request tracing throughout the system
  • Introduces comprehensive test suite covering all modules with 100% coverage
  • Updates response schemas with default factory functions for metadata consistency

Reviewed Changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_responses.py Comprehensive test coverage for response schemas and RequestMeta with correlation ID testing
tests/test_log_config.py Test suite for logging configuration with mocking and validation scenarios
tests/test_exception_handlers.py Tests for FastAPI exception handlers and custom error handling
tests/test_errors.py Complete test coverage for GenericErrors exception class functionality
tests/test_config.py Configuration management tests with environment variable handling
tests/conftest.py Shared pytest fixtures for environment isolation and temporary directories
src/jetpack/responses.py Enhanced response schemas with correlation ID integration and factory functions
src/jetpack/log_config.py Added correlation ID filter support to logging configuration
src/jetpack/errors/exception_handlers.py Updated status code for validation errors to use correct HTTP standard
src/jetpack/config.py Improved configuration merging with None value handling
pyproject.toml Updated dependencies and coverage configuration for new testing infrastructure
README.md Complete documentation rewrite with usage examples and API reference
CHANGELOG.md Version history documentation following Keep a Changelog format
.pre-commit-config.yaml Updated pre-commit hooks to latest versions
.github/workflows/tests.yaml New GitHub Actions workflow for automated testing
.github/copilot-instructions.md Development guidelines and patterns for contributors
Comments suppressed due to low confidence (1)

tests/test_responses.py:1

  • The comment is duplicated in both the parametrize decorator and inline comment. Remove the redundant inline comment.
"""

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +134 to +136
# Should return None since the function doesn't return anything
# The function appears to have a bug - it builds handlers but doesn't return them
assert handlers is None
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The get_exception_handlers function builds a handlers dictionary but doesn't return it, making it unusable. The function should return the handlers dictionary at the end.

Copilot uses AI. Check for mistakes.
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