Skip to content

Guard the layout, and stop probing before every command - #20

Merged
siliconwitch merged 3 commits into
mainfrom
dev
Aug 20, 2026
Merged

Guard the layout, and stop probing before every command#20
siliconwitch merged 3 commits into
mainfrom
dev

Conversation

@siliconwitch

Copy link
Copy Markdown
Member

Go refuses an import cycle, not one part importing another, so the rule the
layout exists for rested on discipline alone: fleet importing device builds,
vets and tests clean. A test now walks internal and fails on any import the
graph in cli.md does not allow. Nothing bound a test to the command table
either, so deleting a wired command, or leaving one without its Run, passed the
whole suite. One test pins the set that carries a Run, and another renders the
real table rather than the synthetic one dispatch tests against. Each guard was
checked against the violation it exists to catch, with the import made real
enough to compile.

api.CheckServer sent GET / before all twenty implemented commands, threw the
response away, and returned the same sentence every request site already
returns on a failed Do. It bought a round trip for a message the real request
produces a moment later, and it could not tell reachable from too old because
it read neither the status nor X-Min-Version. It also put a network call in the
router, so every dispatch test had to stand up a listener for cases like -h and
--version that never touch the network; that test now imports no network
package at all.

account delete keeps a check of its own, written where it runs rather than
behind a shared function with one caller. It is the only command that puts a
question before it acts, so it is the only one the probe did any good for.
Being authenticated, it also tells someone who is not logged in before the
question rather than after it.

Measured against a stub: fleet list made GET / then GET /fleets and now makes
only GET /fleets, key list makes its two real requests, and account delete is
alone in making GET / first.

No version change, and nothing under .github, flake.nix, .goreleaser.yaml or
go.mod is touched.

Go refuses an import cycle, not one part importing another, so the rule the
layout exists for rested on discipline alone: fleet importing device builds,
vets and tests clean. A test now walks internal and fails on any import the
documented graph does not allow.

Nothing bound a test to the table either, so deleting a wired command, or
leaving one without its Run, passed the whole suite. One test pins the set that
carries a Run, and another renders the real table rather than the synthetic one
dispatch tests against.

Each guard was checked against the violation it exists to catch, with the
import made real enough to compile.
api.CheckServer sent GET / before all twenty implemented commands, threw the
response away, and returned the same sentence every request site already
returns on a failed Do. It bought a round trip for a message the real request
produces a moment later, and it could not tell reachable from too old because
it read neither the status nor X-Min-Version.

Measured against a stub: fleet list made GET / then GET /fleets, and now makes
only GET /fleets.

It also put a network call in the router, so every dispatch test had to stand
up a listener for cases like -h and --version that never touch the network.
The test now imports no network package at all.
account delete is the only command that puts a question before it acts, so it
was the only one the removed probe was doing any good for: without it the user
confirms deleting everything and then learns the server is unreachable.

The check is written where it runs rather than behind a shared function with
one caller. It is authenticated, unlike the old probe, which also means someone
not logged in is told so before the question rather than after it.

Measured against a stub: fleet list makes one request, key list makes its two
real ones, and account delete is alone in making GET / first.
@siliconwitch
siliconwitch merged commit 168e9c0 into main Aug 20, 2026
1 check passed
@siliconwitch
siliconwitch deleted the dev branch August 20, 2026 15:46
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