Skip to content

fix: update_dataset_metadata handles partial update dicts without KeyError#76

Merged
BeckettFrey merged 2 commits intoreleasefrom
copilot/fix-keyerror-update-dataset-metadata
Apr 8, 2026
Merged

fix: update_dataset_metadata handles partial update dicts without KeyError#76
BeckettFrey merged 2 commits intoreleasefrom
copilot/fix-keyerror-update-dataset-metadata

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

update_dataset_metadata used direct key access on the updates dict, requiring callers to supply all four fields (description, cached, anonymize, transcribed) even when only updating one. A partial dict like {"description": "new desc"} would raise KeyError: 'cached', caught and surfaced as "Invalid metadata key: 'cached'" — misleading since cached is valid, just absent.

Changes

  • src/voxkit/storage/datasets.py — replace four separate updates["field"] guards with a single loop using field in updates membership check:

    # Before
    if updates["description"] is not None:
        metadata["description"] = updates["description"]
    # ... repeated for each field
    
    # After
    for field in ("description", "cached", "anonymize", "transcribed"):
        if field in updates and updates[field] is not None:
            metadata[field] = updates[field]

    Also drops the stale KeyError from the Raises docstring.

  • tests/storage/test_datasets.py — adds test_update_dataset_metadata_missing_keys passing a genuinely partial dict (keys entirely absent, not just None) and asserting only the provided field changes.

Testing

  • Test testable logic
  • Edge cases addressed

Testing Notes: Existing tests already covered None-value passthrough; new test covers the actual bug path (absent keys). Logic validated in isolation against both old and new behavior.

Documentation

  • README updated (if applicable)
  • Code comments added/updated
  • User-facing documentation updated (if applicable)

Documentation Notes: Removed misleading KeyError from Raises docstring.

Checklist

  • Code follows project conventions
  • No breaking changes (or documented if intentional)
  • All CI checks pass

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix KeyError in update_dataset_metadata for partial updates fix: update_dataset_metadata handles partial update dicts without KeyError Apr 8, 2026
Copilot AI requested a review from BeckettFrey April 8, 2026 20:20
@BeckettFrey BeckettFrey marked this pull request as ready for review April 8, 2026 21:42
@BeckettFrey
Copy link
Copy Markdown
Member

LGTM

@BeckettFrey BeckettFrey merged commit 17a7c52 into release Apr 8, 2026
BeckettFrey added a commit that referenced this pull request Apr 9, 2026
)

* fix: render View button in alignment action cells (#74)

* Initial plan

* fix: add layout.addWidget(view_btn) in _create_alignment_action_buttons

Agent-Logs-Url: https://github.com/BrainBehaviorAnalyticsLab/voxkit-desktop/sessions/fd065a62-0e2c-4934-aae9-9420824c8957

Co-authored-by: BeckettFrey <83560790+BeckettFrey@users.noreply.github.com>

* fix: correct alignment dict key references in _view_alignment

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: BeckettFrey <83560790+BeckettFrey@users.noreply.github.com>

* fix: update_dataset_metadata handles partial update dicts without KeyError (#76)

* Initial plan

* fix: update_dataset_metadata handles partial update dicts without KeyError

Agent-Logs-Url: https://github.com/BrainBehaviorAnalyticsLab/voxkit-desktop/sessions/26ca3ecd-bd76-4725-a6cc-05070880986d

Co-authored-by: BeckettFrey <83560790+BeckettFrey@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: BeckettFrey <83560790+BeckettFrey@users.noreply.github.com>

* Fix empty-state never shown on Datasets page (#77)

* Initial plan

* Fix empty-state bug in refresh_datasets: check metadata_list not the datasets module

Agent-Logs-Url: https://github.com/BrainBehaviorAnalyticsLab/voxkit-desktop/sessions/9a9edc69-7179-41de-9459-9a6f265a0cf3

Co-authored-by: BeckettFrey <83560790+BeckettFrey@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: BeckettFrey <83560790+BeckettFrey@users.noreply.github.com>

* fix: reload_models iterates all engines instead of hardcoding W2TGENGINE (#75)

* Initial plan

* fix: reload_models iterates all engines instead of hardcoding W2TGENGINE

Agent-Logs-Url: https://github.com/BrainBehaviorAnalyticsLab/voxkit-desktop/sessions/003f14fe-b32d-4938-9a69-f6efc8a5087d

Co-authored-by: BeckettFrey <83560790+BeckettFrey@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: BeckettFrey <83560790+BeckettFrey@users.noreply.github.com>

* Batch ci fixes (#83)

* lint: auto fixes applied

* format: auto fixes applied

* ci: all passing

* typecheck: passing and issues resolved (no checking untyped defs for now)

* ci: small fix for tests passing

* fix: attach ci actions to makefile commands

* ci: cut up testing into os dedicated workflows for visibility

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
@BeckettFrey BeckettFrey deleted the copilot/fix-keyerror-update-dataset-metadata branch April 13, 2026 19:40
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.

update_dataset_metadata raises KeyError on partial updates

2 participants