Remove references to "v4" throughout the code and documentation
Quality Gate / gate (push) Failing after 11s

This commit is contained in:
Jim Lancaster
2026-08-20 16:35:20 -05:00
parent eaeb0bc806
commit bf2f3ac09c
34 changed files with 140 additions and 550 deletions
+26 -26
View File
@@ -1,4 +1,4 @@
"""Integration tests for additive V4 document and relationship API routes."""
"""Integration tests for document and relationship API routes."""
from __future__ import annotations
@@ -13,9 +13,9 @@ from fastapi.testclient import TestClient
from sqlmodel import select
from transcription.api.errors import register_error_handlers
from transcription.api.v4_documents import get_document_service
from transcription.api.v4_documents import get_people_service
from transcription.api.v4_documents import router
from transcription.api.documents_api import get_document_service
from transcription.api.documents_api import get_people_service
from transcription.api.documents_api import router
from transcription.config import Settings
from transcription.config import SqliteSettings
from transcription.db import create_all
@@ -61,7 +61,7 @@ async def _person_role_id(*, db_url: str, semantic_key: str) -> UUID:
@contextmanager
def _v4_api_client(tmp_path: Path, *, db_filename: str) -> Generator[tuple[TestClient, str]]:
def _api_client(tmp_path: Path, *, db_filename: str) -> Generator[tuple[TestClient, str]]:
settings = Settings(
openrouter_api_key="test-key",
database=SqliteSettings(path=str(tmp_path / db_filename)),
@@ -98,8 +98,8 @@ def _v4_api_client(tmp_path: Path, *, db_filename: str) -> Generator[tuple[TestC
def test_list_document_types_returns_seeded_registry(tmp_path):
with _v4_api_client(tmp_path, db_filename="api-types.db") as (client, _db_url):
response = client.get("/api/v4/document-types")
with _api_client(tmp_path, db_filename="api-types.db") as (client, _db_url):
response = client.get("/api/document-types")
assert response.status_code == 200
payload = response.json()
@@ -108,8 +108,8 @@ def test_list_document_types_returns_seeded_registry(tmp_path):
def test_list_person_roles_returns_seeded_registry(tmp_path):
with _v4_api_client(tmp_path, db_filename="api-roles.db") as (client, _db_url):
response = client.get("/api/v4/person-roles")
with _api_client(tmp_path, db_filename="api-roles.db") as (client, _db_url):
response = client.get("/api/person-roles")
assert response.status_code == 200
payload = response.json()
@@ -119,11 +119,11 @@ def test_list_person_roles_returns_seeded_registry(tmp_path):
def test_set_document_type_by_id_updates_canonical_field(tmp_path):
with _v4_api_client(tmp_path, db_filename="api-doc-type.db") as (client, db_url):
with _api_client(tmp_path, db_filename="api-doc-type.db") as (client, db_url):
document_id, _ = _seed_document_and_person(db_url=db_url)
type_id = asyncio.run(_document_type_id(db_url=db_url, label="Form"))
response = client.put(
f"/api/v4/documents/{document_id}/type",
f"/api/documents/{document_id}/type",
json={"document_type_id": str(type_id)},
)
@@ -134,16 +134,16 @@ def test_set_document_type_by_id_updates_canonical_field(tmp_path):
def test_document_type_payload_requires_uuid_only(tmp_path):
with _v4_api_client(tmp_path, db_filename="api-doc-type-validation.db") as (client, db_url):
with _api_client(tmp_path, db_filename="api-doc-type-validation.db") as (client, db_url):
document_id, _ = _seed_document_and_person(db_url=db_url)
missing = client.put(f"/api/v4/documents/{document_id}/type", json={})
missing = client.put(f"/api/documents/{document_id}/type", json={})
invalid = client.put(
f"/api/v4/documents/{document_id}/type",
f"/api/documents/{document_id}/type",
json={"document_type_id": "record"},
)
unexpected = client.put(
f"/api/v4/documents/{document_id}/type",
f"/api/documents/{document_id}/type",
json={"document_type_id": str(UUID(int=1)), "ignored": True},
)
@@ -153,13 +153,13 @@ def test_document_type_payload_requires_uuid_only(tmp_path):
def test_document_people_role_aware_write_read_and_delete(tmp_path):
with _v4_api_client(tmp_path, db_filename="api-links.db") as (client, db_url):
with _api_client(tmp_path, db_filename="api-links.db") as (client, db_url):
document_id, person_id = _seed_document_and_person(db_url=db_url)
author_id = asyncio.run(_person_role_id(db_url=db_url, semantic_key="author"))
recipient_id = asyncio.run(_person_role_id(db_url=db_url, semantic_key="recipient"))
create_response = client.post(
f"/api/v4/documents/{document_id}/people",
f"/api/documents/{document_id}/people",
json={"person_id": str(person_id), "role_id": str(author_id)},
)
assert create_response.status_code == 200
@@ -171,7 +171,7 @@ def test_document_people_role_aware_write_read_and_delete(tmp_path):
link_id = created["id"]
update_response = client.patch(
f"/api/v4/document-people/{link_id}",
f"/api/document-people/{link_id}",
json={"role_id": str(recipient_id)},
)
assert update_response.status_code == 200
@@ -179,26 +179,26 @@ def test_document_people_role_aware_write_read_and_delete(tmp_path):
assert updated["role_id"] == str(recipient_id)
assert updated["role_label"] == "Recipient"
list_response = client.get(f"/api/v4/documents/{document_id}/people")
list_response = client.get(f"/api/documents/{document_id}/people")
assert list_response.status_code == 200
links = list_response.json()["links"]
assert len(links) == 1
assert links[0]["role_id"] == str(recipient_id)
delete_response = client.delete(f"/api/v4/document-people/{link_id}")
delete_response = client.delete(f"/api/document-people/{link_id}")
assert delete_response.status_code == 204
list_after_delete = client.get(f"/api/v4/documents/{document_id}/people")
list_after_delete = client.get(f"/api/documents/{document_id}/people")
assert list_after_delete.status_code == 200
assert list_after_delete.json()["links"] == []
def test_document_person_link_requires_role_id(tmp_path):
with _v4_api_client(tmp_path, db_filename="api-default-role.db") as (client, db_url):
with _api_client(tmp_path, db_filename="api-default-role.db") as (client, db_url):
document_id, person_id = _seed_document_and_person(db_url=db_url)
response = client.post(
f"/api/v4/documents/{document_id}/people",
f"/api/documents/{document_id}/people",
json={"person_id": str(person_id)},
)
@@ -206,19 +206,19 @@ def test_document_person_link_requires_role_id(tmp_path):
def test_duplicate_document_person_link_returns_conflict_envelope(tmp_path):
with _v4_api_client(tmp_path, db_filename="api-dup.db") as (client, db_url):
with _api_client(tmp_path, db_filename="api-dup.db") as (client, db_url):
document_id, person_id = _seed_document_and_person(db_url=db_url)
author_id = asyncio.run(_person_role_id(db_url=db_url, semantic_key="author"))
recipient_id = asyncio.run(_person_role_id(db_url=db_url, semantic_key="recipient"))
first = client.post(
f"/api/v4/documents/{document_id}/people",
f"/api/documents/{document_id}/people",
json={"person_id": str(person_id), "role_id": str(author_id)},
)
assert first.status_code == 200
second = client.post(
f"/api/v4/documents/{document_id}/people",
f"/api/documents/{document_id}/people",
json={"person_id": str(person_id), "role_id": str(recipient_id)},
)