Skip to content

Studio tests: close WAL keepers at teardown under the real os.name (WindowsPath teardown errors) - #18191

Merged
danielhanchen merged 1 commit into
mainfrom
ci-wal-keeper-teardown-real-os-name
Nov 17, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-wal-keeper-teardown-real-os-name

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Studio's m-r shard can error at teardown on whichever test fakes Windows when a WAL keeper was opened during it (seen on #18168, an audio.cpp installer change):

_ ERROR at teardown of test_a_user_site_install_is_not_told_to_isolate_itself __
tests/conftest.py:758: in _isolate_wal_keepers
    rag_db.close_wal_keeper_for(path)
storage/rag_db.py:532: in close_wal_keeper_for
    resolved = Path(path).resolve()
E   pathlib._abc.UnsupportedOperation: cannot instantiate 'WindowsPath' on your system

Cause

The autouse _isolate_wal_keepers fixture closes the WAL keepers a test opened. Its teardown runs before that test's monkeypatch is undone (another autouse fixture already requested monkeypatch, so it is torn down later). About a dozen Studio tests fake Windows with monkeypatch.setattr(os, "name", "nt"), test_reset_password_command.py through its windows fixture among them. If a keeper was opened during such a test (by that test or a background thread from an earlier one), the cleanup's Path(path) is built while os.name is still "nt", so pathlib picks WindowsPath and raises on Linux. Whether it happens depends on what else runs on the worker.

rag_db.close_wal_keeper_for and the tests are fine; the cleanup ran under the faked platform.

Fix

_isolate_wal_keepers swaps the real os.name (captured when conftest loads) back in for its cleanup and restores the test's value afterwards, so the test's own monkeypatch undo still sees what it set.

New test_conftest_teardown_real_os_name.py fakes Windows and leaves a keeper entry for the cleanup to close, which is the CI state.

Verification

  • main conftest: the new test errors at teardown with UnsupportedOperation (the CI error).
  • this branch: it passes; with test_reset_password_command.py and the rag/studio DB and WAL tests, 301 passed.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T17:58:43.198459Z 19ae5f1 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 19ae5f1531

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit d90070b into main Nov 17, 2026
@danielhanchen
danielhanchen deleted the ci-wal-keeper-teardown-real-os-name branch November 17, 2026 17:59
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