Skip to content

Keep the end-to-end harness that caught the Docker bug - #57

Merged
mukes555 merged 1 commit into
mainfrom
test/e2e-harness
Sep 8, 2026
Merged

mukes555 merged 1 commit into
mainfrom
test/e2e-harness

Conversation

@mukes555

@mukes555 mukes555 commented Sep 8, 2026

Copy link
Copy Markdown
Owner

swift test builds its own fixtures, which is why it missed portnanny kill being unable to stop a Docker container (#56): 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 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, --force overriding, a second session of the same agent refused, the --mine and --agent filters, 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_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 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.

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

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>
@mukes555
mukes555 merged commit 921b396 into main Sep 8, 2026
2 checks passed
@mukes555
mukes555 deleted the test/e2e-harness branch September 8, 2026 07:14
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