Skip to content

chore: fix prealloc findings - #378

Merged
sosheskaz merged 3 commits into
mainfrom
chore/fix-prealloc-findings
Jul 30, 2026
Merged

chore: fix prealloc findings#378
sosheskaz merged 3 commits into
mainfrom
chore/fix-prealloc-findings

Conversation

@sosheskaz

@sosheskaz sosheskaz commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Re-enables prealloc for production Go files and fixes the remaining live findings exposed by golangci-lint 2.9.0. Test files are excluded from prealloc, and the earlier test-helper preallocation changes have been reverted.

The production changes add known slice capacities in Object Storage rendering helpers without changing values, ordering, schemas, provider behavior, or exported APIs.

This PR also raises the acceptance-test sweeper's Go test timeout from 10 to 30 minutes. The previous CKS sweep exhausted the global 10-minute limit while sequentially deleting existing QA clusters.

Validation

  • golangci-lint 2.9.0 with Go 1.26.5 (0 issues)
  • go test ./coreweave/cks ./coreweave/object_storage
  • gofmt -d on the restored test files
  • all *_test.go files match the parent branch
  • make -n testacc-sweep SUITES=cks TEST_ACC_SWEEP_ZONE=US-LAB-01A
  • git diff --check

Caveats

The nested-worktree gopls diagnostics attempt returned no package metadata; the focused Go 1.26 tests and pinned lint run completed successfully.

@sosheskaz
sosheskaz marked this pull request as ready for review July 30, 2026 19:21
@sosheskaz
sosheskaz requested a review from a team as a code owner July 30, 2026 19:21
Copilot AI review requested due to automatic review settings July 30, 2026 19:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR re-enables the prealloc golangci-lint linter for production Go code and resolves the resulting slice preallocation findings, primarily in Object Storage HCL rendering helpers. It also increases the acceptance-test sweeper per-suite go test timeout to reduce failures during longer cleanup runs.

Changes:

  • Re-enable prealloc in .golangci.yaml while continuing to exclude it (and other heavy linters) for *_test.go files.
  • Preallocate known-capacity []cty.Value slices in Object Storage rendering helpers to satisfy prealloc findings without changing rendered output.
  • Increase testacc-sweep’s per-suite go test timeout from 10m to 30m in GNUmakefile.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
GNUmakefile Increases acceptance-test sweeper per-suite timeout to 30 minutes to avoid premature timeouts during long sweeps.
coreweave/object_storage/resource_organization_access_policy.go Preallocates statement/action/resource/principal slices to address prealloc findings without altering rendered policy structure.
coreweave/object_storage/data_source_bucket_policy_document.go Preallocates per-statement lists/maps when building cty values to satisfy prealloc and keep output identical.
.golangci.yaml Re-enables prealloc globally and explicitly excludes it from test files via exclusions rules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sosheskaz
sosheskaz merged commit c37ece3 into main Jul 30, 2026
12 checks passed
@sosheskaz
sosheskaz deleted the chore/fix-prealloc-findings branch July 30, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants