Skip to content

fix: harden Database.close fail-fast behavior#83

Merged
Helweg merged 2 commits into
mainfrom
fix/database-close-fail-fast-74
May 14, 2026
Merged

fix: harden Database.close fail-fast behavior#83
Helweg merged 2 commits into
mainfrom
fix/database-close-fail-fast-74

Conversation

@Helweg
Copy link
Copy Markdown
Owner

@Helweg Helweg commented May 14, 2026

Summary

Harden Database.close() so native database handles enter an explicit closed state and fail fast on use-after-close instead of silently swapping to an in-memory SQLite connection.

Changes

  • replaced the native Database connection storage with an explicit optional handle and shared helpers that return Database is closed after close
  • made close() idempotent while preserving cleanup behavior by dropping the real SQLite connection instead of swapping in a replacement database
  • added regression coverage for repeated close() calls, fail-fast post-close method calls, and file-release behavior after close

Testing

How were these changes tested?

  • Unit tests added/updated
  • Manual testing performed
  • Build passes (npm run build)
  • Typecheck passes (npm run typecheck)
  • Tests pass (npm run test:run)
  • Lint passes (npm run lint)

Release Labels

  • Added at least one release category label (feature, bug, performance, documentation, dependencies, refactor, test, chore, or skip-changelog)
  • Added at most one semver label (semver:major, semver:minor, semver:patch) when needed

Related Issues

Fixes #74

@Helweg Helweg added bug Bug fix test Test changes semver:patch Bug fix or patch labels May 14, 2026
@Helweg Helweg merged commit 929083b into main May 14, 2026
3 checks passed
@Helweg Helweg deleted the fix/database-close-fail-fast-74 branch May 14, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug fix semver:patch Bug fix or patch test Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden Database.close() to fail fast after close

1 participant