fix(evidence): use @model_validator(mode='before') so evidences appear in API responses
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
FastAPI 0.136.1 + Pydantic 2.13.4 serialises responses via TypeAdapter which calls the compiled Rust validator directly, bypassing any Python-level `model_validate` classmethod override. The @model_validator(mode='before') decorator IS invoked by the Rust pipeline, so the evidence red/blue split and technique field population now run on every serialisation path. Also eager-load technique in get_test_detail to avoid lazy-load surprises. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -137,13 +137,13 @@ def create_test_from_template(
|
||||
|
||||
|
||||
def get_test_detail(db: Session, test_id: uuid.UUID) -> Test:
|
||||
"""Fetch a test with evidences eager-loaded.
|
||||
"""Fetch a test with evidences and technique eager-loaded.
|
||||
|
||||
Raises EntityNotFoundError if the test does not exist.
|
||||
"""
|
||||
test = (
|
||||
db.query(Test)
|
||||
.options(joinedload(Test.evidences))
|
||||
.options(joinedload(Test.evidences), joinedload(Test.technique))
|
||||
.filter(Test.id == test_id)
|
||||
.first()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user