Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

COW proxies are not recognised in ComplexTypeMetaDataMixin.deserialize.

未关闭 适合新手
#48 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

Issue 指出 metadata.py 和 ComplexTypeMetaDataMixin.deserialize 是入口。阅读该方法和现有的 helper _unwrap_cow_proxy,然后运行提供的回归测试,使用 rune_cow 代理测试 Security.deserialize。代理在 dispatch 前被解包,且 validator 接受其底层值,即为完成。

由索引模型根据 Issue 内容生成。

描述

Bug Report

Steps to Reproduce:
  1. Write a Rune function that takes a complex-type parameter and uses it in a
    constructor expression (e.g. set result -> field: param).
  2. Call the generated Python function — rune_cow wraps every parameter in a
    _COWObject before the function body runs.
  3. pydantic calls the field's PlainValidator with the _COWObject proxy.
  4. 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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

finos/rune-python-runtime 的其他 Issue

查看 finos/rune-python-runtime 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。