Skip to content

Ask a real Mac the questions the proxy rules rest on - #71

Merged
DarkPoesidon merged 1 commit into
mainfrom
test/verify-macos-proxy-assumptions
Aug 26, 2026
Merged

Ask a real Mac the questions the proxy rules rest on#71
DarkPoesidon merged 1 commit into
mainfrom
test/verify-macos-proxy-assumptions

Conversation

@DarkPoesidon

Copy link
Copy Markdown
Collaborator

Closes the biggest piece of unverified reasoning left over from #66 and #69without needing a Mac.

The problem

Two claims about networksetup hold up this package's rules, and Apple documents neither:

  1. Does the server address survive switching the proxy off? This is what the comment on Satisfies asserts.
  2. Can the bypass list be read back at all? This is why Verify stopped comparing it in Verify only what the machine can be asked to report, and act only when it must #69.

Both were settled by reading behaviour out of our own source, because there is no Mac here to try them on. That reasoning shipped in v1.0.19.

The idea

CI already runs this package's tests on macos-latest. A hosted runner is a real Mac, and it has passwordless sudo. So it can simply be asked.

The test sets a proxy, switches it off, reads it back, and reports which way the machine actually behaves:

this Mac KEEPS the address when the proxy is switched off: ...

or

this Mac CLEARS the address when the proxy is switched off: ...

Checked either way round

Satisfies does not read the address when the target is off, so it is correct whichever answer comes back. What would be wrong is the comment explaining it — and the next person to touch this would be reasoning from a false premise. The test logs what it found so that premise is on the record rather than in someone's head.

The other direction is covered too: a proxy that really is configured has to verify. That path has always worked in the field — users' proxies were being set, which is how the fault behind all of this was reported — so a failure there means the rule drifted away from the machine rather than the machine surprising us. That is exactly the regression #69 fixed, and this is what would have caught it.

Safety

  • It reconfigures the machine's own network settings, so it does not run unless asked for by name (WHITEVPN_SYSPROXY_INTEGRATION=1). Nobody's laptop should have its proxy changed by go test ./....
  • The restore is registered before the first change and runs whatever the test does — pass, fail or panic.
  • It drives networksetup through sudo, not through Apply, which asks for the password with osascript and would hang with nobody there to answer.
  • An ephemeral runner is the only place where being wrong about the restore costs nothing.

What this does not do

It does not exercise the administrator prompt, the banner, or the app end to end — those still need a human at a Mac. It settles the two mechanical facts underneath them, which is the part that was guessed.

🤖 Generated with Claude Code

Two claims about `networksetup` hold up this package's rules, and Apple
documents neither. Whether the server address survives switching the
proxy off is what the comment on Satisfies asserts. Whether the bypass
list can be read back at all is why Verify stopped comparing it. Both
were settled by reading behaviour out of our own source, because there is
no Mac here to try them on.

CI already runs this package's tests on macos-latest, and a hosted runner
is a real Mac that can be asked. So it is asked: set a proxy, switch it
off, read it back, and report which way the machine actually behaves.

The rule is checked either way round. Satisfies does not read the address
when the target is off, so it is correct whichever answer comes back —
but the comment explaining it would be wrong, and the next person to
touch this would be reasoning from a false premise. The test logs what it
found so that premise is on the record rather than in someone's head.

The other direction is covered too: a proxy that really is configured has
to verify. That path has always worked in the field — users' proxies were
being set, which is how the fault behind all of this was reported — so a
failure there means the rule drifted away from the machine rather than
the machine surprising us. That is the regression #69 fixed, and this is
what would have caught it.

It reconfigures the machine's own network settings, so it does not run
unless asked for by name. Nobody's laptop should have its proxy changed
by `go test ./...`, and an ephemeral runner is the only place where being
wrong about the restore costs nothing. The restore is registered before
the first change and runs whatever the test does.

It drives networksetup through sudo rather than through Apply, which asks
for the password with osascript and would hang with nobody there to
answer.
@DarkPoesidon
DarkPoesidon merged commit 53bb6ea into main Aug 26, 2026
6 checks passed
@DarkPoesidon
DarkPoesidon deleted the test/verify-macos-proxy-assumptions branch August 26, 2026 07:32
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