Conversation
Signed-off-by: itsmeital <meitalr@armosec.io>
📝 WalkthroughWalkthroughA new Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a new Inventory type to the armotypes package, intended to represent workload/inventory metadata for JSON serialization.
Changes:
- Introduced
armotypes.Inventorystruct with workload/cluster/account/region/provider metadata plus optional status/learning fields.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| type Inventory struct { | ||
| WorkloadName string `json:"workloadName"` | ||
| Kind string `json:"kind"` // will be deprecated in the future after type is introduced | ||
| Type string `json:"type"` | ||
| Cluster string `json:"cluster"` | ||
| AccountID string `json:"accountId"` | ||
| Region string `json:"region"` | ||
| Provider string `json:"provider"` | ||
| Namespace string `json:"namespace"` | ||
| CreationTimestamp *time.Time `json:"creationTimestamp,omitempty"` | ||
| CompletionStatus string `json:"completionStatus,omitempty"` | ||
| Status string `json:"status,omitempty"` | ||
| LearningPeriod string `json:"learningPeriod,omitempty"` | ||
| RiskFactors []string `json:"riskFactors,omitempty"` | ||
| LearningPercentage *int `json:"learningPercentage,omitempty"` | ||
| HostName string `json:"hostName,omitempty"` | ||
| } |
There was a problem hiding this comment.
Inventory duplicates the existing WorkloadViews struct (same fields + JSON tags). Keeping two identical exported types will likely lead to drift and confusion for API consumers; consider consolidating to a single type (e.g., rename one, or make one a type alias of the other) and deprecate the old name if needed.
| type Inventory struct { | |
| WorkloadName string `json:"workloadName"` | |
| Kind string `json:"kind"` // will be deprecated in the future after type is introduced | |
| Type string `json:"type"` | |
| Cluster string `json:"cluster"` | |
| AccountID string `json:"accountId"` | |
| Region string `json:"region"` | |
| Provider string `json:"provider"` | |
| Namespace string `json:"namespace"` | |
| CreationTimestamp *time.Time `json:"creationTimestamp,omitempty"` | |
| CompletionStatus string `json:"completionStatus,omitempty"` | |
| Status string `json:"status,omitempty"` | |
| LearningPeriod string `json:"learningPeriod,omitempty"` | |
| RiskFactors []string `json:"riskFactors,omitempty"` | |
| LearningPercentage *int `json:"learningPercentage,omitempty"` | |
| HostName string `json:"hostName,omitempty"` | |
| } | |
| type Inventory = WorkloadViews |
|
|
||
| type Inventory struct { | ||
| WorkloadName string `json:"workloadName"` | ||
| Kind string `json:"kind"` // will be deprecated in the future after type is introduced |
There was a problem hiding this comment.
The inline comment on Kind says it "will be deprecated ... after type is introduced", but this struct already has a Type field. This comment is now misleading; please update it to reflect the actual deprecation plan/timeline (or remove it if no longer relevant).
| Kind string `json:"kind"` // will be deprecated in the future after type is introduced | |
| Kind string `json:"kind"` // Deprecated: use Type instead. Kept for backward compatibility. |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
armotypes/inventory.go (2)
5-5: Add a struct-level GoDoc comment toInventory.Exported types in a public package should carry a doc comment so
go docand IDE hover surfaces produce useful output.+// Inventory holds workload metadata returned by the inventory API, +// including resource identifiers, provider details, and runtime status. type Inventory struct {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@armotypes/inventory.go` at line 5, Add a GoDoc comment for the exported type Inventory: place a concise one-line comment immediately above the `type Inventory struct {}` declaration describing what Inventory represents and any important usage notes (e.g., "Inventory represents ... used for ..."); ensure the comment starts with the type name "Inventory" to satisfy GoDoc conventions and visibility in IDE/tooling.
7-7: Use the idiomatic//Deprecated:GoDoc marker forKind.A bare inline comment is invisible to
go doc, IDEs (gopls), and linters such asstaticcheck. The canonical form is:- Kind string `json:"kind"` // will be deprecated in the future after type is introduced + // Deprecated: Use Type instead. + Kind string `json:"kind"`🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@armotypes/inventory.go` at line 7, Update the inline comment on the Kind struct field to use the idiomatic GoDoc `// Deprecated:` marker so tools can surface it; replace the current `// will be deprecated in the future after type is introduced` with a `// Deprecated: ...` comment on the `Kind` field (preserving the meaning) so `go doc`, gopls, and linters recognize the deprecation for the Kind field.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@armotypes/inventory.go`:
- Line 5: Add a GoDoc comment for the exported type Inventory: place a concise
one-line comment immediately above the `type Inventory struct {}` declaration
describing what Inventory represents and any important usage notes (e.g.,
"Inventory represents ... used for ..."); ensure the comment starts with the
type name "Inventory" to satisfy GoDoc conventions and visibility in
IDE/tooling.
- Line 7: Update the inline comment on the Kind struct field to use the
idiomatic GoDoc `// Deprecated:` marker so tools can surface it; replace the
current `// will be deprecated in the future after type is introduced` with a
`// Deprecated: ...` comment on the `Kind` field (preserving the meaning) so `go
doc`, gopls, and linters recognize the deprecation for the Kind field.
Summary by CodeRabbit