Conversation
Integrate elastic/crd-ref-docs into the project workflow to generate API reference Markdown from Go types, wire generation checks into Make/CI, and vendor the required tooling dependencies. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.45`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.45 -->
Member
Author
|
@codex review Please review this PR for readiness. |
Adjust the custom crd-ref-docs markdown template to emit exactly one trailing newline in generated API reference pages, then regenerate the docs so docs-quality markdown lint passes. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.45`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.45 -->
Member
Author
|
@codex review Addressed docs-quality lint issues (trailing newline / blank-line formatting) and pushed a fix. Please re-review. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Add an explicit AGENTS.md pattern note to run `make docs-reference` when changing API structs in the core API type files, and to avoid merging without updated generated docs under `docs/reference/api`. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.45`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.45 -->
Member
Author
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
This PR integrates
elastic/crd-ref-docsto generate API reference markdown pages from Go API types, replacing hand-maintained reference content with deterministic generated output.Background
The API docs under
docs/reference/api/could drift from source types inapi/. This change adds a generated-doc workflow aligned with existing vendored-tool patterns so docs stay current and reviewable.Implementation
tooldirectives for executable tooling, includinggithub.com/elastic/crd-ref-docs.hack/crd-ref-docs/config.yamlhack/crd-ref-docs/templates/markdown/gv_list.tplhack/update-reference-docs.shMakefile:docs-reference,docs-reference-check, anddocs-checkdependency update..github/workflows/ci.yaml: verify generated API docs are up to date in lint job; include docgen paths in change detection.docs/reference/api/codercontrolplane.mddocs/reference/api/coderworkspace.mddocs/reference/api/codertemplate.mdtooldirectives:internal/deps/controllergen_tools.goValidation
make testmake buildmake lintgo run github.com/rhysd/actionlint/cmd/actionlint@v1.7.10go mod tidy && go mod vendor(no unexpected module/vendor drift)Risks
📋 Implementation Plan
Integrate
elastic/crd-ref-docsto generate API reference MarkdownContext / Why
Today our API reference pages under
docs/reference/api/are hand-written and can drift from the actual Go API types inapi/. We want to:make.GOFLAGS=-mod=vendor go run ./vendor/...” workflow.Evidence (what we verified)
In-repo
Makefile:docs-checkonly runsmkdocs build --strict; there is no doc generation target today.mkdocs.yml: Reference nav links point directly at:docs/reference/api/codercontrolplane.mddocs/reference/api/coderworkspace.mddocs/reference/api/codertemplate.mdSpec/Statustables +Sourcesection.api/v1alpha1/*with+groupName=coder.cominapi/v1alpha1/doc.go.api/aggregation/v1alpha1/*with+groupName=aggregation.coder.cominapi/aggregation/v1alpha1/doc.go.+kubebuilder:object:root=true.internal/deps/controllergen_tools.go(build tagtools) pins tool dependencies so they are vendored.hack/update-manifests.shandhack/update-codegen.shrun vendored tools viaGOFLAGS=-mod=vendor go run ./vendor/...and include fail-fast assertions.go.modtargets Go 1.25.7, so we can use Go 1.24+tooldirectives to pin these tools without atools.gofile.Upstream (
crd-ref-docs)github.com/elastic/crd-ref-docsv0.3.0.--renderer=markdown,--templates-dir, and--template-valuekey/value injection.singleandgroup(no built-in “one file per Kind”), and the template entrypoint executed is namedgvList.Implementation plan
1) Track tool dependencies via Go 1.24+
tooldirectives (notools.gofile)Instead of adding (or extending) a build-tagged
tools.gofile with blank imports, we can pin executable tooling directly ingo.modusing thetooldirective (supported because this repo’sgo.modalready targets Go 1.25.x).Files to change
go.mod,go.sum,vendor/internal/deps/controllergen_tools.goonce its tool deps are represented ingo.mod.Edits
toolblock ingo.mod(either manually or viago get -tool ...) that includes:github.com/elastic/crd-ref-docssigs.k8s.io/controller-runtime/tools/setup-envtest(already used inMakefile)sigs.k8s.io/controller-tools/cmd/controller-gen(already used inhack/update-manifests.sh)k8s.io/code-generator/cmd/deepcopy-gen(already used inhack/update-codegen.sh; optional but recommended for consistency)Example desired shape:
Pin versions with minimal churn:
tool (...)block so existing tool versions inrequireremain unchanged.github.com/elastic/crd-ref-docs v0.3.0.require github.com/elastic/crd-ref-docs v0.3.0line yourself.go get -tool github.com/elastic/crd-ref-docs@v0.3.0(Go will add/update thetooldirective +require).Then run the standard vendoring workflow:
go mod tidygo mod vendorgit diff --exit-code -- go.mod go.sum vendor/Verify vendoring picked up the tool packages we execute from
./vendor/...today:vendor/github.com/elastic/crd-ref-docs/vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/vendor/sigs.k8s.io/controller-runtime/tools/setup-envtest/vendor/k8s.io/code-generator/cmd/deepcopy-gen/Delete
internal/deps/controllergen_tools.goonce thetoolblock is in place (so we no longer rely on a tools file).Why this approach
tools.goboilerplate and build tags just to pin tools.go.mod.-mod=vendor+ vendored tool sources).2) Add
crd-ref-docsconfig + custom Markdown templates (match our current per-Kind pages)Because
crd-ref-docscan’t emit “one file per Kind” directly, we’ll:gvListtemplate that renders exactly one Kind selected via--template-value=kind=....New files to add
hack/crd-ref-docs/config.yamlhack/crd-ref-docs/templates/markdown/*.tpl2.1 Config (
hack/crd-ref-docs/config.yaml)Keep it minimal and conservative; avoid ignoring
Spec/Statusstructs (we need them to render tables).Suggested starting config:
2.2 Templates
Create a small set of templates in
hack/crd-ref-docs/templates/markdown/with a requiredgvListdefinition.Key goals of the template:
docs/reference/api/*.md.spec.*andstatus.*fields.Skeleton (single file is fine; split into multiple
*.tplfiles if preferred):Notes:
spec/statusmembers (matching our current docs). If we later introduce nested structs we can extend the template to recurse or switch to the richer default templates.Resourceaslower(kind) + "s"and default scope tonamespaced(matches current reality). If we add cluster-scoped APIs, we can either (a) add+kubebuilder:resource:scope=Clustermarkers and parse them in-template, or (b) passscope=as a template value from the script.3) Add a generator script (
hack/update-reference-docs.sh)New file
hack/update-reference-docs.shBehavior
hack/update-*.shscripts:set -euo pipefailGOFLAGS=-mod=vendor go run ./vendor/...Core logic (shape)
4) Wire it into
makeFiles to change
MakefileTargets to add
docs-reference: generate the API reference docs.docs-reference-check: verify docs are up-to-date (no diff after generation).Suggested Makefile shape:
If we want to avoid pulling Go + vendor into a docs-only workflow, keep
docs-checkas-is and document that contributors should runmake docs-referencewhen updating API types.5) Make the generated nature explicit + regenerate docs
Files to change (generated output)
docs/reference/api/codercontrolplane.mddocs/reference/api/coderworkspace.mddocs/reference/api/codertemplate.mdSteps
bash ./hack/update-reference-docs.shand commit the updated Markdown.6) (Recommended) CI enforcement so drift can’t land
Goal: If Go API types change, CI should fail unless
docs/reference/api/*.mdis regenerated.Files to change
.github/workflows/ci.yamlApproach
lintjob (after vendoring check), add:paths-filter“go” filter to also include the docgen inputs/outputs so CI runs when those change:hack/update-reference-docs.shhack/crd-ref-docs/**docs/reference/api/**This keeps enforcement lightweight (no
mkdocs/ Python needed).Validation / acceptance criteria
bash ./hack/update-reference-docs.shruns successfully and produces deterministic output (second run yields no diff).make verify-vendorpasses after addingcrd-ref-docsand updatingvendor/.make testandmake buildstill pass.docs/reference/api/*.md, and passes when regenerated.Alternatives considered (kept brief)
Use
crd-ref-docsoutput-mode=group and publish one file per API group (coder.com.md,aggregation.coder.com.md).Use default
crd-ref-docsmarkdown templates.Generated with
mux• Model:openai:gpt-5.3-codex• Thinking:xhigh• Cost:$0.45