Skip to content

Comments

Add inventory type#605

Merged
itsmeital merged 1 commit intomainfrom
SUB-7056_inventory-api
Feb 18, 2026
Merged

Add inventory type#605
itsmeital merged 1 commit intomainfrom
SUB-7056_inventory-api

Conversation

@itsmeital
Copy link
Contributor

@itsmeital itsmeital commented Feb 18, 2026

Summary by CodeRabbit

  • New Features
    • Added workload inventory system to track and manage workload metadata, status, and learning progress across clusters and cloud environments.

Signed-off-by: itsmeital <meitalr@armosec.io>
Copilot AI review requested due to automatic review settings February 18, 2026 13:44
@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

📝 Walkthrough

Walkthrough

A new Inventory struct is added to the armotypes package with 15 fields to represent workload metadata, including identifiers (WorkloadName, Kind, Cluster), resource details (AccountID, Region, Provider, Namespace), timestamps, completion and learning status, risk factors, and optional host information.

Changes

Cohort / File(s) Summary
New Inventory Type
armotypes/inventory.go
Added new Inventory struct with 15 fields for workload metadata, including creation timestamps, completion status, learning metrics, and risk factors; uses JSON serialization tags with omitempty directives.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

📦 A new struct hops into place,
Inventory data, time, and space,
Workloads tracked with perfect grace,
Risk and learning interlace,
In armotypes' cozy case! 🐰

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add inventory type' accurately describes the main change: adding a new Inventory struct to the armotypes package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch SUB-7056_inventory-api

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.

❤️ Share

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

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Inventory type to the armotypes package, intended to represent workload/inventory metadata for JSON serialization.

Changes:

  • Introduced armotypes.Inventory struct 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.

Comment on lines +5 to +21
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"`
}
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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

Copilot uses AI. Check for mistakes.

type Inventory struct {
WorkloadName string `json:"workloadName"`
Kind string `json:"kind"` // will be deprecated in the future after type is introduced
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

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).

Suggested change
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.

Copilot uses AI. Check for mistakes.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
armotypes/inventory.go (2)

5-5: Add a struct-level GoDoc comment to Inventory.

Exported types in a public package should carry a doc comment so go doc and 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 for Kind.

A bare inline comment is invisible to go doc, IDEs (gopls), and linters such as staticcheck. 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.

@itsmeital itsmeital merged commit ae8b6f9 into main Feb 18, 2026
10 checks passed
@itsmeital itsmeital deleted the SUB-7056_inventory-api branch February 18, 2026 13:57
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.

2 participants