Repository navigation
fix: apply empty notebook metadata updates - #641
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #640.
An explicit empty metadata object in
notebookDocument/didChangecurrently leaves stale notebook metadata in the workspace. Starting with{"custom": "metadata"}, a change containing{"metadata": {}}advances the version but retains the old values.Check
metadata is not Noneso a supplied empty object clears the metadata. Omitted metadata preserves existing values, and nonempty objects continue to replace them. The parameterized regression covers all three cases and checks version advancement. Against the unchanged base method, only the empty-object case fails (1 failed, 2 passed); all three pass with the fix.This is separate from merged #639, which concerns empty text-document offsets. This PR changes only the notebook metadata condition and its workspace regression tests.
Validation
On macOS arm64, Python 3.13.12, with lsprotocol 2025.0.0:
PYTHONDONTWRITEBYTECODE=1 .venv/bin/python -m pytest -q -p no:cacheprovider: 288 passed, 7 skipped. OnePytestUnhandledThreadExceptionWarningoccurs intest_ws_serverwhen its shutdown callback raisesSystemExit: 0; the run exits successfully.git diff --check: passed. Black skips notebook formatting because its Jupyter dependencies are absent.uv lock --check --offline: fails on the unchanged baseline. At base2e3c2411ea15636862ca172cd1a337b3da968f4e,pyproject.tomldeclares 2.1.1 while the editable pygls entry inuv.lockdeclares 2.1.0. Neither file is changed in this PR. This check is not reported as passing.The separate full TCP/WebSocket end-to-end matrices, Pyodide, Windows, other Python versions, and real editors were not run locally.
AI assistance: OpenAI Codex was used to investigate the defect, generate the fix and regression tests, run validation, review the patch, and prepare this submission.
Code review checklist (for code reviewer to complete)