feat: add image attachments to messages
- upload, metadata and download endpoints for PNG/JPEG attachments:
limits before reading and decompression, type by content,
structural integrity check without decoding pixels, safe filename
- write order: pending row with object key -> PUT to S3 -> ready;
per-step DB sessions so no pool connection is held during transfers
- attachment_ids in messages (validation, idempotency hash, history);
whitespace-only text allowed with an attachment (teacher, 2026-10-20)
- migration: attachments and message_attachments tables, text length
CHECK relaxed with NOT VALID
- student tests, fault checks and driver commands for attachments;
rollout profile starts from e1161f7 and checks the commit first
- sync attachments deltas into main specs; rules, AGENTS.md, PLAN.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -118,6 +118,17 @@ def app_port() -> str:
|
||||
return "8080"
|
||||
|
||||
|
||||
def storage_names(project: str) -> dict[str, str]:
|
||||
"""Bucket и имя базы стенда — из окружения сервиса `api` в его
|
||||
конфигурации compose: по ним hook считает объекты вложений."""
|
||||
config = dc(project, "config", "--format", "json", quiet=True)
|
||||
environment = json.loads(config.stdout)["services"]["api"]["environment"]
|
||||
return {
|
||||
"FAULT_S3_BUCKET": environment["S3__BUCKET"],
|
||||
"FAULT_DATABASE": environment["DATABASE__NAME"],
|
||||
}
|
||||
|
||||
|
||||
def free_port() -> int:
|
||||
with socket.socket() as sock:
|
||||
sock.bind(("127.0.0.1", 0))
|
||||
@@ -276,12 +287,16 @@ def main() -> int:
|
||||
base_url = start_api(project, default_name, free_port(), {})
|
||||
tight_url = start_api(project, tight_name, free_port(), TIGHT_ENV)
|
||||
say(f"ready: api={base_url} tight={tight_url}")
|
||||
env = os.environ | {
|
||||
"BASE_URL": base_url,
|
||||
"FAULT_TIGHT_BASE_URL": tight_url,
|
||||
"FAULT_HOOK": str(FAULT_HOOK),
|
||||
"FAULT_PROJECT": project,
|
||||
}
|
||||
env = (
|
||||
os.environ
|
||||
| {
|
||||
"BASE_URL": base_url,
|
||||
"FAULT_TIGHT_BASE_URL": tight_url,
|
||||
"FAULT_HOOK": str(FAULT_HOOK),
|
||||
"FAULT_PROJECT": project,
|
||||
}
|
||||
| storage_names(project)
|
||||
)
|
||||
say("pytest -m fault")
|
||||
results["fault"] = run(
|
||||
"uv",
|
||||
|
||||
Reference in New Issue
Block a user