Repository navigation
fix: regenerate API docs for the chat todo routes - #55
Conversation
Regenerates coderd/apidoc for the fork chat todo routes and schemas, and adds a fork-ci step that fails when coderd/apidoc drifts from the API annotations. The step ignores enum order, which swag emits in map order for an enum declared across files.
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1594e64e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
… check Sorting enum, x-enum-varnames and x-enum-descriptions independently let a stale value-to-name mapping pass. Sort them as tuples keyed by the value.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b457a8b5cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
Sorting every enum let an intentional reorder of an ordinary enum pass. Only codersdk.Experiment spans files, so only its order is random.
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ 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". |
…es-regen # Conflicts: # coderd/apidoc/docs.go # coderd/apidoc/swagger.json
Merged at 9613ed7, paired as a CI and generated-docs change with #52 in the same deploy slot, after these checks:
Closes #54. |
Closes #54
coderd/apidocon main has no entry for the chat todo routes from #36 or for theChatTodoschemas. This PR regenerates it and adds a fork-ci check so this kind of drift fails CI.Changes
make -B coderd/apidoc/.genand committed the output:coderd/apidoc/docs.go,swagger.json, and the twodocs/reference/apipages that changed.schemas.mdgains theChatTodotypes. Ingeneral.md, the experiments example now showsfork-chat-todosinstead ofexample..github/fork/check-apidoc.shand a step that runs it in thechat-testsjob, right after the Swagger annotation tests. The script runsswaginitwithSWAG_OUTPUT_DIRset to a temp dir, whichswaginitsupports. It then compares the output with the committeddocs.go(the embedded spec and the Go code after it) andswagger.json.Why the check does not diff docs.go directly
swag does not produce the same output on every run. It collects constants by ranging over a map of a package's files (
ParseTypesin swag v1.16.6packages.go).codersdk.Experimentis declared in two files,deployment.goand the fork'sfork_experiments.go, so the fork experiments land at either the start or the end of the enum arrays. In 6 runs ofswaginiton the same tree, I got two differentdocs.gohashes, about half each. A plaindiffwould therefore fail about half the time. The script parses both specs withjq -Sand sorts the values ofcodersdk.Experimentbefore it compares them. Each value'sx-enum-varnamesandx-enum-descriptionsentries move with it, so a stale value-to-name mapping still fails. Every other enum keeps its order, so an intentional reorder still fails.codersdk.Experimentis the only enum that carries the fork values, and the 6 runs above produced exactly two outputs, which fits one cross-file enum. The parse writes to files and runs underset -e, so a parse failure fails the step and cannot pass as an empty diff.The same randomness means a local
make gencan reorder those enum arrays and thegeneral.mdexample. The check ignores that.Validation
ChatTodoschemas.swagger.json(exit 5); swapping twocodersdk.Experimentvarnames; swapping the first twocodersdk.ChatTodoStatusvalues together with their names. The first Codex fix caught the varname swap, and the second caught the reorder.docs/reference/apiare not checked. Their enum order is random as well, and rendering them needs the Node toolchain. See the review thread.shellcheck .github/fork/check-apidoc.shis clean.Check output on main before the regen (exit 1)
Check output after the regen (exit 0)