Skip to content

fix(config): reject non-list groups instead of coercing - #68

Merged
blackaxgit merged 2 commits into
mainfrom
fix/server-groups-string
Sep 30, 2026
Merged

blackaxgit merged 2 commits into
mainfrom
fix/server-groups-string

Conversation

@blackaxgit

Copy link
Copy Markdown
Owner

Bug

groups = "web" in servers.toml (a string, not a list) loaded as ('w', 'e', 'b'). ServerRegistry._load called tuple() on the raw value before Pydantic saw it, so:

  • the config started with three "undefined group" warnings;
  • the server silently dropped out of group web;
  • execute_on_group skipped it.

Other non-list values were also coerced:

  • groups = 5 escaped as a raw TypeError;
  • groups = { web = 1 } loaded as ('web',).

Reproduced on main before the fix.

Fix (minimal)

  • config.py: delete the pre-conversion. Pydantic already turns a TOML list into tuple[str, ...].
  • models.py: add a mode="before" validator on ServerConfig.groups that 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", 5 and { web = 1 }. All three cases fail on main: two do not raise, one raises a TypeError.
  • 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_app signature quoted there still had a host parameter that no longer exists;
  • server.py: two comments and one error string still said mcp 2.1.1 or self.session_manager.

Verification

  • HYPOTHESIS_PROFILE=ci pytest: 853 passed. ruff format and check, mypy, bandit, pip-audit and gitleaks are all clean.
  • Smoke through ServerRegistry and ssh-mcp healthcheck:
    • ["web"] loads as ('web',) and is a member of web;
    • [] loads as ();
    • "web", 5 and { web = 1 } each give a ConfigError that names the fix;
    • [1] still reports 'groups.0'.
  • Review skill, two rounds:
    • Round 1: fable 5.1 (Claude Code code-review) raised 2 should-fix and 4 nits. sol 6.1 (codex review --uncommitted) raised 1 nit.
    • Round 2: fable raised 1 should-fix (the message) and 3 nits. sol had no findings.
    • Everything was applied except two suggestions: **server_data (the reviewers disagreed) and a name-key issue that predates this change.
  • Three-seat panel (fable 5.1, sol 6.1, grok 4.7): no blocking findings. A final sol check tightened one CHANGELOG sentence.

@blackaxgit
blackaxgit merged commit fa68cdc into main Sep 30, 2026
7 checks passed
@blackaxgit
blackaxgit deleted the fix/server-groups-string branch September 30, 2026 16:51
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.

1 participant