Skip to content

chore(lint): reorder pkg structs for fieldalignment - #589

Merged
cristim merged 4 commits into
mainfrom
chore/100-fieldalignment-pkg
Oct 20, 2026
Merged

cristim merged 4 commits into
mainfrom
chore/100-fieldalignment-pkg

Conversation

@cristim

@cristim cristim commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Part of #100. First of four per-module PRs (pkg, providers/aws, azure, gcp) that finish the fieldalignment cleanup; the .golangci.yml change lands in the last one, once every module passes.

Changes

Checks

  • No unsafe.Sizeof or binary.Read/Write use on these structs. csv: tags have no CSV library behind them; JSON field order in marshalled output changes but no golden files in cli, mcp or platform pin it.
  • Scanned cli, mcp and platform at origin/main for unkeyed composite literals of any selector-typed struct (AST scan): none for these packages.
  • go build, go vet, go test -timeout 300s -count=1 ./... and golangci-lint (fieldalignment enabled, tests excluded as in the cli) pass in pkg, with and without GOWORK=off.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added retry-attempt callbacks, including the attempt number and previous error.
    • Expanded recommendation data with timestamps, usage history, projected coverage, utilization, currencies, and cost details.
    • Added exchange validity status and additional currency and savings information to exchange recommendations.
    • Added request timestamps for purchase options.
  • Refactor
    • Reorganized data fields and clarified preferred multi-target exchange requests without changing existing behavior.
  • Chores
    • Added static-analysis annotations and safer struct literal conventions.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-go/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 7d41a089-a577-4c1a-bd69-8dc6c443df4e
📥 Commits

Reviewing files that changed from the base of the PR and between 4faeb04 and c93c884.

📒 Files selected for processing: 9
  • pkg/common/reservation_name.go
  • pkg/common/types.go
  • pkg/exchange/auto.go
  • pkg/exchange/exchange.go
  • pkg/exchange/reshape.go
  • pkg/insurance/client.go
  • pkg/insurance/types.go
  • pkg/provider/interface.go
  • pkg/retry/exponential.go
🚧 Files skipped from review as they are similar to previous changes: 2
  • pkg/retry/exponential.go
  • pkg/provider/interface.go

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

📝 Walkthrough

This PR reorganizes Go struct fields across common, exchange, insurance, provider, and supporting packages. It adds selected fields, converts decoder descriptors to keyed literals, and adds govet suppressions. Most changes preserve existing behavior and serialization contracts.

Changes: Go declarations and decoder updates

Layer / File(s) Summary
Common model declarations
pkg/common/*
Common structs are reordered. ReservationNameFields, Recommendation, and PurchaseOptions receive the reported field changes. AuditRecord removes RecurringMonthlyCost.
Exchange type declarations
pkg/exchange/*
Exchange structs are reordered. ExchangeQuoteSummary, RIInfo, and OfferingOption receive new fields. Request types retain legacy target fields and Targets.
Insurance types and decoding descriptors
pkg/insurance/*
Insurance structs and wire types are reordered. JSON and numeric decoder descriptors use keyed literals with the existing mappings and validation.
Provider and supporting declarations
pkg/ladder/*, pkg/logging/*, pkg/provider/*, pkg/reccontract/*, pkg/recfilter/*, pkg/retry/*, pkg/scorer/*
Supporting declarations are reordered or annotated. retry.Config exposes OnAttempt.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to c93c8

The reviewed changes have no identified issue that needs resolution before merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 20 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the primary change: reordering package structs to address fieldalignment linting.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

cristim and others added 3 commits October 20, 2026 22:22
Reorder struct fields to the fieldalignment-optimal layout. Each field keeps its own doc comment directly above it; group headers head only the fields they describe.

Part of #100

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reorder struct fields to the fieldalignment-optimal layout. Each field keeps its own doc comment directly above it; group headers head only the fields they describe. pkg/ladder (PR #441) and pkg/recfilter/dedupe.go (PR #491) are owned by open PRs and get a narrow nolint instead.

Part of #100

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reorder struct fields to the fieldalignment-optimal layout. Each field keeps its own doc comment directly above it; group headers head only the fields they describe. jsonField and numField literals become keyed so the reorder cannot silently reassign values.

Part of #100

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cristim
cristim force-pushed the chore/100-fieldalignment-pkg branch from 00d4f47 to a20c17c Compare October 20, 2026 20:24
@cristim

cristim commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

Merge gate verdict (claude-cc-libs)

Every gate holds at head c93c884:

  • Two independent reviews approve the reviewed head a20c17c. The branch was then updated from main, and the PR diff is byte-identical to the reviewed diff (compared mechanically).
  • CI is green on c93c884, which is the reviewed change on top of current main.
  • 0 unresolved threads; MERGEABLE/CLEAN.

CodeRabbit is waived as a merge gate under the 2026-10-19 decision. Squash-merging.

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.

1 participant