"""Bounty report lifecycle: intake → assign → owner verdict → triage → severity → reward → payment → close. These tests pin the invariants that make the domain safe to operate: * the three axes cannot be driven into an inconsistent combination, * money cannot be promised without a severity, nor stranded by a close, * the business owner cannot set a triage status or a risk decision, * the report code is unique and sequential. """ from __future__ import annotations from datetime import UTC, datetime, timedelta from decimal import Decimal import pytest from app.core.exceptions import AppException, ValidationError from app.domains.bounty import config_service as cfg from app.domains.bounty import constants as const from app.domains.bounty import service as svc async def _person(db_session, *, email: str, name: str): import uuid as _uuid from app.identity.person_models import IdentityPerson person = IdentityPerson( id=_uuid.uuid4(), work_email=email, display_name=name, employment_status="active", source_system="successfactors", hris_person_id=f"sf-{email.split('@')[0]}", ) db_session.add(person) await db_session.flush() return person async def _report(db_session, actor=None, **kwargs): payload = { "title": "反射型 XSS on docs site", "researcher_email": "whitehat@example.com", "affected_system": "docs.pingcap.com", "raw_report": "There is an XSS at /search?q=