fix(config): reject non-list groups instead of coercing - #68
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.
Bug
groups = "web"inservers.toml(a string, not a list) loaded as('w', 'e', 'b').ServerRegistry._loadcalledtuple()on the raw value before Pydantic saw it, so:web;execute_on_groupskipped it.Other non-list values were also coerced:
groups = 5escaped as a rawTypeError;groups = { web = 1 }loaded as('web',).Reproduced on
mainbefore the fix.Fix (minimal)
config.py: delete the pre-conversion. Pydantic already turns a TOML list intotuple[str, ...].models.py: add amode="before"validator onServerConfig.groupsthat rejects any non-list. Pydantic's own message is "Input should be a valid tuple", which a TOML author can't act on, so the refusal now reads'groups': Value error, must be a list of group names, e.g. groups = ["web"]. Validation stays in the model, as AGENTS.md requires.tests/test_config.py: one regression test, parametrised over"web",5and{ web = 1 }. All three cases fail onmain: two do not raise, one raises aTypeError.CHANGELOG.md: a Fixed entry, plus a note that the next release is 0.9.0: two configs that used to start now refuse to start, which the rule recorded under 0.8.1 treats as a minor bump.A separate commit fixes doc drift found while validating #66, checked against the installed mcp 2.2.0:
AGENTS.md: the_build_http_appsignature quoted there still had ahostparameter that no longer exists;server.py: two comments and one error string still said mcp 2.1.1 orself.session_manager.Verification
HYPOTHESIS_PROFILE=cipytest: 853 passed. ruff format and check, mypy, bandit, pip-audit and gitleaks are all clean.ServerRegistryandssh-mcp healthcheck:["web"]loads as('web',)and is a member ofweb;[]loads as();"web",5and{ web = 1 }each give aConfigErrorthat names the fix;[1]still reports'groups.0'.code-review) raised 2 should-fix and 4 nits. sol 6.1 (codex review --uncommitted) raised 1 nit.**server_data(the reviewers disagreed) and aname-key issue that predates this change.