Skip to content

[fix] Omit missing fields in kv_batch_get instead of raising - #209

Merged
0oshowero0 merged 1 commit into
Ascend:mainfrom
OutstanderWang:fix/kv-batch-get-omit-missing-fields
Nov 5, 2026
Merged

0oshowero0 merged 1 commit into
Ascend:mainfrom
OutstanderWang:fix/kv-batch-get-omit-missing-fields

Conversation

@OutstanderWang

@OutstanderWang OutstanderWang commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem

#190 changed what kv_batch_get does when a requested key exists but a field in select_fields does not. Before, the field was silently left out of the returned TensorDict. Now the call raises ValueError. This also affects kv_batch_get_by_meta, which goes through the same path. Callers that select a field only some keys may have produced, or one still being built with kv_update(finalize=False), started failing.

Summary

Unchanged

Compatibility

  • kv_batch_get / kv_batch_get_by_meta with a select_fields entry that isn't ready in every key return a result without that field instead of raising ValueError. Callers that need to tell missing fields from unfinalized ones can use kv_describe.

Tests

  • tests/e2e/test_kv_interface_e2e.py::test_unfinalized_updates_stay_hidden_until_finalize now asserts that an unfinalized field is omitted, alone or alongside a ready field, and through kv_batch_get_by_meta. It also covers a field that was never written.
  • python -m pytest -q: 912 passed, 12 skipped. The 8 errors are all in tests/test_yuanrong_storage_client_e2e.py, from the environment-specific TORCH_LIBRARY registration error noted in [feat] Support multi-step kv_update with partial values hidden #190.
  • pre-commit run on the changed files passes.

Ascend#190 made `kv_batch_get` and `kv_batch_get_by_meta` raise `ValueError` when a
`select_fields` entry is not ready in every requested key. Before, a field the
existing keys do not hold was silently left out of the returned TensorDict.
Restore that behavior: drop the check, so missing and unfinalized fields are
omitted again. Missing keys still raise, and so does a `kv_batch_get_by_meta`
`select_fields` entry absent from the given meta.

Signed-off-by: OutstanderWang <wangweiyanster@gmail.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T09:45:12.789895Z d4a9f49 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4a9f49aa5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

partition_id: Partition containing the keys
select_fields: Optional field(s) to retrieve. If None, retrieves all fields
select_fields: Optional field(s) to retrieve. If None, retrieves all fields. Fields
not ready in every key (missing, or not finalized) are omitted from the result.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle batches with no common ready field

When the requested keys have no common ready field—for example, two existing keys with disjoint field sets, or a new key whose only kv_update(..., finalize=False) field is hidden—kv_retrieve_meta returns a nonempty BatchMeta with no fields and is_ready == False. The deleted not_ready check is therefore not the only error path: the unchanged readiness check at lines 1189-1190 still raises ValueError, rather than omitting the unavailable selection as promised here. The new test masks this because its unrelated prompt field keeps the retrieved metadata ready, so behavior now depends on whether some unselected common field happens to exist.

Useful? React with 👍 / 👎.

@0oshowero0
0oshowero0 merged commit 908ba80 into Ascend:main Nov 5, 2026
8 checks passed
0oshowero0 added a commit that referenced this pull request Nov 6, 2026
Prepare TransferQueue 0.1.12 for release. This replaces #205.

- Bump the package version from `0.1.12.dev0` to `0.1.12`.
- Update the README and tutorials to cover shared fields, storage-side
data parsing, data dumps, and KV locks.
- Update the notebook examples for partial writes and reads. A batch
read returns requested fields that are ready in every requested key, as
documented in #209.

Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants