Skip to content

Add workspace_db_names(), document orphaned-DB cleanup in README - #35

Merged
aersam merged 1 commit into
mainfrom
testdb-cli-orphaned-followups
Sep 14, 2026
Merged

aersam merged 1 commit into
mainfrom
testdb-cli-orphaned-followups

Conversation

@aersam

@aersam aersam commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New pgdevkit.testdb.workspace_db_names(project_root=None) -> frozenset[str]: the single-workspace analog of find_orphaned_dbs() — every DB name this exact worktree currently owns (main DB + configured extra_db_suffixes), reusing the existing naming.expected_db_names() helper. Needed by bdt cleanup (bmsuisse/devtools) to know which DB(s) belong to one specific worktree being removed, as opposed to a whole-project orphan sweep.
  • Documented find_orphaned_dbs()/clean_testdb(orphaned=True)/pgdb testdb list-orphaned/clean --orphaned in the README — this had no README coverage at all before.
  • Version bumped 0.7.0 → 0.7.1, per this repo's convention of bumping inside the feature branch itself.

Test plan

  • ty check pgdevkit clean
  • pytest 255 passed
  • 3 new tests covering workspace_db_names()

🤖 Generated with Claude Code

Investigated the reported __init__.py export gap for find_orphaned_dbs --
not reproducible: pgdevkit 0.7.0 (both the git tag and the published PyPI
wheel) already imports and exports it correctly, and the `pgdb testdb
clean --orphaned`/`list-orphaned` CLI surface PR #34's own description
claimed to add is also present and documented. No bug found there.

What was genuinely missing: a single-workspace analog of
find_orphaned_dbs() for a caller that wants "which DB(s) does this exact
worktree own right now" (e.g. before removing that one worktree) without
sweeping the whole project. Added workspace_db_names(project_root=None),
reusing the existing expected_db_names() naming helper.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aersam
aersam marked this pull request as ready for review September 14, 2026 18:36
@aersam
aersam merged commit 9b4a950 into main Sep 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant