From 9708479a49d0f58136b46804936afebfd77c1aea Mon Sep 17 00:00:00 2001 From: gertbehi Date: Fri, 13 Mar 2026 17:12:20 +0100 Subject: [PATCH 1/6] refactor: improve type safety of get_logger --- logflow/core.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/logflow/core.py b/logflow/core.py index 8db4b1f..4177138 100644 --- a/logflow/core.py +++ b/logflow/core.py @@ -6,10 +6,13 @@ from datetime import datetime from multiprocessing import current_process from pathlib import Path -from typing import Any, List, Optional, Union +from typing import TYPE_CHECKING, Any, List, Optional, Union from loguru import logger +if TYPE_CHECKING: + from loguru import Logger + from logflow import discovery from logflow.config import load_config from logflow.intercept import setup_interception @@ -182,7 +185,7 @@ def shutdown_logging() -> None: warnings.warn(f"LogFlow: Failed to complete logger during shutdown: {e}") -def get_logger(name: Optional[str] = None) -> Any: +def get_logger(name: Optional[str] = None) -> "Logger": if not LoggingState.configured: configure_logging() return logger.bind(name=name) if name else logger From f8a92fe10b663e82e3e44b7730244b4e0c8dc14a Mon Sep 17 00:00:00 2001 From: gertbehi Date: Mon, 16 Mar 2026 14:01:31 +0100 Subject: [PATCH 2/6] feat: use recordIssues for separate quality gate graphs in Jenkins --- Jenkinsfile | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bf0ca71..829ead4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,7 +39,11 @@ ET.ElementTree(root).write('black-report.xml', xml_declaration=True, encoding='u } post { always { - junit allowEmptyResults: true, testResults: 'black-report.xml' + recordIssues( + tool: junitXml(id: 'black', name: 'Black Formatting', pattern: 'black-report.xml'), + enabledForFailure: true, + skipBlames: true + ) } } } @@ -61,7 +65,11 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u } post { always { - junit allowEmptyResults: true, testResults: 'isort-report.xml' + recordIssues( + tool: junitXml(id: 'isort', name: 'Isort Import Order', pattern: 'isort-report.xml'), + enabledForFailure: true, + skipBlames: true + ) } } } @@ -73,7 +81,11 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u } post { always { - junit allowEmptyResults: true, testResults: 'flake8-report.xml' + recordIssues( + tool: junitXml(id: 'flake8', name: 'Flake8', pattern: 'flake8-report.xml'), + enabledForFailure: true, + skipBlames: true + ) } } } @@ -83,7 +95,11 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u } post { always { - junit allowEmptyResults: true, testResults: 'mypy-report.xml' + recordIssues( + tool: junitXml(id: 'mypy', name: 'Mypy', pattern: 'mypy-report.xml'), + enabledForFailure: true, + skipBlames: true + ) } } } From 538863aac78ce0369f7994824596f845ab260379 Mon Sep 17 00:00:00 2001 From: Gert Behiels Date: Mon, 16 Mar 2026 15:32:03 +0100 Subject: [PATCH 3/6] fix: use compatible recordIssues syntax (#6) --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 829ead4..1481089 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ ET.ElementTree(root).write('black-report.xml', xml_declaration=True, encoding='u post { always { recordIssues( - tool: junitXml(id: 'black', name: 'Black Formatting', pattern: 'black-report.xml'), + tools: [junit(id: 'black', name: 'Black Formatting', pattern: 'black-report.xml')], enabledForFailure: true, skipBlames: true ) @@ -66,7 +66,7 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u post { always { recordIssues( - tool: junitXml(id: 'isort', name: 'Isort Import Order', pattern: 'isort-report.xml'), + tools: [junit(id: 'isort', name: 'Isort Import Order', pattern: 'isort-report.xml')], enabledForFailure: true, skipBlames: true ) @@ -82,7 +82,7 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u post { always { recordIssues( - tool: junitXml(id: 'flake8', name: 'Flake8', pattern: 'flake8-report.xml'), + tools: [junit(id: 'flake8', name: 'Flake8', pattern: 'flake8-report.xml')], enabledForFailure: true, skipBlames: true ) @@ -96,7 +96,7 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u post { always { recordIssues( - tool: junitXml(id: 'mypy', name: 'Mypy', pattern: 'mypy-report.xml'), + tools: [junit(id: 'mypy', name: 'Mypy', pattern: 'mypy-report.xml')], enabledForFailure: true, skipBlames: true ) From eb80ea6aa616babbfe24e0934a3beb324407e19d Mon Sep 17 00:00:00 2001 From: gertbehi Date: Mon, 16 Mar 2026 17:56:12 +0100 Subject: [PATCH 4/6] fix: use recordCoverage for separate quality gate graphs --- Jenkinsfile | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1481089..be81475 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,10 +39,10 @@ ET.ElementTree(root).write('black-report.xml', xml_declaration=True, encoding='u } post { always { - recordIssues( - tools: [junit(id: 'black', name: 'Black Formatting', pattern: 'black-report.xml')], - enabledForFailure: true, - skipBlames: true + recordCoverage( + id: 'black', + name: 'Black Formatting', + tools: [[parser: 'JUNIT', pattern: 'black-report.xml']] ) } } @@ -65,10 +65,10 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u } post { always { - recordIssues( - tools: [junit(id: 'isort', name: 'Isort Import Order', pattern: 'isort-report.xml')], - enabledForFailure: true, - skipBlames: true + recordCoverage( + id: 'isort', + name: 'Isort Import Order', + tools: [[parser: 'JUNIT', pattern: 'isort-report.xml']] ) } } @@ -81,10 +81,10 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u } post { always { - recordIssues( - tools: [junit(id: 'flake8', name: 'Flake8', pattern: 'flake8-report.xml')], - enabledForFailure: true, - skipBlames: true + recordCoverage( + id: 'flake8', + name: 'Flake8', + tools: [[parser: 'JUNIT', pattern: 'flake8-report.xml']] ) } } @@ -95,10 +95,10 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u } post { always { - recordIssues( - tools: [junit(id: 'mypy', name: 'Mypy', pattern: 'mypy-report.xml')], - enabledForFailure: true, - skipBlames: true + recordCoverage( + id: 'mypy', + name: 'Mypy', + tools: [[parser: 'JUNIT', pattern: 'mypy-report.xml']] ) } } From a2a2ee78ddc98f46023c61f30cddc5118991c886 Mon Sep 17 00:00:00 2001 From: gertbehi Date: Mon, 16 Mar 2026 21:39:41 +0100 Subject: [PATCH 5/6] chore: fix Jenkinsfile to support separate graphs for all quality stages --- Jenkinsfile | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index be81475..4346b9a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -75,9 +75,19 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u } stage('Flake8') { steps { - sh "rm -f flake8.txt flake8-report.xml" - sh "${VENV_BIN}/flake8 logflow tests examples --tee --output-file=flake8.txt || true" - sh "if [ -f flake8.txt ]; then ${VENV_BIN}/flake8_junit flake8.txt flake8-report.xml; fi" + script { + def rc = sh(script: "${VENV_BIN}/flake8 logflow tests examples > flake8-output.txt 2>&1", returnStatus: true) + sh """${VENV_BIN}/python3 -c " +import xml.etree.ElementTree as ET +rc = ${rc} +root = ET.Element('testsuite', name='flake8', tests='1', failures=str(min(rc, 1))) +tc = ET.SubElement(root, 'testcase', classname='flake8', name='lint-check') +if rc != 0: + with open('flake8-output.txt') as f: + ET.SubElement(tc, 'failure', message='Flake8 linting issues found').text = f.read() +ET.ElementTree(root).write('flake8-report.xml', xml_declaration=True, encoding='unicode') +" """ + } } post { always { @@ -91,7 +101,9 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u } stage('Mypy') { steps { - sh "${VENV_BIN}/mypy logflow tests examples --junit-xml=mypy-report.xml || true" + script { + sh "${VENV_BIN}/mypy logflow tests examples --junit-xml=mypy-report.xml || true" + } } post { always { @@ -115,8 +127,17 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u // Archive and display JUnit test results junit allowEmptyResults: true, testResults: 'test-report.xml' - // Display Coverage in Jenkins UI using Code Coverage API Plugin - recordCoverage tools: [[parser: 'COBERTURA', pattern: 'coverage.xml']] + // Display Coverage and Test Results as separate graphs using unique IDs + recordCoverage( + id: 'unit-tests', + name: 'Unit Tests', + tools: [[parser: 'JUNIT', pattern: 'test-report.xml']] + ) + recordCoverage( + id: 'coverage', + name: 'Code Coverage', + tools: [[parser: 'COBERTURA', pattern: 'coverage.xml']] + ) } } } From 675db8688de8e76e5266330f8244239b306e643a Mon Sep 17 00:00:00 2001 From: gertbehi Date: Mon, 16 Mar 2026 21:52:02 +0100 Subject: [PATCH 6/6] chore: opt into Node.js 24 for GitHub Actions to resolve deprecation warnings --- .github/workflows/ci.yml | 3 +++ Jenkinsfile | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebe24b3..ca537aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ main ] +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + jobs: formatting: name: Formatting (Isort & Black) diff --git a/Jenkinsfile b/Jenkinsfile index 4346b9a..c83685e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,6 +5,8 @@ pipeline { // Local virtual environment within the Jenkins workspace for portability VENV_PATH = "${WORKSPACE}/.venv" VENV_BIN = "${VENV_PATH}/bin" + // Opt into Node.js 24 for GitHub Actions if used via plugins + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 = 'true' } stages {