tenseleyflow/dlm-lsp / 2aef89a

Browse files

Log dlm-lsp ↔ document-language-model version pair on startup

Audit 12 F12.2: a major-version drift between the LSP server and the dlm package can break imports or schema validation. Log both at startup so mismatches surface in the editor's LSP log channel without a separate health check. README compatibility table documents the supported pair.
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
2aef89a992e6e75ad7a5a7829e300db2d2a8da9a
Parents
0a6ab50
Tree
f807683

2 changed files

StatusFile+-
M README.md 14 0
M src/dlm_lsp/server.py 26 0
README.mdmodified
@@ -15,6 +15,20 @@ Language Server Protocol backend for `.dlm` files.
1515
 pip install dlm-lsp
1616
 ```
1717
 
18
+This pulls `document-language-model` from PyPI as a runtime dependency.
19
+
20
+## Compatibility
21
+
22
+| `dlm-lsp` | `document-language-model` |
23
+| :-- | :-- |
24
+| `0.1.x` | `0.10.x` |
25
+
26
+The LSP imports from `dlm.doc.parser`, `dlm.doc.schema`, `dlm.base_models`,
27
+and `dlm.store.manifest`. A major-version drift on either side can break
28
+imports or schema validation. The LSP logs both versions at startup
29
+(visible in your editor's LSP log channel) so mismatches surface
30
+immediately. Pin a matching pair if you mix custom forks.
31
+
1832
 ## Usage
1933
 
2034
 The `dlm-lsp` binary launches a Language Server over stdio:
src/dlm_lsp/server.pymodified
@@ -249,4 +249,30 @@ def _publish_diagnostics(ls: DlmLanguageServer, uri: str) -> None:
249249
 
250250
 def main() -> None:
251251
     logging.basicConfig(level=logging.INFO, format="%(name)s: %(message)s")
252
+    _log_runtime_versions()
252253
     server.start_io()
254
+
255
+
256
+def _log_runtime_versions() -> None:
257
+    """Surface the dlm-lsp + document-language-model version pair on startup.
258
+
259
+    Drift between the LSP server and its dlm dependency can silently break
260
+    imports or schema validation. Logging both at startup makes mismatches
261
+    diagnosable from the LSP log without a separate health check.
262
+    """
263
+    log = logging.getLogger("dlm_lsp")
264
+    try:
265
+        from importlib.metadata import version as _pkg_version
266
+
267
+        lsp_version = _pkg_version("dlm-lsp")
268
+    except Exception:  # noqa: BLE001 — diagnostics shouldn't fail startup
269
+        lsp_version = "unknown"
270
+
271
+    try:
272
+        import dlm
273
+
274
+        dlm_version = getattr(dlm, "__version__", "unknown")
275
+    except Exception:  # noqa: BLE001
276
+        dlm_version = "unimportable"
277
+
278
+    log.info("dlm-lsp %s ↔ document-language-model %s", lsp_version, dlm_version)