Repository navigation
fix(logging): preserve critical exception tracebacks - #746
Conversation
Add exc_info=True to 5 logger.error/warning calls that were losing tracebacks. Promote last-sync-timestamp query failure from debug to warning with exc_info=True. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR enhances exception logging across multiple service modules by adding ChangesException Logging Enhancements
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
## Summary Adds `exc_info=True` to warning/critical exception log sites that currently log only stringified exceptions. ## Problem Several archive, acquisition, rendering, and query failure paths were preserving the error message but dropping the traceback. That makes post-incident diagnosis harder, especially for the same performance and maintenance work tracked in the daemon/event-history direction. ## Solution Update the affected logger calls in: - `polylogue/cli/query.py` - `polylogue/operations/archive.py` - `polylogue/pipeline/services/acquisition.py` - `polylogue/pipeline/services/acquisition_persistence.py` - `polylogue/pipeline/services/ingest_batch.py` - `polylogue/pipeline/services/rendering.py` Ref #716 ## Verification - `git diff --check HEAD~1..HEAD` - `ruff check polylogue/cli/query.py polylogue/operations/archive.py polylogue/pipeline/services/acquisition.py polylogue/pipeline/services/acquisition_persistence.py polylogue/pipeline/services/ingest_batch.py polylogue/pipeline/services/rendering.py` - Pre-push hook: `devtools verify --quick` passed (`ruff format`, `ruff check`, `mypy`, `render-all`, `verify-topology`, `verify-layering`, `verify-file-budgets`, `verify-test-ownership`, `verify-schema-roundtrip`, `verify-cross-cuts`, `verify-suppressions`, `verify-manifests`, `verify-witness-lifecycle`, `proof-pack check`)
Bumps [pytest-randomly](https://github.com/pytest-dev/pytest-randomly) from 4.1.0 to 5.0.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pytest-dev/pytest-randomly/blob/main/CHANGELOG.rst">pytest-randomly's changelog</a>.</em></p> <blockquote> <h2>5.0.0 (2026-09-01)</h2> <ul> <li> <p>Support Python 3.15.</p> </li> <li> <p>Shuffle tests in a wrapper around the <code>pytest_collection_modifyitems</code> hook, guaranteeing that the shuffle runs before all other plugins’ implementations of the hook.</p> <p>Previously, pytest-randomly shuffled in a plain <code>tryfirst</code> hook implementation. When another plugin also implemented the hook with <code>tryfirst</code>, as pytest-django does, whichever plugin pytest happened to register later ran first. Registration order comes from package metadata on disk, which can differ between seemingly identical environments — even two containers built from the same <code>Dockerfile</code>, or the same virtual environment after reinstalling a package. As a result, the same seed could yield different test orders in different environments. Worse, in environments where pytest-randomly ended up shuffling last, it silently destroyed the other plugin’s ordering — for pytest-django, the grouping of database tests that mirrors Django’s test runner (non-transactional database tests, then transactional ones, then the rest).</p> <p>Now the shuffle always runs first, and plugins that group tests with a stable sort apply their grouping on top of the shuffled order, so the final order is reproducible from the seed alone. In environments that previously hit the reversed hook order, upgrading changes the test order for a given seed — restoring both reproducibility and other plugins’ grouping.</p> <p><code>PR [#746](pytest-dev/pytest-randomly#746) <https://github.com/pytest-dev/pytest-randomly/pull/746></code><strong>. Thanks to milssky for the report in <code>Issue [#701](pytest-dev/pytest-randomly#701) <https://github.com/pytest-dev/pytest-randomly/issues/701></code></strong>.</p> </li> <li> <p>Require pytest 8+, the first version to require a version of pluggy that supports hook wrappers, as used by the above fix.</p> <p><code>PR [#746](pytest-dev/pytest-randomly#746) <https://github.com/pytest-dev/pytest-randomly/pull/746></code>__.</p> </li> <li> <p>Reset <code>Polyfactory <https://polyfactory.litestar.dev/></code>__\’s default random state at the start of every test, if it is installed.</p> <p>Thanks to Rahul Kumar in <code>PR [#735](pytest-dev/pytest-randomly#735) <https://github.com/pytest-dev/pytest-randomly/issues/735></code>__.</p> </li> <li> <p>Switch package build backend from setuptools to <code>uv_build <https://docs.astral.sh/uv/concepts/build-backend/></code>__. This makes builds with uv about nine times faster, since uv runs the backend natively, without creating a build environment or spawning a Python process. Additionally, source distributions no longer include test files, which setuptools previously included incompletely, missing the files needed to actually run them.</p> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pytest-dev/pytest-randomly/commit/89ddfb1025cf15a81eb3defec7554740f32bcbe3"><code>89ddfb1</code></a> Version 5.0.0</li> <li><a href="https://github.com/pytest-dev/pytest-randomly/commit/0d00951e3fd85145567adfa2b638c7987f3e33ef"><code>0d00951</code></a> Shuffle before other plugins' collection hooks (<a href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/746">#746</a>)</li> <li><a href="https://github.com/pytest-dev/pytest-randomly/commit/817091daca7b0540edb45da652ffc84a766724a1"><code>817091d</code></a> Upgrade dependencies (<a href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/745">#745</a>)</li> <li><a href="https://github.com/pytest-dev/pytest-randomly/commit/42a2066ee95bdb1c606945436d7170ef3a6376c5"><code>42a2066</code></a> Fix podcast link in README (<a href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/740">#740</a>)</li> <li><a href="https://github.com/pytest-dev/pytest-randomly/commit/c2a001d37d14abc95940c923f730a07ccf87b4e2"><code>c2a001d</code></a> Reset Polyfactory's default random state on each test (<a href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/735">#735</a>)</li> <li><a href="https://github.com/pytest-dev/pytest-randomly/commit/cc4762bcb547a455b670b812ea362c483a31e7ef"><code>cc4762b</code></a> Upgrade dependencies (<a href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/744">#744</a>)</li> <li><a href="https://github.com/pytest-dev/pytest-randomly/commit/94aba4ad675e863b65f024ab924688e595fa8a3f"><code>94aba4a</code></a> Upgrade dependencies (<a href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/743">#743</a>)</li> <li><a href="https://github.com/pytest-dev/pytest-randomly/commit/c9140eff32cadcdc14d82a944e63d3ad1b4dbe8c"><code>c9140ef</code></a> Support Python 3.15 (<a href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/741">#741</a>)</li> <li><a href="https://github.com/pytest-dev/pytest-randomly/commit/15f531e2a7c1c88f27febc9c92966472d5bb18fc"><code>15f531e</code></a> Switch build backend to uv_build (<a href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/739">#739</a>)</li> <li><a href="https://github.com/pytest-dev/pytest-randomly/commit/79eee6c2f5475911d178b1a42b649182cbfc5e9f"><code>79eee6c</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/738">#738</a>)</li> <li>Additional commits viewable in <a href="https://github.com/pytest-dev/pytest-randomly/compare/4.1.0...5.0.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Summary
Adds
exc_info=Trueto warning/critical exception log sites that currently log only stringified exceptions.Problem
Several archive, acquisition, rendering, and query failure paths were preserving the error message but dropping the traceback. That makes post-incident diagnosis harder, especially for the same performance and maintenance work tracked in the daemon/event-history direction.
Solution
Update the affected logger calls in:
polylogue/cli/query.pypolylogue/operations/archive.pypolylogue/pipeline/services/acquisition.pypolylogue/pipeline/services/acquisition_persistence.pypolylogue/pipeline/services/ingest_batch.pypolylogue/pipeline/services/rendering.pyRef #716
Verification
git diff --check HEAD~1..HEADruff check polylogue/cli/query.py polylogue/operations/archive.py polylogue/pipeline/services/acquisition.py polylogue/pipeline/services/acquisition_persistence.py polylogue/pipeline/services/ingest_batch.py polylogue/pipeline/services/rendering.pydevtools verify --quickpassed (ruff format,ruff check,mypy,render-all,verify-topology,verify-layering,verify-file-budgets,verify-test-ownership,verify-schema-roundtrip,verify-cross-cuts,verify-suppressions,verify-manifests,verify-witness-lifecycle,proof-pack check)Summary by CodeRabbit
Chores