From 9f18443a1cbda136e46ef356d9a2f0698613974c Mon Sep 17 00:00:00 2001 From: Dmitrii Safronov Date: Wed, 6 May 2026 04:28:57 +0400 Subject: [PATCH 1/7] ci: Remove test-coverage target Signed-off-by: Dmitrii Safronov --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5ff3661..a431f51 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ PYTEST_CMD = uv run python -m pytest -v COVERAGE_OPTS = --cov --cov-report=term-missing --cov-report=html # Phony targets -.PHONY: all clean dead-code format help install lint test test-coverage +.PHONY: all clean dead-code format help install lint test # Default target help: ## Show this help message From 462ca94c9788386b0198061583a4aa934c3ec15d Mon Sep 17 00:00:00 2001 From: Dmitrii Safronov Date: Wed, 6 May 2026 04:30:20 +0400 Subject: [PATCH 2/7] ci: Update Linting Tools Configuration Modify linting configuration to check only src directory and update exclude paths for mypy, flake8 and bandit tools Signed-off-by: Dmitrii Safronov --- Makefile | 2 +- pyproject.toml | 25 ++++--------------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index a431f51..880aa4d 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ format: ## Format code lint: ## Run linting tools @echo "Running linting tools..." - uv run black --check . && uv run isort --check-only . && uv run flake8 . && uv run mypy . && uv run bandit -r -c pyproject.toml . + uv run black --check . && uv run isort --check-only . && uv run flake8 . && uv run mypy && uv run bandit -c pyproject.toml -r src/ dead-code: ## Check for dead code using vulture @echo "Checking for dead code..." diff --git a/pyproject.toml b/pyproject.toml index 1f9f7e7..b9a5f7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,32 +54,18 @@ dev = [ [tool.isort] profile = "black" -line_length = 88 -multi_line_output = 3 [tool.black] line-length = 88 include = "\\.pyi?$" -extend-exclude = """ -/( - \\.eggs - | \\.git - | \\.hg - | \\.mypy_cache - | \\.tox - | \\.venv - | build - | dist -)/ -""" [tool.flake8] max-line-length = 88 extend-ignore = [ "E203", "W503" ] -exclude = [ ".venv", "__pycache__", ".git", "htmlcov" ] +exclude = [ ".venv" ] [tool.mypy] -exclude = "tests/" +files = [ "src" ] warn_return_any = true warn_unused_configs = true disallow_untyped_defs = true @@ -93,9 +79,6 @@ warn_no_return = true warn_unreachable = true strict_equality = true -[tool.bandit] -exclude_dirs = [ ".venv", "__pycache__", ".git", "htmlcov", "tests" ] - [tool.coverage.run] source = [ "src" ] branch = true @@ -117,8 +100,8 @@ skip_covered = false [tool.coverage.html] directory = "htmlcov" + [tool.vulture] min_confidence = 80 -exclude = [ "__pycache__" ] ignore_names = [ "cls" ] -paths = [ "src", "tests" ] +paths = [ "src" ] From 5f0a27869f29eb6d83345c3cd30489ee216a0864 Mon Sep 17 00:00:00 2001 From: Dmitrii Safronov Date: Wed, 6 May 2026 07:00:20 +0400 Subject: [PATCH 3/7] build: Refactor mypy config for strict type checking Update pyproject.toml to enable strict mypy mode and remove redundant config options to improve code maintainability and reduce warnings Signed-off-by: Dmitrii Safronov --- pyproject.toml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b9a5f7c..5206972 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,18 +66,9 @@ exclude = [ ".venv" ] [tool.mypy] files = [ "src" ] -warn_return_any = true +strict = true warn_unused_configs = true -disallow_untyped_defs = true -disallow_incomplete_defs = true -check_untyped_defs = true -disallow_untyped_decorators = true -no_implicit_optional = true -warn_redundant_casts = true -warn_unused_ignores = true -warn_no_return = true warn_unreachable = true -strict_equality = true [tool.coverage.run] source = [ "src" ] @@ -86,11 +77,8 @@ branch = true [tool.coverage.report] fail_under = 100 exclude_lines = [ - "def __repr__", - "if self\\.debug", "raise AssertionError", "raise NotImplementedError", - "if 0:", "if __name__ == .__main__.:", "@(abc\\.)?abstractmethod" ] From 75870d117d006cd1184782eb71b336110878f110 Mon Sep 17 00:00:00 2001 From: Dmitrii Safronov Date: Thu, 7 May 2026 12:20:31 +0400 Subject: [PATCH 4/7] ci: Simplify auto-pr-description workflow Remove unused head ref and simplify title logic to only handle release branch Signed-off-by: Dmitrii Safronov --- .github/workflows/auto-pr-description.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/auto-pr-description.yml b/.github/workflows/auto-pr-description.yml index 0d9cb8a..0c1519c 100644 --- a/.github/workflows/auto-pr-description.yml +++ b/.github/workflows/auto-pr-description.yml @@ -43,7 +43,6 @@ jobs: const now = new Date().toISOString().slice(0,16).replace('T',' '); const body = process.env.PR_BODY; const base = context.payload.pull_request.base.ref; - const head = context.payload.pull_request.head.ref; const update = { owner: context.repo.owner, repo: context.repo.repo, @@ -51,13 +50,8 @@ jobs: body, }; - // Branch roles come from `.releaserc.cjs`: - // - base `release`: stable releases - // - base `main`: prereleases ("rc") if (base === 'release') { update.title = `Release! PR for ${now}`; - } else if (base === 'main') { - update.title = `PR for ${now}`; } await github.rest.pulls.update(update); From 4733bd6aaa0fabaf86cd4908d409056ee826af3a Mon Sep 17 00:00:00 2001 From: Dmitrii Safronov Date: Thu, 7 May 2026 13:00:03 +0400 Subject: [PATCH 5/7] ci: remove reformat check step from CI workflow Removed "Check if code was reformatted" step from .github/workflows/lint_and_test.yaml. The git diff --exit-code check after make all was causing false positives during CI runs. This change simplifies the workflow by eliminating redundant formatting validation that's already enforced locally via pre-commit. Signed-off-by: Dmitrii Safronov --- .github/workflows/lint_and_test.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/lint_and_test.yaml b/.github/workflows/lint_and_test.yaml index 59b3862..5e769cb 100644 --- a/.github/workflows/lint_and_test.yaml +++ b/.github/workflows/lint_and_test.yaml @@ -35,7 +35,3 @@ jobs: run: make all env: UV_PYTHON: ${{ matrix.python-version }} - - - name: Check if code was reformatted - if: always() - run: git diff --exit-code From d34e5b63f7326febee051a540dee197d9e02ff44 Mon Sep 17 00:00:00 2001 From: Dmitrii Safronov Date: Fri, 22 May 2026 16:16:17 +0400 Subject: [PATCH 6/7] fix: respect logger filters for validation errors Signed-off-by: Dmitrii Safronov --- .../schema_logger.py | 3 +- tests/private/test_schema_logger.py | 4 +-- tests/test_logging_compatibility.py | 32 +++++++++++++++++++ 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/logging_objects_with_schema/schema_logger.py b/src/logging_objects_with_schema/schema_logger.py index 3b4fbf8..1af1387 100644 --- a/src/logging_objects_with_schema/schema_logger.py +++ b/src/logging_objects_with_schema/schema_logger.py @@ -185,7 +185,6 @@ def _log( sinfo, # sinfo - stack info from caller ) try: - self.callHandlers(error_record) + self.handle(error_record) except Exception: - # If handler failed, log error to stderr (standard logging behavior) sys.stderr.write(f"Error in logging handler: {error_record}\n") diff --git a/tests/private/test_schema_logger.py b/tests/private/test_schema_logger.py index f189285..d6ad39e 100644 --- a/tests/private/test_schema_logger.py +++ b/tests/private/test_schema_logger.py @@ -434,11 +434,11 @@ def mock_dumps(*args, **kwargs): assert "validation_errors" in output -def test_schema_logger_log_handles_callhandlers_exception( +def test_schema_logger_log_handles_validation_error_handler_exception( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, ) -> None: - """SchemaLogger._log should handle callHandlers exception gracefully.""" + """SchemaLogger._log should handle validation error handler exceptions.""" monkeypatch.chdir(tmp_path) _write_schema( tmp_path, diff --git a/tests/test_logging_compatibility.py b/tests/test_logging_compatibility.py index 556e0be..5a30cd2 100644 --- a/tests/test_logging_compatibility.py +++ b/tests/test_logging_compatibility.py @@ -126,3 +126,35 @@ def test_schema_logger_accepts_extra_fields_without_error( output = stream.getvalue() assert "msg" in output + + +def test_schema_logger_validation_errors_respect_logger_filters( + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, +) -> None: + """Validation error records should pass through logger filters.""" + + monkeypatch.chdir(tmp_path) + _write_schema( + tmp_path, + { + "ServicePayload": { + "RequestID": {"type": "str", "source": "request_id"}, + }, + }, + ) + + stream = StringIO() + handler = logging.StreamHandler(stream) + handler.setFormatter(logging.Formatter("%(levelname)s:%(message)s")) + + logger = SchemaLogger("test-filtered-validation-errors") + logger.addHandler(handler) + logger.setLevel(logging.INFO) + logger.addFilter(lambda record: not record.getMessage().startswith("{")) + + logger.info("msg", extra={"request_id": 42}) + + output = stream.getvalue() + assert "INFO:msg" in output + assert "validation_errors" not in output From aff400ed36c07b09721b7b349e9dae9ef2eb8b41 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 22 May 2026 12:37:16 +0000 Subject: [PATCH 7/7] chore(release): 1.0.1-rc.1 ## [1.0.1-rc.1](https://github.com/disafronov/python-logging-objects-with-schema/compare/v1.0.0...v1.0.1-rc.1) (2026-05-22) ### Bug Fixes * respect logger filters for validation errors ([d34e5b6](https://github.com/disafronov/python-logging-objects-with-schema/commit/d34e5b63f7326febee051a540dee197d9e02ff44)) Signed-off-by: semantic-release-bot --- CHANGELOG.md | 6 ++++++ pyproject.toml | 3 +-- uv.lock | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 172ff2f..a58085e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [1.0.1-rc.1](https://github.com/disafronov/python-logging-objects-with-schema/compare/v1.0.0...v1.0.1-rc.1) (2026-05-22) + +### Bug Fixes + +* respect logger filters for validation errors ([d34e5b6](https://github.com/disafronov/python-logging-objects-with-schema/commit/d34e5b63f7326febee051a540dee197d9e02ff44)) + ## [1.0.0](https://github.com/disafronov/python-logging-objects-with-schema/compare/v0.4.1...v1.0.0) (2026-05-05) ### ⚠ BREAKING CHANGES diff --git a/pyproject.toml b/pyproject.toml index 5206972..bc109c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "uv_build" [project] name = "logging-objects-with-schema" -version = "1.0.0" +version = "1.0.1rc1" description = "Proxy logging wrapper that validates extra fields against a JSON schema." readme = "README.md" requires-python = ">=3.11" @@ -88,7 +88,6 @@ skip_covered = false [tool.coverage.html] directory = "htmlcov" - [tool.vulture] min_confidence = 80 ignore_names = [ "cls" ] diff --git a/uv.lock b/uv.lock index e9c413c..2fe1843 100644 --- a/uv.lock +++ b/uv.lock @@ -1363,7 +1363,7 @@ version = "0.10.0" [[package]] name = "logging-objects-with-schema" -version = "1.0.0" +version = "1.0.1rc1" [package.source] editable = "."