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.
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

    bugUnintended behavior or logic failure in the enginedata-integrityIssues relating to RAM state or SQLite database fidelitylegacy-modernizationCOBOL refractor, dead-code extraction, and JCL forgingpriority: lowUI tweaks, documentation, and minor optimizations

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions