-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: introduce typed executor result schema #52
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
Open
kaiitunnz
wants to merge
26
commits into
main
Choose a base branch
from
kaiitunnz/refactor/result-schema
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
fc90b04
refactor: drop jsonl_export result echo and server rewriter
kaiitunnz 69edc34
feat(shared): add typed executor result and artifact schemas
kaiitunnz def4085
refactor(shared): type ResultEnvelope.result and artifact helpers
kaiitunnz 33785b6
refactor(worker): type non-inference, non-training executor results
kaiitunnz 14b8aae
refactor(worker): type inference-family executor results
kaiitunnz 08baf4d
refactor(worker): type training executor results
kaiitunnz 4ad5153
test: cover BaseExecutorResult round-trip and fix subclass field seri…
kaiitunnz 4fa6a43
docs: describe typed executor result schema
kaiitunnz 9d03ecd
chore: satisfy pre-commit hooks (black, isort, mypy)
kaiitunnz cd5fd0c
refactor: tighten executor result typing end-to-end
kaiitunnz 75083c9
refactor(worker): type upstream result and artifact resolver
kaiitunnz 3b2fe17
refactor(worker): inline ArtifactRef constructor at call sites
kaiitunnz e541a62
refactor(server): return typed BaseExecutorResult from get_result
kaiitunnz 62cfd96
refactor: unify sentinel attribute lookup in dispatcher and template …
kaiitunnz 3c98358
refactor(sdk): port typed result and artifact schemas
kaiitunnz 5762312
refactor(worker): construct executor results without post-hoc mutation
kaiitunnz f75aba8
docs: correct result schema references
kaiitunnz 034a21a
fix(worker): retype omni summary fields as ArtifactRef
kaiitunnz 210c6d2
refactor(worker): align lora/sft result schemas with peer training ex…
kaiitunnz 909a45a
fix(worker): type upstream context in graph-template and data-retriev…
kaiitunnz 0a42ae2
refactor: standardize ok across executor results and remove training_…
kaiitunnz 9a24320
fix(shared): rename internal artifacts field to artifacts_ and lock a…
kaiitunnz bdbf74b
chore: tighten SDK pydantic pin to >=2.12.3
kaiitunnz 48406cf
docs(worker): describe typed result contract in base_executor docstring
kaiitunnz 2ef78e0
chore(security): ignore CVEs with no fix versions in pip-audit
kaiitunnz c99082e
chore(security): ignore vllm/gradio CVEs surfaced by GPU pip-audit step
kaiitunnz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from pydantic import BaseModel, Field | ||
|
|
||
|
|
||
| class ArtifactRef(BaseModel): | ||
| path: str | ||
|
|
||
|
|
||
| class ArtifactContext(BaseModel): | ||
| base_dir: str | ||
| base_url: str | None = Field(default=None, exclude_if=lambda v: v is None) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,45 @@ | ||
| """Result-related models.""" | ||
|
|
||
| # This is necessary to allow for the recursive type hint of `children` in | ||
| # `BaseExecutorResult`. | ||
| from __future__ import annotations | ||
|
|
||
| from typing import Any | ||
|
|
||
| from pydantic import BaseModel, Field | ||
| from pydantic import BaseModel, ConfigDict, Field, SerializeAsAny | ||
|
|
||
| from .artifacts import ArtifactContext | ||
|
|
||
|
|
||
| class PathResponse(BaseModel): | ||
| ok: bool | ||
| path: str | ||
|
|
||
|
|
||
| class BaseExecutorResult(BaseModel): | ||
| model_config = ConfigDict(extra="allow", serialize_by_alias=True) | ||
|
|
||
| ok: bool = True | ||
| children: dict[str, SerializeAsAny[BaseExecutorResult]] = Field( | ||
| default_factory=dict, exclude_if=lambda v: not v | ||
| ) | ||
| artifacts_: ArtifactContext | None = Field(default=None, alias="_artifacts") | ||
|
|
||
| @classmethod | ||
| def __pydantic_init_subclass__(cls, **kwargs: Any) -> None: | ||
| super().__pydantic_init_subclass__(**kwargs) | ||
| if "artifacts_" in cls.__annotations__: | ||
| raise TypeError( | ||
| f"{cls.__name__} may not redefine the internal " | ||
| "BaseExecutorResult.artifacts_ field" | ||
| ) | ||
|
|
||
|
|
||
| class ResultEnvelope(BaseModel): | ||
| """Canonical on-disk shape of ``results.json`` (mirrors the server).""" | ||
|
|
||
| task_id: str | ||
| result: dict[str, Any] | ||
| result: SerializeAsAny[BaseExecutorResult] | ||
| worker_id: str | None = None | ||
| metadata: dict[str, Any] | None = None | ||
| received_at: str | None = Field(default=None) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
exclude_ifis a new feature since Pydantic v2.12.4 (https://pydantic.dev/docs/validation/latest/get-started/changelog/#v2124-2025-11-05). We need to bump the environment version pin.Uh oh!
There was an error while loading. Please reload this page.
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.
exclude_ifis actually available since Pydantic v2.12.0 (https://pydantic.dev/docs/validation/latest/get-started/changelog/#v2120b1-2025-10-03). The version you cited is a patch that refinesexclude_if's behavior, so there is no need to bump.In fact, we cannot bump because of the following dependency constraint:
vllm-omni==0.18.0 → gradio==5.50 → pydantic≤2.12.3..Anyway,
flowmesh-sdk's Pydantic pin still needs to be tightened.