Skip to content

Upgrade dependencies and improve request handling#59

Merged
bybatkhuu merged 5 commits into
mainfrom
dev
Jul 4, 2026
Merged

Upgrade dependencies and improve request handling#59
bybatkhuu merged 5 commits into
mainfrom
dev

Conversation

@bybatkhuu

Copy link
Copy Markdown
Owner

This pull request primarily updates dependency versions in CI/CD workflows and improves the robustness of the beans_logging_fastapi middleware by making header and attribute access safer. The most significant changes are grouped below.

CI/CD Workflow and Linting Updates:

  • Updated all usages of actions/checkout in GitHub Actions workflows from version v6 to v7 for 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]
  • Upgraded markdownlint-cli in .pre-commit-config.yaml from v0.48.0 to v0.49.0 for markdown linting improvements.

Middleware Robustness and Logging Improvements:

  • Refactored attribute and dictionary access in beans_logging_fastapi/middlewares.py to use .get() with default values, preventing potential KeyError and 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]
  • Changed request.state.client_ip to request.state.client_host for consistency in naming.

Submodule Update:

  • Updated the beans_logging submodule to the latest commit, pulling in any upstream changes.

dependabot Bot and others added 5 commits June 18, 2026 12:13
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
@bybatkhuu bybatkhuu self-assigned this Jul 4, 2026
Copilot AI review requested due to automatic review settings July 4, 2026 08:56
@bybatkhuu bybatkhuu added the bugfix [🐛 Fixes] PATCH version label Jul 4, 2026
@bybatkhuu bybatkhuu merged commit c890d72 into main Jul 4, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-logging in requirements.txt, markdownlint-cli in pre-commit).
  • Refactored middleware metadata access (e.g., request_id, http_version, response_time, status_code) to use safer .get() patterns and renamed request.state.client_ip to client_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")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix [🐛 Fixes] PATCH version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants