refactor: extract docgen env prep into a shared package - #26827
Conversation
clidocgen and configdocgen both carried a byte-identical prepareEnv that unsets CODER_* and pins CLIDOCGEN_*/TMPDIR so generated docs do not depend on the host. Move it to scripts/docgenenv.Prepare and migrate clidocgen; configdocgen adopts it separately (#26824). Generated CLI reference output is unchanged.
|
/coder-agents-review |
|
Chat: Review posted | View chat Review historydeep-review v0.9.0 | Round 3 | Last posted: Round 3, 5 findings (1 P4, 3 Nit, 1 Note), APPROVE. Review Finding inventoryFindings
Contested and acknowledgedCRF-3 (Note, docgenenv.go:24) - CLIDOCGEN_ prefix in shared package
Round logRound 1Panel (13 reviewers + Netero). 0 P2, 0 P3, 1 P4, 2 Nit, 1 Note. Gon P2s downgraded to Nit (accurate comments, stylistic preference, not defects). Reviewed against 14a6104..9864d22. Round 2Churn guard: PROCEED. 3 fixed (b8cfb7d), 1 acknowledged (CRF-3). Panel (13 reviewers + Netero). All R1 fixes verified by 7 reviewers. 1 new Nit (CRF-5, Gon P2 downgraded). Reviewed against 14a6104..b8cfb7d. Round 3Churn guard: PROCEED. CRF-5 fixed (26837ec). All findings resolved. Panel (13 reviewers + Netero). Zero new findings. All prior fixes verified. Reviewed against 14a6104..26837ec. About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
Clean extraction. The deduplication is well-motivated (byte-identical prepareEnv() in two generators), the fix is proportional, and the behavior is preserved. 13 reviewers and a first-pass scan found only style nits and one observation.
Severity count: 0 P0-P3, 1 P4, 2 Nit, 1 Note.
"I tried to build a case against this and could not. The problem is correctly understood, the solution is proportional, and the fix is at the right causal level." (Pariston)
🤖 This review was automatically generated with Coder Agents.
Address coder-agents-review feedback on the docgen env extraction: - Add a focused unit test pinning the Prepare contract: CODER_* cleared, cache/config/temp directories pinned. - Trim the package and Prepare doc comments to the behavioral contract, dropping internal stdlib detail. - Keep _test.go files out of CLIDOCGEN_INPUTS so test changes don't mark the generated CLI docs stale.
|
/coder-agents-review |
There was a problem hiding this comment.
All R1 findings addressed. CRF-1, CRF-2, CRF-4 fixed in b8cfb7d; CRF-3 acknowledged as out of scope. Test addition is well-constructed: hermetic env restore via t.Setenv, correct //nolint:paralleltest annotation, covers both clearing and pinning behaviors.
One new nit on the test comment below. Otherwise this is ready.
"I tried to build a case against this and could not." (Pariston, for the second time)
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
All findings resolved across three rounds. CRF-1/2/4 fixed in b8cfb7d, CRF-3 acknowledged (out of scope), CRF-5 fixed in 26837ec. 14 reviewers found zero new issues on this final pass.
Clean extraction, proportional to the problem, well-tested, behavior-preserving.
"I tried to build a case against this and couldn't. The problem is correctly understood, the solution is proportional, and the fix is at the right level." (Pariston, third pass)
🤖 This review was automatically generated with Coder Agents.
Co-authored-by: Cian Johnston <[email protected]>
What
clidocgenand the newconfigdocgen(#26824) both carried a byte-identicalprepareEnv()that unsetsCODER_*and pinsCLIDOCGEN_*/TMPDIRso generated docs don't embed the generating host's home directory.This extracts it to
scripts/docgenenv.Prepare()and migratesclidocgen.Why
Duplication flagged during review of #26824.
configdocgenadopts the shared helper in that PR, removing its copy.Risk
Behavior-preserving: regenerating the CLI reference (
make docs/reference/cli/index.md) yields no diff, andmake pre-commitpasses (lint/go,lint/ts,build). A focused unit test pins thePrepare()contract, and_test.gofiles are excluded fromCLIDOCGEN_INPUTSso test edits don't mark the generated docs stale.CI status — blocked by an unrelated
mainbreakage (#24993)All red checks on this PR are inherited from
main, not caused by these changes. This PR touches onlyMakefileandscripts/{clidocgen,docgenenv}; it does not touch Helm.mainwent red atd0f68cb9b0("feat: add listenerset", #24993, merged ~18:26 UTC). The committedhelm/coder/tests/testdata/listenerset*.goldenfiles don't match whathelm templaterenders, so:genregenerates those goldens, and the unstaged-files check fails.test-go-pg(ubuntu-latest, pg-17) andtest-go-race-pgfail only onTestRenderChart/{coder,default}/listenerset[_redirect](golden mismatch; the test prints "Run with -update to update golden files"). The sametest-go-pgjob passes on macOS and Windows, where the Helm render test is skipped, andscripts/docgenenvreportsokon the failing runners.Base commit
14a61041d9was green;mainis red fromd0f68cb9b0onward. These checks clear oncemainis fixed and this branch is updated.fmt,lint,Storybook,check-build, andtest-e2eare green.🤖 Opened by Coder Agents on behalf of @nickvigilante.