Guard the layout, and stop probing before every command - #20
Merged
Conversation
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.
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.
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.