Skip to content

fix: apply empty notebook metadata updates - #641

Merged
tombh merged 1 commit into
openlawlibrary:mainfrom
AryanRG:fix/empty-notebook-metadata
Oct 17, 2026
Merged

tombh merged 1 commit into
openlawlibrary:mainfrom
AryanRG:fix/empty-notebook-metadata

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #640.

An explicit empty metadata object in notebookDocument/didChange currently 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 None so 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. One PytestUnhandledThreadExceptionWarning occurs in test_ws_server when its shutdown callback raises SystemExit: 0; the run exits successfully.
  • Ruff, Black, mypy, generated-code consistency, commitlint, and git diff --check: passed. Black skips notebook formatting because its Jupyter dependencies are absent.
  • uv lock --check --offline: fails on the unchanged baseline. At base 2e3c2411ea15636862ca172cd1a337b3da968f4e, pyproject.toml declares 2.1.1 while the editable pygls entry in uv.lock declares 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)

  • Pull request represents a single change
  • Title summarizes what is changing
  • Commit messages are meaningful
  • Tests have been included and/or updated, as appropriate
  • Docstrings have been included and/or updated, as appropriate
  • Standalone docs have been updated accordingly

@tombh tombh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you

@tombh
tombh merged commit 343a760 into openlawlibrary:main Oct 17, 2026
22 checks passed
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.

Explicit empty notebook metadata updates retain stale values

2 participants