feat: phpmd-warm adapter + portable relative bins + daemon teardown fix#266
Merged
Merged
Conversation
Three related changes for warm-process MCP validators: 1. New validators/phpmd-mcp/ adapter — talks to the dpt/mcp-phpmd-warm daemon, maps PHPMD JSON violations to SCHEMA.md warnings (non-blocking). 2. Portable relative MCP_*_BIN — rector/phpstan/phpunit/phpmd adapters now resolve a relative bin path (e.g. Dvsi/dvsi-private/libs/bin/mcp-X-warm) against cwd before falling back to $PATH. Lets a committed/shared .supertool.json drop the hardcoded /Users/<dev>/ home paths so the warm validators work on every machine, not just the author's. 3. daemon.py teardown poll 0.5s -> 0.05s — the bridge served one client at a time and only noticed a disconnect after a blocking select(out_fd, 0.5). Each new connection waited out the previous one's teardown, so rapid sequential calls to a cheap tool (phpmd ~50ms) were dominated by ~0.5s of dead time. Affects all four warm servers; masked before only because rector/phpstan have large per-call cost. Co-Authored-By: Max <noreply>
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.
What
Wires up the PHPMD warm-process validator (4th sibling to rector/phpstan/phpunit) and fixes two issues that affect all four warm servers.
1. New
validators/phpmd-mcp/adapterConnects to the
dpt/mcp-phpmd-warmdaemon over UDS, maps PHPMD's JSON report to SCHEMA.mdwarningentries withsource_context. Non-blocking by design (smells surface at edit time, edit is never reverted). Closes the gap where PHPMD only ran at pre-push.2. Portable relative
MCP_*_BINThe rector/phpstan/phpunit/phpmd adapters now resolve a relative bin path (e.g.
Dvsi/dvsi-private/libs/bin/mcp-X-warm) against cwd before falling back to$PATH. Previously a relative path went straight towhich(), which rejects path-like strings — so configs had to hardcode/Users/<dev>/…absolute paths. Since.supertool.jsonis committed/shared, that meant the warm validators only worked on the author's machine. Relative bins fix it for the whole team.3.
daemon.pyteardown poll0.5s → 0.05sThe bridge serves one client at a time and only notices a client disconnect at the top of
proc_to_client's loop, after a blockingselect(out_fd, …, 0.5). So each new connection waited out the previous connection's ≤0.5s teardown. For a cheap tool (phpmd ~50ms), back-to-back calls were dominated by ~0.5s of dead time (looked like "warm is 4× slower than cold"). Spaced calls were unaffected. Dropping the poll to 50ms brings back-to-back down to ~45ms steady. Benefits all four warm servers.Testing
py_compileclean.supertool paste: smells surface with line numbers, edit kept (non-blocking), ~50ms warm.dpt/mcp-phpmd-warmv0.1.0 published (github.com/Digital-Process-Tools/mcp-phpmd-warm).