Repository navigation
[S8a] Extract private Python settings/default helpers - #155
Conversation
Part 1 of #154. Keep the ToolServer facade, dictionary ownership, path normalization, and workspace/document routing unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 85ef72cc-9e26-4bc4-b1c3-55256d9bef91
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the settings-construction helper extraction.
No open issues 🎉
What changed in this PR
Implements S8a of #154 by extracting private settings-construction helpers while keeping ToolServer as the public facade. Workspace routing extraction remains deferred to S8b.
Changes:
- Move default, workspace and fallback settings construction into stateless helpers.
- Preserve shallow aliases, merge precedence and facade-owned updates and routing.
- Add focused regressions for dictionary replacement, live configuration and fallback context, and document the ownership boundary.
| File | Description |
|---|---|
python/vscode_common_python_lsp/server.py |
Delegate settings construction to private helpers. |
python/vscode_common_python_lsp/_settings.py |
Add stateless helpers for fresh, shallow settings dictionaries. |
python/tests/test_server.py |
Cover replacement maps, value aliases, live configuration and contextual precedence. |
CONTRIBUTING.md |
Document responsibilities of the facade and private helpers. |
Review effort: Balanced
|
🔒 Automated review in progress — Bill Schnurr (@bschnurr) is auto-reviewing this PR. |
|
Reviewed commit: Result: 🔴 Verification detailsVerification: Automated verification is best effort. The PR author remains responsible for testing. Summary: [unavailable] Container verification could not start and local execution was not authorized for this PR HEAD: C:\Program Files\RedHat\Podman\podman.EXE --connection pyrx-automation failed: stderr: Error: unable to start container "c2b598e801c17d388f4254c3771a8bc28e810bcb10126c42cde4e2d799c60047": crun: open `memory.max` for writing: No such file or directory: OCI runtime attempted to invoke a command that was not found Test runs: none recorded. |
Bill Schnurr (bschnurr)
left a comment
There was a problem hiding this comment.
Approved via Review Center.
c951eb7
into
main
## Summary Part 2/2 of #154. **Depends on #155**; this upper layer intentionally targets `refactor/s8a-settings`, not `main`. - Move workspace settings registration and path/document selection into private, stateless `_routing` functions behind the unchanged `ToolServer` facade. - Keep the facade's writable dictionaries, in-place updates, direct map replacement/mutation, shallow value aliases, method overrides, and existing `server` module imports/normalization and URI seams. - Preserve nested-project selection, virtual/rootless paths, symlink-normalization flags, terminal-parent handling, first-workspace fallback, and the distinct per-document/CWD fallback construction. No fallback or normalization unification. - Add five focused regression cases in the existing server tests and document the private boundary. Existing fixtures, identity checks, and real stdio tests are unchanged. No execution/CWD resolver, backend, process/lifecycle, wire settings, dependency, TypeScript, or consumer-pin changes. The lower `_settings` extraction remains unchanged. ## Validation Native Windows / Python 3.13.14, worktree-local environments: - Full shared Python tests through existing nox tooling: **358 passed, 2 skipped**. The two Windows symlink-privilege skips are unchanged from S8a's **353 passed, 2 skipped** baseline. - Existing nox lint session: **flake8, Black, and isort pass** for the package and tests. - Built the combined candidate wheel using `setuptools.build_meta`; installed it noneditably in an isolated native virtual environment. - **124 ToolServer facade tests pass against the installed wheel**, using `python -I`, no `PYTHONPATH`, and pytest importlib mode. Verified `_routing.py` in distribution metadata/RECORD, source/wheel/installed bytes, and package origins in installed site-packages before and after the tests; no checkout masking. - AST comparison with exact lower head `0b0130e28c77ba94ae1f255fe05e6c222038a03b`: extracted routing bodies unchanged apart from the receiver name; public method signatures/annotations, existing module imports, and all nonrouting methods unchanged. - `git diff --check` passes. Final validation environments have no editable installations. ### Native consumer compatibility (combined stack) All five consumers passed their complete, unchanged native `nox --session install_bundled_libs tests` pipelines on Windows, with Python 3.13.14 test sessions. Each comparison kept the exact consumer commit below and changed only the isolated worktree's shared-runtime gitlink from baseline `664672c16ce7848f09442ce0e301279a199ceb08` to candidate `77240b0977e15b112599df60a436f896a5e7ef37`. | Consumer | Consumer commit | Python tests: baseline and candidate | Build tests: baseline and candidate | | --- | --- | --- | --- | | Pylint | `d5eab2852f333ac9db363acd4939ea9bb95a1edb` | 122 passed | 20 passed | | Black | `2a12315bb60ecbbe61c224e9a12ed86c043b02a6` | 70 passed, 1 unchanged skip | 20 passed | | Flake8 | `a2c9d11e7cbc6933cfa8ea8db84b97a9ec0bebcc` | 114 passed | 23 passed | | isort | `a120a1203e8c1d9d0af36a8f7de9ae0d67da4de3` | 79 passed | 20 passed | | Mypy | `047b8a10df62ab0f43ae119bece1db3ae3721a1d` | 87 passed, 2 unchanged skips | 21 passed | For every consumer, independently verified its native noneditable bundled distribution, private identity/provenance, and bundled server import origin. The complete installed Python filename set and contents match pinned Git objects (14 baseline modules, 16 candidate modules; universal-newline normalization only), including both new private helpers. No consumer source, tests, fixtures, requirements, or tracked artifacts were changed. Existing Windows file-descriptor cleanup warnings remain nonfatal; no failures or additional skips. Native stack verified: #155 -> #156, ultimate base `main`. No merge or auto-merge was performed. Both PRs' hosted test/lint/build checks pass, including Python 3.10-3.14 on Ubuntu and Windows. This is automated compatibility evidence, not a manual VS Code smoke test. Closes #154. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 85ef72cc-9e26-4bc4-b1c3-55256d9bef91
Summary
ToolServerfacade, writable dictionary identities/aliases, in-place updates, precedence, normalization, routing and lifecycle behavior. Add focused replacement/alias/context regressions without changing existing fixtures.Validation
-I) installed-only imports, metadata and source hashes verified. All 119 ToolServer tests pass against the installed artifact.77240b0([S8b] Extract private workspace and document settings routing #156) for Pylint, Black, Flake8, isort and Mypy, with unchanged test pass/skip totals against shared baseline664672c. Full baseline/candidate results and installed-source proof are recorded in [S8b] Extract private workspace and document settings routing #156.main. No TypeScript or consumer source/test changes here.