Skip to content

Enable sqlite-backed tests#2

Open
Aviat-at wants to merge 2 commits intofeature/backend-md-file-implementation-il0from
morgan/review-provided-code
Open

Enable sqlite-backed tests#2
Aviat-at wants to merge 2 commits intofeature/backend-md-file-implementation-il0from
morgan/review-provided-code

Conversation

@Aviat-at
Copy link
Copy Markdown
Owner

Summary

  • provide default secrets/database settings and ensure the async engine skips unsupported pool arguments when running against SQLite
  • add a lightweight in-repo aiosqlite implementation and update models to use SQLite-friendly ID column types/JSON fields
  • make refresh tokens unique and update dependencies so the backend test suite can run against SQLite

Testing

  • pytest

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull 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".

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".

Comment on lines +152 to +155
async def _connect(database: str, **kwargs) -> Connection:
row_factory = kwargs.pop("row_factory", sqlite3.Row)
conn = await _run_in_thread(partial(sqlite3.connect, database, **kwargs))
conn.row_factory = row_factory
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid dispatching sqlite connection across random threads

The stub creates the sqlite3 connection inside _connect and then routes every method call through asyncio.to_thread. Because the connection is created without check_same_thread=False, any call that happens to run on a different worker thread than the one that created the connection will raise sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The real aiosqlite pins a dedicated worker thread to prevent this. This wrapper needs to either create the connection with check_same_thread=False or queue all operations onto a single thread, otherwise async tests will fail unpredictably when the thread pool chooses a different worker.

Useful? React with 👍 / 👎.

…n, monitoring and logging guide, security policy, terraform guide, testing strategy, and roadmap for MapleCMS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant