Skip to content

Bug: Unsafe DB connections and missing returns in cobol_refractor_controller.py #292

Closed

Description

@squid-protocol

Description
In cobol_refractor_controller.py, the IRStateManager contains paths where a database connection (Connection | None) is used without a None-check before calling .cursor() or .commit(). Additionally, get_dead_paras and get_orphaned_vars lack fallback return statements if the manager ends up in an unhandled mode.

Impact
If the database connection fails or drops, the missing None-checks will cause a hard crash. The missing fallback returns violate type safety and risk returning None instead of the expected set, cascading into downstream errors.

Proposed Fix

  • Add explicit self.conn is not None checks before executing SQLite operations.
  • Add return set() as the default fallback for getter methods.
  • Add regression tests to simulate dropped connections and invalid modes.

Activity

  1. added
    data-integrity
    priority: low
    on Jul 22, 2026
  2. added
    legacy-modernization
    bug
    on Aug 30, 2026
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

    bugdata-integritylegacy-modernizationpriority: low

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions