Repository navigation
fix(logging): convert loguru printf-style calls to {} (fixes #458) - #479
gauravkr2209 wants to merge 9 commits into
Conversation
|
Summary: The conversions that are in the PR are correct, but the fix is incomplete. One loguru call still prints a raw %r, and the new guard's regex can't catch it. Strengths
Issues Major
Minor
Decision: REQUEST CHANGES.
|
VakninAriel
left a comment
There was a problem hiding this comment.
Code Review — PR #479
Verdict: ✅ Approve
Summary
Loguru does not interpolate printf-style placeholders, leaving important runtime details as literal %s or %d text in logs. This PR converts 19 calls across the database, Codex CLI, indexing and multi-hop search code to brace formatting and adds an AST-based guard against recurrence.
What's good
- The production edits preserve the existing logging arguments while fixing diagnostic values such as Codex transport attempts, timeout seconds and search result caps; the timeout becomes {}s rather than leaving its unit-suffixed placeholder behind.
- The guard operates on AST call nodes and includes explicit controls for brace formatting and the unit-suffixed %ds case, while leaving stdlib-only logging modules outside its scan.
Freshness warning: Package freshness checked 2026-11-11T15:38:58.574960+00:00: STALE: included heads/eligibility changed; see overview and freshness audit before posting. This report applies only to its pinned SHA.
| Severity | Count |
|---|---|
| 🔴 Critical | 0 |
| 🟠 High | 0 |
| 🟡 Medium | 0 |
| 🟢 Minor | 0 |
Findings
No retained findings. This is not a guarantee that the code is defect-free.
Review metadata and audit
Draft review for human approval. Nothing has been posted to GitHub.
Pinned head SHA: ec69e1456c7cd478c9422a6a914f285e2f41efa4
Package freshness checked 2026-11-11T15:38:58.574960+00:00: STALE: included heads/eligibility changed; see overview and freshness audit before posting. This report applies only to its pinned SHA.
PR: #479
Title: fix(logging): convert loguru printf-style calls to {} (fixes #458)
Author: gauravkr2209 · Branches: fix-458-loguru-printf → main
Diff merge base: 42c5711
Review scope: Full merge-base 42c5711 to pinned head ec69e14 diff against main: four production Python files and the new logging guard. Reviewed both completed reports and the complete pinned diff. PR #472 addresses overlapping logging fixes independently; do not apply both conversions blindly.
Eligibility: Bug fix addressing existing behavior; no new feature.
Overall assessment (audit only)
All 19 production Loguru conversions preserve arguments and correctly interpolate their values. No substantiated introduced production bug or current CI failure remains after reconciliation.
Strength evidence
- {"strength_index": 0, "path": "chunkhound/providers/llm/codex_cli_provider.py; chunkhound/services/search/multi_hop_strategy.py", "source": "pr-479.pinned.diff", "detail": "The pinned hunks replace format strings without changing call arguments, including 'Codex CLI timeout on attempt {} after {}s' and the result_limit diagnostics."}
- {"strength_index": 1, "path": "tests/test_loguru_format_guard.py", "source": "pr-479.pinned.diff", "detail": "find_printf_loguru_calls walks ast.Call nodes; test_scanner_catches_printf_style_and_ignores_braces includes %ds and brace controls, and the package scan skips sources without loguru. This is specific coverage, not a claim of an exhaustive logging analyzer."}
Verification
- Sonnet: UV_PROJECT_ENVIRONMENT=/home/e119870/views/g/my_chunkhound/.venv PYTHONDONTWRITEBYTECODE=1 uv run --no-sync python -m pytest -p no:cacheprovider --basetemp /tmp/chunkhound-pr-479-sonnet-a1-k8noq76y/bt tests/test_loguru_format_guard.py -q (120s timeout): 2 passed in 0.46s.
- Astra: timeout 45s env UV_PROJECT_ENVIRONMENT=/home/e119870/views/g/my_chunkhound/.venv PYTHONDONTWRITEBYTECODE=1 uv run --no-sync pytest -p no:cacheprovider --basetemp=/tmp/chunkhound-pr-479-astra-a1-t54o70w9/pytest-guard tests/test_loguru_format_guard.py: exit 0, 2 passed in 0.47s.
- Astra: timeout 75s env UV_PROJECT_ENVIRONMENT=/home/e119870/views/g/my_chunkhound/.venv PYTHONDONTWRITEBYTECODE=1 CHUNKHOUND_CODEX_DEBUG=1 uv run --no-sync pytest -p no:cacheprovider --basetemp=/tmp/chunkhound-pr-479-astra-a1-t54o70w9/pytest-codex tests/unit/test_codex_cli_provider.py tests/unit/test_codex_stdin_first.py tests/unit/test_codex_overlay_cleanup.py tests/unit/test_codex_error_redaction.py: exit 1, 21 setup errors from missing chunkhound_native.chunkhound_native.
- Astra: timeout 120s env UV_PROJECT_ENVIRONMENT=/home/e119870/views/g/my_chunkhound/.venv PYTHONDONTWRITEBYTECODE=1 uv run --no-sync mypy chunkhound --cache-dir=/tmp/chunkhound-pr-479-astra-a1-t54o70w9/mypy-cache: exit 1, 993 errors in 89 files. Repeated with --shadow-file for all four changed production files exported at merge base and a separate cache; output byte-for-byte identical (diff exit 0). Exact full baseline command retained in Astra report/provenance. Sonnet independently reported the same diagnostic counts without a baseline comparison.
- Astra: timeout 30s env UV_PROJECT_ENVIRONMENT=/home/e119870/views/g/my_chunkhound/.venv PYTHONDONTWRITEBYTECODE=1 uv run --no-sync python /tmp/chunkhound-pr-479-astra-a1-t54o70w9/check_logging.py: exit 0; all 19 conversions render correctly with unchanged arguments/kwargs, and the guard detects their merge-base equivalents.
- Reconciler read the complete 311-line pinned diff; git rev-parse HEAD matched and sha256sum matched both report hashes. An inline UV_PROJECT_ENVIRONMENT=/home/e119870/views/g/my_chunkhound/.venv PYTHONDONTWRITEBYTECODE=1 uv run --no-sync python script loaded the guard with runpy and executed logger.debug("missing for %s" % "demo.py"): guard flagged it, installed Loguru rendered missing for demo.py, exit 0.
- Reconciler verified both runner jobs succeeded; provenance valid=true, clean successful completion, pinned head/merge base, raw-report SHA256, and every assistant_messages provider/model/responseModel identity; two distinct backend models confirmed. Worktree HEAD matches manifest.
Limitations
- No full suite or native-enabled database/indexing validation was run. Codex tests were blocked at setup by the absent native extension, not shown to regress in this PR.
- Mypy does not pass; Astra baseline comparison found no new diagnostics. Reviewer commands/outcomes are attributed to their completed reports, not claimed as fresh reconciler test runs.
- CI is a captured snapshot, not a fresh run or a guarantee of current branch status.
- Model identities are verified declarations supplied by the reconciler; the renderer does not inspect raw reports or provenance events.
Disposition of discarded / merged findings
- Rejected Astra Minor candidate at tests/test_loguru_format_guard.py:83-86: eager Python percent interpolation is indeed valid and the comment is misleading, as independently reproduced. However, this only restricts a prospective formatting style in the new guard; no current source or supported runtime contract breaks. Under the requested actionable-bug-only scope this is optional guard-policy/documentation cleanup, not a retained defect.
- Rejected Sonnet guard blind spots (logger aliases, exception, additional percent specifiers) and silent SyntaxError handling: no actual current violation or regression was demonstrated; these are potential future guard hardening, not actionable introduced failures.
Independent reviewer provenance
- sonnet — provider: amat-tfy; requested model: standard-chat-dev/claude-sonnet-5.5; verified response model: aws-aidev-models/us.anthropic.claude-sonnet-5-5. Identity evidence · Raw report
- astra — provider: amat-tfy; requested model: frontier-chat-dev/gpt-6-astra; verified response model: gpt-6-astra. Identity evidence · Raw report
CI snapshot
Captured: 2026-11-11T14:18:23.581921+00:00. Eligibility green: True. Counts: {"SKIPPED": 2, "SUCCESS": 23}
- site-build: SUCCESS (COMPLETED)
- site-build-validation (ubuntu-latest): SUCCESS (COMPLETED)
- site-build-validation (macos-latest): SUCCESS (COMPLETED)
- site-build-validation (windows-latest): SUCCESS (COMPLETED)
- rust-checks (ubuntu-latest): SUCCESS (COMPLETED)
- rust-checks (macos-latest): SUCCESS (COMPLETED)
- rust-checks (windows-latest): SUCCESS (COMPLETED)
- native-wheel-smoke-arm64: SUCCESS (COMPLETED)
- native-dev-macos: SUCCESS (COMPLETED)
- watchman-runtime-validation (ubuntu-latest, 3.14): SUCCESS (COMPLETED)
- watchman-runtime-validation (windows-latest, 3.14): SUCCESS (COMPLETED)
- tests (ubuntu-latest, 3.14, 1): SUCCESS (COMPLETED)
- tests (ubuntu-latest, 3.14, 2): SUCCESS (COMPLETED)
- tests (ubuntu-latest, 3.14, 3): SUCCESS (COMPLETED)
- tests (macos-latest, 3.14, 1): SUCCESS (COMPLETED)
- tests (macos-latest, 3.14, 2): SUCCESS (COMPLETED)
- tests (macos-latest, 3.14, 3): SUCCESS (COMPLETED)
- tests (windows-latest, 3.14, 1): SUCCESS (COMPLETED)
- tests (windows-latest, 3.14, 2): SUCCESS (COMPLETED)
- tests (windows-latest, 3.14, 3): SUCCESS (COMPLETED)
- old-linux-wheel-smoke (Ubuntu 20.04 (glibc 2.31), UBUNTU_20_04_IMAGE, ca-certificates curl, 3.12): SUCCESS (COMPLETED)
- old-linux-wheel-smoke (Ubuntu 22.04 + Python 3.10, UBUNTU_22_04_IMAGE, ca-certificates curl pytho...: SUCCESS (COMPLETED)
- watchman-rollout-gate: SUCCESS (COMPLETED)
- pages-artifact: SKIPPED (COMPLETED)
- deploy: SKIPPED (COMPLETED)
Reviewed by Ariel Vaknin via pi.dev
…ff_aware_search_service.py and codex_cli_provider.py
…ff_aware_search_service.py and codex_cli_provider.py
…ff_aware_search_service.py and codex_cli_provider.py
|
Please resolve the merge conflicts so we can merge this 🙏 @VakninAriel next time, please merge with your approval so the PR doesn't drift 🙏 |
19 loguru calls converted from %s/%d to {} across those 4 files, args/kwargs unchanged; new AST guard test that scans loguru-importing files; rapid_yaml_parser.py intentionally excluded because it uses stdlib logging where %s is correct; tests actually run — guard test 2 passed, smoke test 3 passed / 3 failed with the same 3 failing on pristine main due to the missing chunkhound_native Rust module (not this change), ruff 151 pre-existing errors identical on both trees, full suite/mypy not run locally — please rely on CI.