Backing store enumeration returns internal tracking tuples instead of stored lists

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

维护者通常 1 天内回复

@pradeep-ramola 已经在做这个了。

开始于 2026年12月1日。

  • #939 来自 @pradeep-ramola —— 未关闭

评估

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

调研方向

阅读InMemoryBackingStore.enumerate_()的实现,以及BackingStore接口文档中关于返回值约定的说明。检查 issue 中提到的、预期返回包装器的现有断言,然后为列表值条目补充测试,并验证在两种变更值模式下,枚举都会返回已存储的列表。这些断言和相关抽象测试通过后即算完成。

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

描述

Environment

  • Python 3.14.5
  • Windows
  • microsoft-kiota-abstractions 1.19.0, current main at ee58dcfcf10fdc65dfde5f598236220aaef4c86d

Describe the bug

InMemoryBackingStore.enumerate_() returns an internal _Collection(items, size) tuple for list-valued entries rather than the list stored through set(). get() returns the original list, so the two read APIs disagree.

The BackingStore interface documents enumeration as returning the stored values, filtered according to return_only_changed_values. Scalars and tuples are already returned as the actual values.

To reproduce

from kiota_abstractions.store import InMemoryBackingStore

store = InMemoryBackingStore()
store.is_initialization_completed = True
items = [1, 2]
store.set("items", items)
for changed_only in (False, True):
    store.return_only_changed_values = changed_only
    print(store.enumerate_())
    print(dict(store.enumerate_())["items"] is items)

Actual in both modes:

[('items', _Collection(items=[1, 2], size=2))]
False

Expected:

[('items', [1, 2])]
True

This also affects empty lists, nested lists, and lists of backed models. A resized list still returns the tracking wrapper after its dirty state is refreshed.

Additional context

A focused fix can return val unconditionally in the final enumeration projection. The existing collection-size refresh and changed-value filtering do not need to change.

I checked existing issues and PRs. This is separate from #901's detached-model subscription lifecycle issue; no subscription behavior is changed. Two existing assertions currently depend on the wrapper and need to be corrected to assert actual list values.

I verified 20 new parameterized cases against unchanged source: 11 fail on list-valued results and nine pass as controls. With the candidate fix, all 307 abstractions tests and 239 JSON serialization tests pass. Strict mypy passes all 48 abstractions source files. No claim of an HTTP serialization failure is made here.

Implementation and tests were prepared with AI assistance and validated locally.

主要语言
Python
星标
31
派生
48
平均合并
16 小时 36 分钟
30 天内合并 PR
73

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

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

microsoft/kiota-python 的其他 Issue

查看 microsoft/kiota-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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