Skip to content

chore: hygiene + CI gate (PR3 of bug-audit-v2)#110

Merged
lesnik512 merged 5 commits into
mainfrom
fix/bug-audit-v2-pr3-hygiene-ci
Jun 5, 2026
Merged

chore: hygiene + CI gate (PR3 of bug-audit-v2)#110
lesnik512 merged 5 commits into
mainfrom
fix/bug-audit-v2-pr3-hygiene-ci

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

PR3 of the 2026-06-05 bug-audit-v2 plan. Closes the four remaining hygiene/CI findings — pure chore PR, no production code paths change. Final PR of the audit; closes the loop on all 26 findings.

Findings closed

  • UX-4BaseBootstrapper.__init__ now emits a logger.warning(...) alongside the existing warnings.warn(InstrumentDependencyMissingWarning, ...) when a configured instrument is missing its optional dependency. Users who suppress one channel (python -W ignore, PYTHONWARNINGS=ignore) still see the other.
  • UX-5 — Added a bullet to CLAUDE.md under "Conventions" documenting the asymmetry between BaseConfig.from_dict (accepts explicit None as an override) and BaseConfig.from_object (filters None attributes, default takes over). Both methods already have docstrings; CLAUDE.md surfaces the asymmetry to contributors.
  • TEST-NEW-7 — Escalate InstrumentSkippedWarning (and its subclass InstrumentDependencyMissingWarning) to error during tests. Any unexpected emission outside a pytest.warns(...) block now fails the test.
  • SEC-5 — New .github/workflows/security-audit.yml runs pip-audit against the locked dependency set on every PR and weekly via cron. Mirrors ci.yml conventions (setup-uv@v3 with cache, Python 3.10 install, concurrency group). --no-deps --disable-pip avoids pip's ensurepip path which fails on uv-managed cpython 3.14.

Implementation notes

  • TEST-NEW-7 mechanism deviation: the spec placed filterwarnings = [...] in [tool.pytest.ini_options] of pyproject.toml. That triggers pytest's pytest_load_initial_conftests hook to resolve lite_bootstrap.exceptions.InstrumentSkippedWarning via __import__ BEFORE pytest-cov installs coverage tracing, causing lite_bootstrap module-level statements to execute outside coverage measurement (verified: drops total from 100% → 78.78%). Reviewer reproduced the drop locally. Workaround: register the filter via a pytest_configure() hook in tests/conftest.py, which runs after coverage is active. Functionally equivalent.
  • The pre-existing 2 warnings in pytest output ("collector.example.com" SEC-2 + CORS-related from test_config.py) are intentional — they're emitted by tests that don't wrap in pytest.warns() and represent the SEC-2/SEC-3 warnings being correctly triggered. Distinct from the filter's purpose, which targets InstrumentSkippedWarning specifically.

Test plan

  • just test — 187 passed (186 baseline + 1 new from UX-4 test), 100% coverage.
  • just lint-ci — clean (ruff, eof-fixer, ty).
  • pip-audit --no-deps --disable-pip locally — No known vulnerabilities found across 133 resolved packages.
  • Each commit scoped to one finding ID; reviewable at the task level.

Audit status

With PR3 merged, all 26 findings from the 2026-06-05 audit are resolved:

🤖 Generated with Claude Code

lesnik512 and others added 5 commits June 5, 2026 20:03
Per-task TDD steps for UX-4 (dual warn+log), UX-5 (CLAUDE.md from_object doc),
TEST-NEW-7 (pytest filterwarnings), and SEC-5 (pip-audit CI workflow). Pure
chore PR — no production code paths change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The two BaseConfig constructors behave differently on explicit None: from_dict
accepts None as an explicit override of the default, while from_object filters
None attributes and lets the default take over. Documented in method docstrings;
add a CLAUDE.md note for contributor visibility.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
BaseBootstrapper.__init__ now logs the missing-dependency event via stdlib
logging in addition to the existing warnings.warn. Users who suppress one
channel (python -W ignore, PYTHONWARNINGS=ignore) still see the other.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add pytest_configure hook in tests/conftest.py (not pyproject.toml filterwarnings)
so any unexpected InstrumentSkippedWarning (or subclass) fails the test. The
conftest hook approach is required because pyproject.toml filterwarnings causes
pytest to resolve the warning class via __import__ inside the _pytest.warnings
hook wrapper for pytest_load_initial_conftests — which fires before pytest-cov
installs coverage, causing all lite_bootstrap module-level statements to be
missed and total coverage to drop from 100% to 79%.

Tests that intentionally trigger the warning use pytest.warns(...) and continue
to pass; future regressions that emit the warning silently from unrelated code
paths now fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New workflow runs pip-audit against the locked dependency set on every PR and
weekly via cron. Mirrors the conventions of the existing ci.yml (setup-uv with
cache, Python 3.10, concurrency group). --no-deps --disable-pip avoids pip's
ensurepip path which has known issues on uv-managed cpython 3.14.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
lite_bootstrap/bootstrappers/base.py 100.00% <100.00%> (ø)
tests/conftest.py 100.00% <100.00%> (ø)
tests/test_free_bootstrap.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lesnik512 lesnik512 self-assigned this Jun 5, 2026
@lesnik512 lesnik512 merged commit a25bba6 into main Jun 5, 2026
9 checks passed
@lesnik512 lesnik512 deleted the fix/bug-audit-v2-pr3-hygiene-ci branch June 5, 2026 17:43
lesnik512 added a commit that referenced this pull request Jun 5, 2026
Three PRs (#108, #109, #110), 26 findings closed, 153 → 187 tests, 100% coverage
throughout. Captures what went well (per-PR sequencing, two-stage review catching
three real bugs), what didn't (three implementer-hallucination incidents,
cross-task __post_init__ cascade missed in PR2 plan, OTel API misread in audit,
SEC-2 host parser untested against canonical localhost:4317 form), and six
action items to harden the pipeline for the next audit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant