Skip to content

Commit 82239d2

Browse files
Fix CI: update TypeScript tag pattern test and fix async resource leak
- test_protocol_structure: assert "ts-v*" to match actual TypeScript release workflow tag prefix (was asserting "v*") - CapsuleStorage: accept **engine_kwargs forwarded to create_async_engine - conftest: use NullPool for test storage to prevent aiosqlite socket leak from non-deterministic GC across test boundaries
1 parent 470f7cd commit 82239d2

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

reference/python/src/qp_capsule/storage.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
from pathlib import Path
2525
from uuid import UUID
2626

27+
from typing import Any
28+
2729
from sqlalchemy import Integer, String, Text, desc, func, select
2830
from sqlalchemy.ext.asyncio import (
2931
AsyncEngine,
@@ -80,15 +82,17 @@ class CapsuleStorage:
8082
capsules = await storage.list(limit=10)
8183
"""
8284

83-
def __init__(self, db_path: Path | None = None):
85+
def __init__(self, db_path: Path | None = None, **engine_kwargs: Any):
8486
"""
8587
Initialize storage.
8688
8789
Args:
8890
db_path: Path to SQLite database file.
8991
Defaults to $QUANTUMPIPES_DATA_DIR/capsules.db or ~/.quantumpipes/capsules.db
92+
**engine_kwargs: Forwarded to ``create_async_engine`` (e.g. ``poolclass``).
9093
"""
9194
self.db_path = db_path or default_db_path()
95+
self._engine_kwargs = engine_kwargs
9296
self._engine: AsyncEngine | None = None
9397
self._session_factory: async_sessionmaker[AsyncSession] | None = None
9498

@@ -106,6 +110,7 @@ async def _ensure_db(self) -> None:
106110
self._engine = create_async_engine(
107111
f"sqlite+aiosqlite:///{self.db_path}",
108112
echo=False,
113+
**self._engine_kwargs,
109114
)
110115

111116
async with self._engine.begin() as conn:

reference/python/tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pathlib import Path
1111

1212
import pytest
13+
from sqlalchemy.pool import NullPool
1314

1415
from qp_capsule.chain import CapsuleChain
1516
from qp_capsule.seal import Seal
@@ -20,7 +21,7 @@
2021
async def temp_storage(tmp_path: Path):
2122
"""Create temporary SQLite storage for testing. Closes on teardown."""
2223
db_path = tmp_path / "test_capsules.db"
23-
storage = CapsuleStorage(db_path=db_path)
24+
storage = CapsuleStorage(db_path=db_path, poolclass=NullPool)
2425
yield storage
2526
await storage.close()
2627

reference/python/tests/test_protocol_structure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ def test_typescript_release_workflow_exists(self):
708708

709709
def test_typescript_release_triggers_on_tags(self):
710710
text = (REPO_ROOT / ".github" / "workflows" / "typescript-release.yaml").read_text()
711-
assert '"v*"' in text, "TypeScript release must trigger on version tags"
711+
assert '"ts-v*"' in text, "TypeScript release must trigger on version tags"
712712

713713
def test_typescript_release_runs_conformance(self):
714714
text = (REPO_ROOT / ".github" / "workflows" / "typescript-release.yaml").read_text()

0 commit comments

Comments
 (0)