Conversation
- expand in _resolve_cred_file as well: load() checks the path before Settings is built, so the field validator alone runs too late - a relative path stays accepted, unlike state_dir - name the variable when no home directory can be determined - closes #194
Contributor
Release previewMerging this PR would release v2.6.1 (current: Changelog preview (truncated)## v2.6.1 (2026-09-21)
### Bug Fixes
- **config**: Expand a leading ~ in OSW_CRED_FILEPATH
([`eb35ba7`](https://github.com/OpenSemanticLab/osw-python/commit/eb35ba7bdf5be6e9a10f108fcc5f7c10133d6515))
- **mcp**: Encode the osw-mcp startup report as UTF-8
([`979ad81`](https://github.com/OpenSemanticLab/osw-python/commit/979ad81ea20e2c0b85444c8f49d3815c5029ff3a))
Preview via python-semantic-release and conventional commits. |
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.
Follow-ups to #133, now that it has merged.
#194 - a leading
~inOSW_CRED_FILEPATHwas not expandedSettings._validate_cred_filepathexpands~, as_validate_state_diralready does._resolve_cred_fileexpands it too. The issue's suggested fix alone is not enough:load()callsPath(cred_filepath).is_file()on_resolve_cred_file's return value (src/osw/service/config.py) long before it buildsSettings, so the field validator runs too late.~/accounts.pwd.yamlwas reported as missing while the file was there._cred_file_varis determined, because that lookup matches the raw value againstos.getenv.state_dir. The CLI resolvesaccounts.pwd.yamlagainst the working directory on purpose.expanduser()raisesRuntimeErrorwhen no home directory can be found. Both call sites catch it and name the variable, so the message is actionable.load()'sRaisesdocstring lists the new case.tests/test_service_config.py; 4 of them fail on the unfixed source.#193 - the osw-mcp startup report was written with the locale encoding
src/osw/service/streams.pywithforce_utf8(*streams). The CLI had this logic inline in_force_utf8_output; it now lives in the shared core, becauseosw.mcpmay never importosw.cli(tests/test_no_paths_on_mcp_surface.py).main()insrc/osw/mcp/server.pycalls it on stderr only. An MCP client starts the server with stderr on a pipe, so Python picks the locale encoding, cp1252 on a German Windows system. The report carries the credential file path and the env file path.stdio_serverre-wraps the binary buffer as UTF-8 itself and claims file descriptor 1 while doing it.reconfigure()is passederrors=explicitly. It silently resets the handler to strict otherwise, and a strict stderr would raise while reporting a failure.#192 - no test held stdout free of log records during a tool call
tests/test_mcp_server.pynow calls the realstatustool throughmcp.call_tool("status", {})and asserts stdout is empty while the record appears on stderr.statusis used because it logs a warning from insidectx.guard()when the connection check fails (src/osw/service/ops/status.py).enable_loggingdefaults its handler tosys.stderr, and the SDK claims file descriptor 1. A single edit to that default would undo the first, which is what the test holds. It fails whensrc/osw/__init__.pyis changed tosys.stdout.enable_loggingin a context manager, not a fixture, because pytest attaches its log-capture handler after fixtures run. Mirrorsplain_loggingintests/test_logging_setup.py.Verification
make check: lock file, pre-commit,ty,deptryall pass.