fix(logging): allowlist rag_core/audit.py for RAG001 - #37
Merged
Conversation
audit.py uses stdlib `logging.getLogger("rag.audit")` because rag_observability
depends on rag_core.types, so any import from rag_core.audit into
rag_observability.logging (directly or via the rag_core.logging shim) would
create a circular import. This matches the policy described in CLAUDE.md.
Also document the policy in docs/guides/logging-policy.md, including the full
allowlist table and instructions for extending it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
uv run python scripts/check_logging.pycurrently exits 1 onmain, reportingpackages/core/src/rag_core/audit.py:15forlogging.getLogger("rag.audit"). This is a pre-existing miss in the RAG001 allowlist, not a bug introduced by step 0.10.audit.pylegitimately needs stdliblogging:rag_observabilitydepends onrag_core.types(packages/observability/src/rag_observability/events.py:27), so any import pathrag_core.audit→rag_observability.logging(direct or via therag_core.loggingshim) is a circular import. CLAUDE.md already calls this file out as explicitly allowlisted; the allowlist in scripts/check_logging.py just didn't reflect it.packages/core/src/rag_core/audit.pyto_ALLOWLISTin scripts/check_logging.py with a comment explaining the circular-import reason.Documentation
Out-of-scope follow-up
RAG001 isn't currently wired into
.github/workflows/ci.yml— it only runs via the pre-commit hook andtask lint:logging. That's why this slipped tomain. Worth adding as a CI step in a separate PR (CLAUDE.md lists RAG001 among the blocking gates, so CI should enforce it).Test plan
uv run python scripts/check_logging.pyexits 0 on this branchaudit.pystill imports cleanly (no behavior change — only the allowlist was edited)🤖 Generated with Claude Code