Add a code audit findings document - #506
Draft
danmux wants to merge 1 commit into
Draft
Conversation
A point-in-time review of the repo for correctness, duplication and adherence to our own conventions. Docs only, no code touched. 62 findings, grouped and ordered by severity, each with the defect, why it matters and the fix. Highlights: - internal/github stacks its own retry on top of httpcl's, so a 5xx costs up to 12 HTTP attempts and ~27s per GraphQL query - main.go reads userError through type assertions rather than errors.As, so wrapping one discards the whole payload - gitutil runs git against the process cwd with no dir or ctx, so --project elsewhere diffs the wrong repo - stack detection exists twice and the copies disagree: init writes pytest where the sidecar builds uv run pytest - the auth provider matrix is hand-written 18 times across 3 files - envbuilder has 31 stack branches across 3 parallel switches Also records what was checked and found clean, so none of it gets re-checked, and notes where dupl, gocyclo and funlen configuration let several of these through. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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
A point-in-time review of the repo for correctness, duplication and adherence to our own
conventions in
AGENTS.mdandARCHITECTURE.md. Docs only, no code touched.62 findings in
docs/CODE_AUDIT.md, grouped and ordered by severity, each with the defect,why it matters and the fix. Audited at
6bb97f9; everyfile:linewas re-derived againstthat commit.
The ones worth reading first
internal/githubstacks its own retry on top ofhttpcl's, so a GitHub 5xx costs up to12 HTTP attempts and ~27s per GraphQL query. One field fixes it.
main.goreadsuserErrorthrough type assertions, noterrors.As, so wrapping onediscards message, detail, suggestion, code and exit code. Confirmed by running it, not just
reading it.
gitutilruns git against the process cwd with no dir or ctx, so--project /elsewherediffs the wrong repo on the--checkoutsync path.GeneratePatchalso mutates the user's index with a swallowed cleanup error.
chunk initwritespytestwherethe sidecar builds
uv run pytest. Most likely of these to get reported as a bug by someonewho has no idea two detectors exist.
internal/cmd/auth.gois 727 lines and almost all of it is this.
envbuilderhas 31 stack-conditional branches across 3 parallel switches, which is theroot cause of both
nolint:gocyclo. The doc proposes splitting by stack rather than by phase.Also in there
discipline holds, all 12 test skips are justified,
gitutilis not over-exported.duplis not enabled,gocyclohas nomin-complexity,and
funlenis excluded for tests but never enabled at all.Notes for review
AGENTS.md. It is a point-in-timereport that will go stale, not a standing reference like
ARCHITECTURE.mdorCLI.md.validate --listswallowing a config load error) is already addressed by preserve unknown config keys in ‘chunk config set’ #497and is marked as such so it does not get fixed twice.
[swept]came from a broad automated sweep and were not individuallyre-verified by hand. Everything else was confirmed by reading the code.
🤖 Generated with Claude Code