COW proxies are not recognised in ComplexTypeMetaDataMixin.deserialize.
还没有人认领这个 Issue。
评估
调研方向
Issue 指出 metadata.py 和 ComplexTypeMetaDataMixin.deserialize 是入口。阅读该方法和现有的 helper _unwrap_cow_proxy,然后运行提供的回归测试,使用 rune_cow 代理测试 Security.deserialize。代理在 dispatch 前被解包,且 validator 接受其底层值,即为完成。
由索引模型根据 Issue 内容生成。
描述
Bug Report
Steps to Reproduce:
- Write a Rune function that takes a complex-type parameter and uses it in a
constructor expression (e.g.set result -> field: param). - Call the generated Python function — rune_cow wraps every parameter in a
_COWObject before the function body runs. - pydantic calls the field's PlainValidator with the _COWObject proxy.
- Observe the exception.
Expected Result:
The COW proxy is transparently unwrapped and the underlying value is accepted
by the validator.
Actual Result:
PydanticCustomError is raised:
"Expected either or dict but got <class '_COWObject'>."
Environment:
rune-python-runtime 2.2.2, pydantic 2.14.1, Python 3.11
Additional Context:
The model-level _unwrap_cow_inputs validator unwraps the outer data dict but
does not unwrap individual field values before field validators run.
metadata.py ComplexTypeMetaDataMixin.deserialize tests isinstance(obj, cls)
and isinstance(obj, Reference), neither of which matches a _COWObject.
Fix: call _unwrap_cow_proxy(obj) at the top of deserialize before the dispatch
chain.
import pytest
from pydantic_core import PydanticCustomError
import finos._bundle
from finos.cdm.base.staticdata.asset.common.Security import Security
from rune.runtime.cow import rune_cow
def test_r2_cow_proxy_not_recognised_in_deserialize():
'''A COW-proxied Security instance passed to Security.deserialize raises
PydanticCustomError because isinstance(proxy, Security) is False.'''
security = Security.model_construct()
cow_security = rune_cow(security)
# The proxy is not an instance of Security, Reference or dict —
# deserialize falls through to the error branch.
with pytest.raises(PydanticCustomError):
Security.deserialize(cow_security, set())
- 主要语言
- Python
- 星标
- 0
- 派生
- 4
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 3
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
finos/rune-python-runtime 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
finos/rune-python-runtime#52 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
finos/rune-python-runtime#51 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
finos/rune-python-runtime#50 ·
-
难度 1/5 1 小时以内 新手友好度 84/100
finos/rune-python-runtime#47 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
finos/rune-python-runtime#43 ·
查看 finos/rune-python-runtime 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
volcengine/OpenViking#6445 ·
维护者通常 1 天内回复
-
BUG:Edit Album strips spaces from the password so albums with a leading/trailing space in the password can't be edited可能已有人在做 @ManyaJain111 今天认领。 未关闭bug enhancement possible-duplicate
难度 2/5 1-3 小时 新手友好度 77/100
AOSSIE-Org/PictoPy#1637 · 4 条评论 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
deepspeedai/DeepSpeed#8884 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
flagos-ai/FlagQuantum#718 ·
维护者通常 1 天内回复
-
bug CI-failure high priority
难度 1/5 1 小时以内 新手友好度 86/100
vllm-project/afd-plugin#483 ·
维护者通常 1 天内回复