ci: keep contract test databases off overlay storage
Build and Test Quality Gate / Contract Web typecheck and build (pull_request) Successful in 6m38s
Build and Test Quality Gate / Python tests and Contract API migration (pull_request) Successful in 13m55s
Security Quality Gate / npm audit, Bandit, pip-audit, detect-secrets (pull_request) Successful in 10m12s

This commit is contained in:
2026-07-20 22:00:25 +08:00
parent 5ad6beac98
commit 45608f436f
3 changed files with 56 additions and 7 deletions
@@ -75,7 +75,12 @@ jobs:
-e yuqei-ai-sdk-python
- name: Test Contract API
run: python -m pytest yuqei-contract-platform/services/contract-api/tests -q
env:
TMPDIR: /dev/shm/yuqei-contract-tests
YUQEI_TEST_CLEAN_TMP_PATHS: "true"
run: |
mkdir -p "$TMPDIR"
python -m pytest yuqei-contract-platform/services/contract-api/tests -q
- name: Test AI Platform API
run: python -m pytest yuqei-ai-platform/services/ai-platform-api/tests -q
+6 -6
View File
@@ -2,7 +2,7 @@
## Decision
The current candidate is frozen for release review under tag `v2-rc-20260720.2`.
The current candidate is frozen for release review under tag `v2-rc-20260720.3`.
After the tag is created, only blocking bug fixes, tests, deployment configuration,
and release documentation may be added. New product features and schema changes are
outside this RC.
@@ -25,11 +25,11 @@ deployment/backup/health-check tooling, AI Provider acceptance tooling, authenti
review-worker integration, ambient-proxy isolation for internal AI Platform calls,
and per-key single-flight protection for Contract API read-cache misses.
Tag `v2-rc-20260720.2` supersedes `v2-rc-20260720.1` and `v2-rc-20260720`.
The earlier tags remain immutable. This follow-up fixes a cross-platform source-scan
gap by forcing the detect-secrets subprocess to read UTF-8 on Windows, and refreshes
the reviewed baseline from the complete Linux-equivalent scan. It also adds a focused
regression test so files containing non-GBK text cannot be silently skipped.
Tag `v2-rc-20260720.3` supersedes `v2-rc-20260720.2`, `v2-rc-20260720.1`, and
`v2-rc-20260720`. The earlier tags remain immutable. This follow-up keeps the
cross-platform UTF-8 source-scan fix and adds CI-only Contract API test resource
cleanup: SQLite test files use the runner's tmpfs and each test closes its client and
SQLAlchemy engine, preventing Docker overlay I/O from masking the quality gate.
## Verification evidence
@@ -0,0 +1,44 @@
from __future__ import annotations
import os
import shutil
from collections.abc import Iterator
from pathlib import Path
import fastapi.testclient
import pytest
from fastapi.testclient import TestClient as FastApiTestClient
_ACTIVE_CLIENTS: list[FastApiTestClient] = []
class ManagedTestClient(FastApiTestClient):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
_ACTIVE_CLIENTS.append(self)
# Test modules import TestClient during collection, after this conftest is loaded.
fastapi.testclient.TestClient = ManagedTestClient
@pytest.fixture(autouse=True)
def release_contract_test_resources(request: pytest.FixtureRequest) -> Iterator[None]:
yield
while _ACTIVE_CLIENTS:
client = _ACTIVE_CLIENTS.pop()
repository = getattr(client.app.state, "contract_repository", None)
engine = getattr(repository, "engine", None)
try:
client.close()
finally:
if engine is not None:
engine.dispose()
if os.getenv("YUQEI_TEST_CLEAN_TMP_PATHS") != "true":
return
tmp_path = request.node.funcargs.get("tmp_path")
if isinstance(tmp_path, Path) and tmp_path.exists():
shutil.rmtree(tmp_path, ignore_errors=True)