Skip to content

Operational Database owner: validation and migration error handling gaps #4977

Open

Description

@DoodleBears

Found while reviewing the H-2 split of packages/core/src/database/owner.ts (#4969, Refs #4521). The split is a pure move, so these were left as-is.

  1. Connection leak on validation failure. If SQLite configuration, integrity checking or generation reading throws during active validation in prepareDatabase, the local connection can escape explicit closure before the owner enters recovery.
  2. Original migration error masked. If a migration closes the staging connection before throwing, migrateInStaging reads isTransaction on the closed connection and SQLite's ERR_INVALID_STATE replaces the original error.
  3. Sparse migration arrays. A sparse migration array can bypass the per-index checks in validateSchemaPlan and fail later during migration or ledger checks.

Each fix needs a regression test that fails on main.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions