Repository navigation
logwarden v0.8.1
logwarden v0.8.1
Status: Released 2026-11-22 · tag v0.8.1
GitLab support and clearer docs, from feedback by a team running logwarden on GitLab inside a
network without internet access. On GitHub, findings show up in the pull request through the
Action, SARIF and the PR comment. On GitLab, teams got only downloadable reports. Now findings
appear in the merge request, through GitLab's own Code Quality report.
What's new
--codequality FILEoncheckandlint-codewrites a
GitLab Code Quality report. With
artifacts: reports: codequality, GitLab lists new and resolved findings in the merge
request's Reports tab (every tier). Ultimate also marks them in the diff.- A finding sits on the source line that logged it when the line has
code.file.pathand
code.line.number(as for SARIF), else on its line in the log file. Paths are relative to
the repository (--source-rootstrips a build prefix). - Fingerprints don't contain line numbers, so a finding whose code moved stays the same
finding. Each finding has its own fingerprint, because GitLab merges identical ones. - Severity:
criticalforadr_sensitive_data,majorfor every other rule. - Like every report, it never contains logged values.
- A finding sits on the source line that logged it when the line has
- GitLab CI template
ci/gitlab/logwarden.gitlab-ci.yml:
a hidden.logwardenjob toextends:. It runs the Docker image (setLOGWARDEN_IMAGEto
your registry's copy), compares with the target branch's snapshot, writes the Code Quality
report and the HTML and Markdown reports, and needs no internet access. It reports and doesn't
block:allow_failure: exit_codes: [1]lets violations through, but a broken setup (exit 2)
still fails.
Docs
- Integration guide: the GitLab section uses the image and the template instead of
pip install. - Integration guide: new "Without internet access" section. It explains that the package
install and the first-run Weaver and semconv downloads are separate steps. Options:- the image mirrored into your registry;
logwarden setuprun once where the internet is reachable, then the cache copied;WEAVERandLOGWARDEN_SEMCONVpointing at local copies.
- README and integration guide:
configure()is optional. The checker reads whatever JSON a
service's own logger writes, and the pytest plugin captures through the app's own formatter. - Docs site: release notes of versions not yet released are listed as "(planned)", so
they don't look like releases.
Breaking changes
None.
Verification
| # | Claim | How it will be checked | Result |
|---|---|---|---|
| 1 | Code Quality report | Tests: every entry has the fields GitLab requires (description, check_name, fingerprint, severity from the allowed set, relative location.path, integer location.lines.begin); no BOM; fingerprints unique within a report and unchanged when the code moves; source location from code.*, else the log line; --source-root; baseline and disable respected; empty array when clean; no logged value; lint-code --codequality |
tests/test_codequality.py (7 tests): required fields and types, severities from the allowed set, relative paths without ./, no BOM, unique fingerprints; same fingerprints after the code moved 20 lines; code.* location, absolute path inside the repo made relative, path outside the repo → log line with "logged at …" in the description, --source-root maps it back; baseline, disable, clean run → []; stdin → path logs; 10 entries for bad.jsonl, the same rules as the SARIF results; hunter2 absent; lint-code --codequality on svc.py:4. CI run 44997384190: 258 tests green on Linux (py3.10, 3.13), macOS and Windows (Semgrep test skipped there). ✅ |
| 2 | In a real GitLab | GitLab CE and a runner in Docker, the runner without internet access, the template with the locally built image: on the default branch, then a merge request that adds one bad log call and fixes another. The Reports tab lists exactly one new and one resolved finding; the job passes with violations (allowed failure) and fails on a bad config (exit 2); the Markdown report shows the comparison with the target branch | GitLab CE 19.6.1 (Free) and gitlab-runner 19.6 in Docker. Jobs ran on an internal network that reached GitLab but not GitHub or PyPI (checked from a job container), with pull_policy = never, so only preloaded images could run: the 0.8.1 image under a mirror name and the runner helper. A project with its own JSON logger (no configure()) and the template, used as in the guide. main: pipeline "passed with warnings", the logwarden job an allowed failure (exit 1) with its Code Quality report; nothing downloaded. Merge request fixing A (status), adding B (method) and moving C (uid) down three lines: the Reports tab says "Code Quality scans found 1 new finding and 1 fixed finding", B at app.py:28, A at app.py:16 marked Fixed, C in neither list (screenshot). The job fetched main's snapshot with the job token although main's job had failed (allowed): report.md "1 new · 1 fixed · 1 unchanged". A pipeline with LOGWARDEN_LOGS=nope.jsonl: the job fails with exit 2, "no such file", and the pipeline fails. ✅ |
| 3 | Docs | The integration guide's GitLab job is the template's; the offline options work: logwarden setup with the cache copied to a machine without network, and WEAVER + LOGWARDEN_SEMCONV, both give the same result as online; the docs site lists v0.9.0 and v0.10.0 as "(planned)"; strict build passes |
Guide's GitLab job extends: .logwarden from the template; test_claim2_gitlab_template_shape checks the template (no -o, no pip/uvx, exit_codes: [1], Code Quality report) and test_versions its image tag. Offline, in python:3.11-slim with --network none and the 0.8.1 wheel: the cache prepared by LOGWARDEN_CACHE=… logwarden setup → bad.jsonl 10 violations; WEAVER + LOGWARDEN_SEMCONV with an empty cache → 10 violations; nothing prepared → exit 2, "weaver download failed". The template's script under sh and bash, offline, against a stand-in for GitLab's artifacts API that requires the job token: default branch → no comparison, exit 0; merge request into feature/base → fetches the snapshot (branch and job name URL-encoded), report.md shows "10 new · 0 fixed", 10 Code Quality entries, exit 1; target without a snapshot (404) → runs without comparison, exit 1; missing logs file → exit 2. Strict site build passes; the nav shows v0.10.0, v0.9.0 and v0.8.1 as "(planned)". ✅ |
| 4 | Release | CI on Linux, macOS and Windows; dry run to TestPyPI; after the tag, uvx logwarden==0.8.1 check --codequality from PyPI and the image :0.8.1 |
CI 44999836149 green on Linux, macOS and Windows; dry run 44999844540 published 0.8.1.dev13 to TestPyPI and the image :0.8.1.dev13, which (offline, --user 4242) writes a Code Quality report for bad.jsonl: 10 entries, severities critical and major. ✅ |