Conversation
Bumps [https://github.com/igorshubovych/markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli) from v0.48.0 to 0.49.0. - [Release notes](https://github.com/igorshubovych/markdownlint-cli/releases) - [Commits](igorshubovych/markdownlint-cli@v0.48.0...v0.49.0) --- updated-dependencies: - dependency-name: https://github.com/igorshubovych/markdownlint-cli dependency-version: 0.49.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
…-/github.com/igorshubovych/markdownlint-cli-0.49.0 build(deps): bump https://github.com/igorshubovych/markdownlint-cli from v0.48.0 to 0.49.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
…ctions/checkout-7 build(deps): bump actions/checkout from 6 to 7
There was a problem hiding this comment.
Pull request overview
This PR updates CI/lint dependencies and refactors beans_logging_fastapi middleware code to use safer access patterns for request/response metadata (headers, scope, and http_info fields), aiming to reduce runtime errors and improve robustness.
Changes:
- Updated GitHub Actions workflows to use
actions/checkout@v7. - Bumped dependency versions (
beans-logginginrequirements.txt,markdownlint-cliin pre-commit). - Refactored middleware metadata access (e.g.,
request_id,http_version,response_time,status_code) to use safer.get()patterns and renamedrequest.state.client_iptoclient_host.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/beans_logging_fastapi/middlewares.py |
Safer access to request/response metadata; logging/access-log robustness tweaks; renames request state attribute for client address. |
requirements.txt |
Bumps beans-logging minimum version. |
.pre-commit-config.yaml |
Updates markdownlint-cli hook version. |
.github/workflows/publish-docs.yml |
Updates actions/checkout major version. |
.github/workflows/3.update-changelog.yml |
Updates actions/checkout major version. |
.github/workflows/2.build-publish.yml |
Updates actions/checkout major version (including a commented example). |
.github/workflows/1.bump-version.yml |
Updates actions/checkout major version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
43
to
+47
| elif "X-Correlation-ID" in request.headers: | ||
| _http_info["request_id"] = request.headers.get("X-Correlation-ID") | ||
|
|
||
| # Set request_id to request state: | ||
| request.state.request_id = _http_info["request_id"] | ||
| request.state.request_id = _http_info.get("request_id") |
| _http_info["user_id"] = str(request.state.user_id) | ||
|
|
||
| _logger = logger.bind(request_id=_http_info["request_id"]) | ||
| _logger = logger.bind(request_id=_http_info.get("request_id")) |
| # Set http info to request state: | ||
| request.state.logger = _logger | ||
| request.state.client_ip = _http_info.get("client_host", "") | ||
| request.state.client_host = _http_info.get("client_host") |
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.
This pull request primarily updates dependency versions in CI/CD workflows and improves the robustness of the
beans_logging_fastapimiddleware by making header and attribute access safer. The most significant changes are grouped below.CI/CD Workflow and Linting Updates:
actions/checkoutin GitHub Actions workflows from versionv6tov7for improved security and features in.github/workflows/1.bump-version.yml,.github/workflows/2.build-publish.yml,.github/workflows/3.update-changelog.yml, and.github/workflows/publish-docs.yml. [1] [2] [3] [4] [5]markdownlint-cliin.pre-commit-config.yamlfromv0.48.0tov0.49.0for markdown linting improvements.Middleware Robustness and Logging Improvements:
beans_logging_fastapi/middlewares.pyto use.get()with default values, preventing potentialKeyErrorand ensuring safe access to request and response metadata (e.g.,request_id,client_host,http_version,response_time,status_code). [1] [2] [3] [4] [5]request.state.client_iptorequest.state.client_hostfor consistency in naming.Submodule Update:
beans_loggingsubmodule to the latest commit, pulling in any upstream changes.