Skip to content

fix(review_logic): DB connection leak in _review_logic.py [F85] #42

Description

@ImmortalDemonGod

What

Finding F85 from audit/02-static-audit.md records a DB connection leak in flashcore/cli/_review_logic.py. The connection opened during review_logic() is not guaranteed to be closed in all exit paths, including the typer.Exit(code=1) path added by the F82 fix at _review_logic.py:45-47.

Why deferred

Explicitly classified as nice-to-have / separate PR in both .aiv/plans/c2-f82-plan.md §6 OUT OF SCOPE and the PR completion contract's OUT-OF-SCOPE REMINDERS:

"F85 (DB connection leak in _review_logic.py) — separate PR for F85."

F85 is a distinct audit finding from F82 (infinite retry loop). Bundling it into the F82 PR would violate the atomic-commit contract and complicate the evidence trail.

Acceptance criteria

  • review_logic() closes the DB connection in all exit paths (normal return, typer.Exit, and uncaught exception) — use a context manager or try/finally
  • The typer.Exit(code=1) path added in _review_logic.py:45-47 by the F82 fix does not leak a connection
  • Tests verify connection closure under: normal completion, all-fail (triggering typer.Exit), and exception from submit_review
  • aiv check on the F85 AIV packet exits with 0 blocking errors
  • audit/02-static-audit.md F85 entry updated to record CORRECTED: <commit-sha>

Reference

Audit source: https://github.com/ImmortalDemonGod/flashcore/blob/5bb2ea2ab72239e0d2de7cc51fd4b5b766e44bfb/audit/02-static-audit.md (locate the F85 entry)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions