Repository navigation
Keep the end-to-end harness that caught the Docker bug - #57
Merged
Merged
Conversation
swift test builds its own fixtures, which is why it missed portnanny kill being unable to stop a Docker container: those tests construct a ManagedRuntime directly and never run the scan that feeds one. These scripts drive the built binary against real listeners instead. Manual, not in CI, since they need real processes and one needs Docker. guard.sh covers the friendly-fire guard end to end and passes 23 checks: attribution from the environment a server was started with, another agent refused while the server survives, dry runs deciding without signalling, the owning session allowed, force overriding, a second session of the same agent refused, the list filters, a genuinely unclaimed server, the preference that governs that rule changing CLI behaviour across processes, and a caller with no agent above it being allowed. mcp.py speaks JSON-RPC to portnanny mcp the way an agent does and passes 23: the handshake, all eight tools, kill_port defaulting to a dry run and refusing another agent's server, leases made over MCP showing up in the CLI, and malformed input erroring without taking the server down. detach.py is what makes two of those cases testable at all. Anything started from a shell inside an agent session inherits that session's process tree, so it is never truly unowned and the caller is never truly a person; this double-forks and calls setsid so the child reparents to launchd with no agent above it. The README records the two safety rules these follow, both learned by breaking them: only ever signal a pid recorded at spawn time, never a pattern, and never start a test server on a port that is not already free. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
swift testbuilds its own fixtures, which is why it missedportnanny killbeing unable to stop a Docker container (#56): those tests construct aManagedRuntimedirectly and never run the scan that feeds one. These scripts drive the built binary against real listeners instead.Manual, not in CI, since they need real processes on a real machine and one of them needs Docker.
guard.sh, 23 checks: attribution from the environment a server was started with, another agent refused while the server survives, dry runs deciding without signalling, the owning session allowed,--forceoverriding, a second session of the same agent refused, the--mineand--agentfilters, a genuinely unclaimed server, the preference governing that rule changing CLI behaviour across process boundaries, and a caller with no agent above it being allowed.mcp.py, 23 checks: the handshake, all eight tools advertised,kill_portdefaulting to a dry run and refusing another agent's server, leases made over MCP showing up in the CLI, and malformed input erroring without taking the server down.detach.pyis what makes two of those testable at all. Anything started from a shell inside an agent session inherits that session's process tree, so it is never truly unowned and the caller is never truly a person. This double-forks and callssetsidso the child reparents to launchd.The README records the two safety rules these follow, both learned by breaking them: only ever signal a pid recorded at spawn time, never a pattern, and never start a test server on a port that is not already free.
Both suites pass fully. Unit suite unchanged at 324. No release.
🤖 Generated with Claude Code