-
Notifications
You must be signed in to change notification settings - Fork 530
Fix : Fix revisions commit endpoints silently discard unknown fields … #4415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| from typing import Optional, List, Tuple | ||
| from uuid import UUID | ||
|
|
||
| from pydantic import BaseModel, Field | ||
| from pydantic import BaseModel, ConfigDict, Field | ||
|
|
||
| from oss.src.core.shared.dtos import ( | ||
| sync_alias, | ||
|
|
@@ -154,6 +154,7 @@ class TestsetVariantQuery(VariantQuery): | |
|
|
||
|
|
||
| class TestsetRevisionData(BaseModel): | ||
| model_config = ConfigDict(extra="forbid") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify whether testset payload sanitization swallows validation failures and removes data.
rg -n -C4 '_sanitize_persisted_testset_revision_data|model_validate\(|except Exception|payload\.pop\("data"' api/oss/src/core/testsets/service.pyRepository: Agenta-AI/agenta Length of output: 2164 Avoid silently dropping invalid testset revision payloads
|
||
| testcase_ids: Optional[List[UUID]] = None | ||
| testcases: Optional[List[Testcase]] = None | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,6 +119,7 @@ class WorkflowQueryFlags(BaseModel): | |
|
|
||
|
|
||
| class WorkflowRevisionData(BaseModel): | ||
| model_config = ConfigDict(extra="forbid") | ||
| uri: Optional[str] = None | ||
|
Comment on lines
121
to
123
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The manual curl verification confirms the 422 behavior works correctly for /applications/revisions/commit. Acceptance tests for all five domains would be a good follow-up. Happy to add those here in this pr or a new one as preffered. |
||
|
|
||
| url: Optional[str] = None | ||
|
|
@@ -562,6 +563,7 @@ class EvaluatorVariantIdAlias(AliasConfig): | |
|
|
||
|
|
||
| class EvaluatorRevisionData(WorkflowRevisionData): | ||
| model_config = ConfigDict(extra="forbid") | ||
| pass | ||
|
|
||
|
|
||
|
|
@@ -712,6 +714,7 @@ class ApplicationVariantEdit(WorkflowVariantEdit): | |
|
|
||
|
|
||
| class ApplicationRevisionData(WorkflowRevisionData): | ||
| model_config = ConfigDict(extra="forbid") | ||
| pass | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: Agenta-AI/agenta
Length of output: 1062
🏁 Script executed:
Repository: Agenta-AI/agenta
Length of output: 50373
🏁 Script executed:
Repository: Agenta-AI/agenta
Length of output: 3379
🏁 Script executed:
Repository: Agenta-AI/agenta
Length of output: 13704
🏁 Script executed:
Repository: Agenta-AI/agenta
Length of output: 1240
🏁 Script executed:
Repository: Agenta-AI/agenta
Length of output: 13125
Avoid silently dropping
QueryRevisionDatawhen payload sanitization fails_sanitize_persisted_query_revision_datacatchesExceptionfromQueryRevisionData.model_validate(...)and returnsNone;_sanitize_query_revision_payloadthen doespayload.pop("data", None), so sanitizer/model-validation failures get converted into “no data”.QueryRevisionDatausesConfigDict(extra="forbid")and the router acceptsQueryRevisionCommitRequest(nestedQueryRevisionCommit.data: Optional[QueryRevisionData]); still, invaliddatareaching the sanitizer should be surfaced/logged rather than silently dropped.