fix: KEEP-1051 make docs generation actually run, and regenerate the reference - #76
Merged
Merged
Conversation
go generate ./docs/ silently did nothing. The //go:generate directive sat
in generate.go, which carries //go:build ignore, so the file is excluded
from the build and never scanned for directives. The command exited 0
having generated nothing, which made two things vacuous:
- the docs-check CI job, which compared an unchanged tree against
itself and passed in ~16s regardless of drift
- the release sync to keeperhub, which regenerates then copies, so it
published whatever stale pages happened to be committed
Moving the directive into a compiled file fixes both. Regenerating then
updates 55 pages and adds 15 that had never been written at all,
including kh workflow resume - the only way to enable a workflow from the
CLI, previously absent from the reference entirely.
Also corrects two statements the generator would have kept publishing:
login claimed it opens a browser, which it never does (it prints a URL
and waits), and the device-code expiry error suggested rerunning with
--no-browser, a flag the CLI has never had.
The sync workflow now fails if a tag's committed docs do not match its
own command tree, and if it copies fewer pages than were generated,
rather than opening a PR that looks authoritative.
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.
Summary
go generate ./docs/has been doing nothing. The//go:generatedirective satin
docs/generate.go, which carries//go:build ignore- the constraintexcludes the file from the build, so it is never scanned for directives. The
command exited 0 having generated nothing.
Two guards were vacuous as a result:
docs-checkcompares the tree against itself and passes in ~16s no matterhow far the reference has drifted.
whatever stale pages happened to be committed.
Moving the directive into a compiled file (
docs/doc.go) fixes both.Scale of the drift this was hiding
Regenerating updates 55 pages and adds 15 that had never been written.
The reference goes from 58 to 72 command pages.
Among the missing:
kh workflow resume- the only way to enable a workflowfrom the CLI. Absent from the reference entirely, which is why it reads as a
capability the CLI does not have. The bulk of the 55 updates is the global
--orgflag, missing from every page's inherited-flags list.Two false statements corrected
The generator would have kept publishing both, and one had already reached
docs.keeperhub.com:
kh auth loginclaimed it "opens a browser". It never does -internal/auth/device.goprints a URL and waits.--no-browser, a flagthe CLI has never had.
Sync workflow now fails loudly
Two guards, both chosen because the failure mode is a PR that looks
authoritative:
copying stale pages.
reference where a missing command is indistinguishable from one that does not
exist.
Verification
The change is only meaningful if the guard can now fail, so I tested that
directly rather than trusting the regeneration:
go generate ./docs/->docs/kh_auth_login.mddrifted (4 insertions), so
git diff --exit-code docs/fails. Theidentical experiment before this change produced nothing at all.
docs-checkpasses on acorrect tree.
go build,go vet,golangci-lint run ./...(0 issues), fullgo test -race ./...- no failures.Note for reviewers
The diff is large but almost entirely generated output. The hand-written changes
are five files:
docs/doc.go,docs/generate.go,cmd/auth/login.go,internal/auth/device.go, and the sync workflow. Everything underdocs/kh*.mdis generator output and should be reviewed by regenerating rather than by
reading.
Expect the next release sync to keeperhub to be large for the same reason - it
will carry the 14 command pages that repo has never had.