fix: close DB connections, honor path env vars, gate CI on tests#8
Closed
vidaks wants to merge 1 commit into
Closed
fix: close DB connections, honor path env vars, gate CI on tests#8vidaks wants to merge 1 commit into
vidaks wants to merge 1 commit into
Conversation
A design/architecture/implementation review surfaced a set of small but real findings; this addresses them together. - Store leaked SQLite connections: _conn() used the bare sqlite3 context manager, which commits but never closes the handle — an fd leak and a ResourceWarning storm in the long-running maintain process. _conn is now a contextmanager that commits AND closes. - COLOPHON_DB and COLOPHON_REPORTS were documented (README, .env.example) but never read; the changelog DB and reports always used repo-relative paths. Both now override their defaults (unset => unchanged behaviour). The five duplicated report-directory blocks in the CLI collapsed into one helper. - CI compiled and linted but never ran the 69-test network-free suite, despite the docs stating it gates CI. Added the unittest step across Python 3.9-3.12. - Grimmory.token() let a raw urllib error (a bad X-Edda-Proxy-Auth secret or an unreachable server) escape past the CLI's GrimmoryError/PreconditionError handler as a traceback; it is now a GrimmoryError naming the endpoint. - Corrected the dedup docs: the README/CHANGELOG described an automated "collapse duplicate records" feature that was never built. The audit only identifies duplicate groups and suggests a keeper. - Removed a dead, misleading MAX_PER_RUN constant from heal.py (the per-run cap lives in backfill.py; heal_book enforces none). Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
|
Landed on |
vidaks
added a commit
that referenced
this pull request
Jul 9, 2026
A design/architecture/implementation review surfaced a set of small but real findings; this addresses them together. - Store leaked SQLite connections: _conn() used the bare sqlite3 context manager, which commits but never closes the handle — an fd leak and a ResourceWarning storm in the long-running maintain process. _conn is now a contextmanager that commits AND closes. - COLOPHON_DB and COLOPHON_REPORTS were documented (README, .env.example) but never read; the changelog DB and reports always used repo-relative paths. Both now override their defaults (unset => unchanged behaviour). The five duplicated report-directory blocks in the CLI collapsed into one helper. - CI compiled and linted but never ran the 69-test network-free suite, despite the docs stating it gates CI. Added the unittest step across Python 3.9-3.12. - Grimmory.token() let a raw urllib error (a bad X-Edda-Proxy-Auth secret or an unreachable server) escape past the CLI's GrimmoryError/PreconditionError handler as a traceback; it is now a GrimmoryError naming the endpoint. - Corrected the dedup docs: the README/CHANGELOG described an automated "collapse duplicate records" feature that was never built. The audit only identifies duplicate groups and suggests a keeper. - Removed a dead, misleading MAX_PER_RUN constant from heal.py (the per-run cap lives in backfill.py; heal_book enforces none).
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
A design/architecture/implementation review of Colophon surfaced a batch of small but real findings. This PR addresses them together — no behaviour change for existing deployments (every new knob defaults to the prior behaviour).
Findings fixed
Store._conn()used the baresqlite3context manager, which commits but never closes the handle — an fd leak and aResourceWarningstorm in the long-runningmaintainprocess._connis now a@contextmanagerthat commits and closes. (Verified: the suite now passes under-W error::ResourceWarning.)COLOPHON_DB/COLOPHON_REPORTSignored. Both were documented (README,.env.example) but never read — the changelog DB and reports always used repo-relative paths. They now override those defaults; unset ⇒ unchanged. The five duplicated report-directory blocks in the CLI collapsed into one_reports_dir()helper.unittest discoverstep across Python 3.9–3.12.Grimmory.token()let a rawurlliberror (a badX-Edda-Proxy-Authsecret or an unreachable server) escape past the CLI'sGrimmoryError/PreconditionErrorhandler. It is now aGrimmoryErrornaming the endpoint and cause.MAX_PER_RUNfromheal.py(the per-run cap lives inbackfill.py;heal_bookenforces none).Verification
python -m compileall colophon— cleanpython -W error::ResourceWarning -m unittest discover -s tests— 69 passruff check .— cleanCOLOPHON_DB/COLOPHON_REPORTSoverrides exercised manually (DB + reports dir created at the overridden paths)🤖 Generated with Claude Code