Skip to content

Isolate detached curation work in the API test - #8

Merged
ehippy merged 1 commit into
mainfrom
agent/stabilize-sqlite-tests
Aug 9, 2026
Merged

ehippy merged 1 commit into
mainfrom
agent/stabilize-sqlite-tests

Conversation

@ehippy

@ehippy ehippy commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Rebase of #2 (originally by @LAIM69420) onto current main. The curation-kind refactor landed on main after this PR was opened (bug_sweep was collapsed into overseer, see 73a0eda); the rebase carried the fix forward onto the overseer version of the test via context matching, no manual edits needed.

What changed

  • stub the detached curation coroutine in the API routing test
  • wait until the scheduled stub has actually run before the test exits

Root cause

test_curate_endpoint_requires_auth_and_starts_in_background launched the real curation pass with asyncio.create_task and returned without joining it. The following test's fixture could then clear the shared SQLite database while that detached task still held or used another session, intermittently producing sqlite3.OperationalError: database is locked at the next test's setup.

Note: main separately picked up WAL mode + a busy_timeout at the engine level (ca91d67) since this PR was opened, which addresses the same symptom from a different angle. That's a good belt-and-suspenders complement, not a replacement — it doesn't make this test's background task deterministic, it just makes lock contention less likely to surface as a hard failure while the race still exists.

Validation

  • pytest tests/integration/test_api.py -q — 11 passed
  • pytest -q four consecutive times — 509 passed each run
  • ruff check tests/integration/test_api.py — clean

Closes #2.

@ehippy
ehippy merged commit cade8d3 into main Aug 9, 2026
1 check passed
@ehippy
ehippy deleted the agent/stabilize-sqlite-tests branch August 9, 2026 18:26
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.

2 participants