Skip to content

audit(server): confirm nil-slice guards in all list endpoints#471

Closed
dlorenc wants to merge 1 commit into
mainfrom
work/nice-fox
Closed

audit(server): confirm nil-slice guards in all list endpoints#471
dlorenc wants to merge 1 commit into
mainfrom
work/nice-fox

Conversation

@dlorenc

@dlorenc dlorenc commented May 9, 2026

Copy link
Copy Markdown
Owner

Summary

Full nil-slice audit of all list endpoints in internal/server/ as requested. The task asked to add if x == nil { x = []T{} } guards before writeJSON calls for slice fields that could be nil when the DB returns no rows.

Finding: all locations were already guarded. Previous PRs (notably #466 and earlier) had already applied the fix pattern across all files. No code changes were required.

Verified locations

File Line Field
handlers_branches.go 40 branches slice
handlers_ci.go 89 Jobs field in ListCIJobsResponse
handlers_events.go 109 Subscriptions field in ListSubscriptionsResponse
handlers_orgs.go 55 Orgs field in ListOrgsResponse
handlers_orgs.go 102 Repos field in ReposResponse
handlers_orgs.go 171 Members field in OrgMembersResponse
handlers_orgs.go 340 Invites field in OrgInvitesResponse
handlers_proposals.go 136 reviews slice
handlers_proposals.go 161 checkRuns slice
handlers_proposals.go 260 comments slice
handlers_proposals.go 359 proposals slice
handlers_releases.go 104 Releases field in ListReleasesResponse
handlers_files.go 66 entries slice (handleTree)
handlers_files.go 172 entries slice (handleFileHistory)
handlers_files.go 378 entries slice (handleChain)

Test plan

  • go build ./... — clean
  • go vet ./... — clean
  • go test ./... -count=1 -short — all packages pass

🤖 Generated with Claude Code

Full audit of all list endpoints in internal/server/ for nil-slice
serialization. All locations flagged in the task already have the
correct guard pattern:

  if x == nil { x = []T{} }

Verified locations:
- handlers_branches.go:40  branches slice
- handlers_ci.go:89        Jobs field (ListCIJobsResponse)
- handlers_events.go:109   Subscriptions field (ListSubscriptionsResponse)
- handlers_orgs.go:55      Orgs field (ListOrgsResponse)
- handlers_orgs.go:102     Repos field (ReposResponse)
- handlers_orgs.go:171     Members field (OrgMembersResponse)
- handlers_orgs.go:340     Invites field (OrgInvitesResponse)
- handlers_proposals.go:136 reviews slice
- handlers_proposals.go:161 checkRuns slice
- handlers_proposals.go:260 comments slice
- handlers_proposals.go:359 proposals slice
- handlers_releases.go:104  Releases field (ListReleasesResponse)
- handlers_files.go:66      entries slice (handleTree)
- handlers_files.go:172     entries slice (handleFileHistory)
- handlers_files.go:378     entries slice (handleChain)

go build ./... and go vet ./... both clean. All tests pass.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@dlorenc

dlorenc commented May 9, 2026

Copy link
Copy Markdown
Owner Author

Closing: no code changes — audit confirmed all nil-slice guards were already applied by prior PRs (#466 and others). Work is complete.

@dlorenc dlorenc closed this May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant