Repository navigation
ci: lint fork Go code in fork-ci and fix existing findings - #140
ibetitsmike wants to merge 4 commits into
Conversation
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: 6352e99a6c
ℹ️ 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".
Also moves the todo status misspell directive to the const block, since swag copied the trailing comment into the API docs.
|
@codex review
|
|
Codex Review: Didn't find any major issues. Bravo. 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". |
…i-go-lint # Conflicts: # coderd/externalauth/gitprovider/fork_github_activity_test.go # coderd/x/chatd/fork_subagents.go
Closes #123
fork-cihad no Go lint job, so fork code onmaincarried 29 golangci-lint findings that no check reported. This adds alintjob and fixes those findings so the job starts green.The job
The job installs the golangci-lint version that
mise.tomlpins (v2.0.2, the same one upstream'slintjob uses) and runs it with the repository.golangci.yaml:forkdb,chatdmig, plugins,pluginsdk, the signal example) are listed explicitly, as are./cliand./enterprise/coderd, which hold the fork's plugin files without afork_prefix. Thefork_*.golist is computed withgit ls-files, so a package that gains fork code is covered without a workflow change. Today that is 17 packages, includingcoderd,codersdk,agent/agentgitandcoderd/database/dbauthz.--new-from-merge-basereports only issues on lines the pull request changes, so open PRs are not blocked by findings they did not introduce. Like upstream'slint/go/new-code, a pull request compares the merge commit with its first parent (fetch-depth: 2); pushes compareHEADwith itself and report nothing, which keeps them useful only for priming the cache.--fix=falseoverridesfix: truein.golangci.yaml, so CI reports fixable issues instead of silently fixing them in the runner.main, as in upstream'slintjob, so pull requests cannot poison it.The findings
None of them was a real bug. Fixes where a rewrite is clean, and a targeted
//nolintwith a reason, following upstream's existing precedent, where the flagged code is intentional:strings.Builderwrites infork_context.go,fork_isolation.go,fork_wakeups_internal_test.go_, _ =/_ =, as upstream doestaskStarter.commitForkContextMessagefork_context_internal_test.gocodersdk.ChatMessageTextdirectlysubagentCanSpawnint(depth) < limits.maxDepth(same result)nolinton the GitHub check-run conclusion value, its test fixture, and the stored todo statuscancelled(an API and database value; the directive sits on the const block because swag copies a trailing comment into the API docs)nolint: a nil result means "none", and every caller checks for itgetForkChatFamilyCapacity,getChatDescendantQuestions,getChatTodosnolint, the same comment upstream puts on its HTTP handlersAncestorChatIDs,forkValidateSubagentResume,withSubagentWorktreePrompt,resolveRawPath, a test helpernolint; splitting them would duplicate the bodies, and two have callers in upstream filesfork_worktrees_internal_test.gonolint: git runs only executable hooksnolint:pg_locksstores the key as two 32-bit halvesTwo of the flag-parameter findings come from #135, which merged while this PR was in progress.
Validation
--new-from-merge-base: 29 issues onmain, 0 on this branch.mainplus one new unhandledWriteStringinfork_context.go,--new-from-merge-base=HEADreports only that line (1 issue), while the ungated run reports 30, including the 3 existing findings in the same file.go teston the touched chatd paths (TestNestedSubagent*,TestForkSpawnIsolation*,TestForkWorktreeBranch,TestTodoSnapshotMessage),./coderd/externalauth/gitproviderand./agent/agentgit: pass.actionlintonfork-ci.yamlandshellcheckon the new run steps: clean..github/fork/check-apidoc.sh: no drift.