Skip to content

Conversation

@gfyrag
Copy link
Contributor

@gfyrag gfyrag commented Nov 19, 2025

No description provided.

@gfyrag gfyrag requested a review from a team as a code owner November 19, 2025 12:37
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Walkthrough

A new ChartVersion field is added to PostgreSQL configuration structures, allowing dynamic specification of Helm chart versions instead of using a hardcoded constant. The field propagates from PostgresInstall through PostgresDatabase.toInput() into PostgresInstallArgs, where it's used to configure the Helm chart deployment.

Changes

Cohort / File(s) Summary
PostgreSQL Config Structure
deployments/pulumi/pkg/config/config.go
Added ChartVersion string field to PostgresInstall struct with JSON/YAML tags; propagated through PostgresDatabase.toInput() to PostgresInstallArgs
PostgreSQL Component Wiring
deployments/pulumi/pkg/storage/component_postgres.go
Added ChartVersion input field to PostgresInstallArgs; replaced hardcoded chart version ("16.4.7") with dynamic value from args.ChartVersion

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Straightforward field additions with consistent propagation pattern across two files
  • No complex logic changes or error-handling modifications
  • Clear replacement of hardcoded value with configurable input
  • Verify JSON/YAML tags and pulumix wrapper consistency in both locations

Poem

🐰 A version field hops into place,
No more hardcoded charts in this race!
From config to args it gently flows,
Helm deployments now have room to grow.
Flexibility blooms, the rabbit knows! 🌿

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author, making it impossible to assess whether a description relates to the changeset. Add a description explaining why the chart version needs to be configurable, what problem this fixes, and any deployment or testing considerations.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding a configurable chart version parameter to the Pulumi PostgreSQL deployment configuration, replacing a hardcoded version.
✨ 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 hotfix/v2.3/pulumi-postgres-chart-version

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

Copy link
Contributor

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
deployments/pulumi/pkg/config/config.go (1)

188-188: Consider validating non-empty ChartVersion before passing to Pulumi.

While the field is correctly propagated through toInput(), passing an empty string for ChartVersion could cause unexpected behavior in Helm chart deployment. Consider adding validation or ensuring a default is set upstream.

If validation is desired at this level, you could add:

 	return &storage.PostgresDatabaseArgs{
 		Install: &storage.PostgresInstallArgs{
 			Username: pulumix.Val(a.Install.Username),
 			Password: pulumix.Val(a.Install.Password),
-			ChartVersion: pulumix.Val(a.Install.ChartVersion),
+			ChartVersion: pulumix.Val(func() string {
+				if a.Install.ChartVersion == "" {
+					return "16.4.7" // or appropriate default
+				}
+				return a.Install.ChartVersion
+			}()),
 		},
 	}

However, since the SetDefaults() method in component_postgres.go is the more appropriate place for this logic (as suggested in my other comment), you may choose to handle defaults there instead.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 81a7b28 and 90e8568.

📒 Files selected for processing (2)
  • deployments/pulumi/pkg/config/config.go (2 hunks)
  • deployments/pulumi/pkg/storage/component_postgres.go (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Tests
  • GitHub Check: Dirty
🔇 Additional comments (1)
deployments/pulumi/pkg/config/config.go (1)

157-159: LGTM! Field properly added with JSON/YAML tags.

The ChartVersion field is correctly added to the PostgresInstall struct with appropriate serialization tags.

type PostgresInstallArgs struct {
Username pulumix.Input[string]
Password pulumix.Input[string]
ChartVersion pulumix.Input[string]
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Add default value for ChartVersion in SetDefaults() method.

The new ChartVersion field lacks a default value. When ChartVersion is nil or not provided, line 101 will panic during the type assertion.

Add default handling in the SetDefaults() method (after line 82):

 		return password
 	})
+	if args.ChartVersion == nil {
+		args.ChartVersion = pulumix.Val("")
+	}
+	args.ChartVersion = pulumix.Apply(args.ChartVersion, func(version string) string {
+		if version == "" {
+			return "16.4.7" // or another appropriate default version
+		}
+		return version
+	})
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ChartVersion pulumix.Input[string]
return password
})
if args.ChartVersion == nil {
args.ChartVersion = pulumix.Val("")
}
args.ChartVersion = pulumix.Apply(args.ChartVersion, func(version string) string {
if version == "" {
return "16.4.7" // or another appropriate default version
}
return version
})
}
🤖 Prompt for AI Agents
In deployments/pulumi/pkg/storage/component_postgres.go around line 61 (and
modify SetDefaults() after line 82), the ChartVersion pulumix.Input[string]
field has no default and a nil value causes a panic at the type assertion on
line 101; update SetDefaults() to check if ChartVersion is nil or empty and
assign a sensible default chart version (e.g., a constant default string) before
any type assertions or use, ensuring subsequent code can safely assume
ChartVersion is non-nil.

cmp.Chart, err = helm.NewChart(ctx, "postgres", &helm.ChartArgs{
Chart: pulumi.String("oci://registry-1.docker.io/bitnamicharts/postgresql"),
Version: pulumi.String("16.4.7"),
Version: args.ChartVersion.ToOutput(ctx.Context()).Untyped().(pulumi.StringOutput),
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the type assertion safety.

The type assertion .Untyped().(pulumi.StringOutput) will panic if ChartVersion is nil. Once the default value is added in SetDefaults() (as suggested for line 61), this will be safe.

Run the following script to verify all callers of newPostgresComponent properly initialize PostgresInstallArgs:


🏁 Script executed:

#!/bin/bash
# Description: Verify all instantiations of PostgresInstallArgs include proper initialization

# Search for PostgresInstallArgs struct instantiations
ast-grep --pattern 'PostgresInstallArgs{$$$}'

# Search for calls to newPostgresComponent to verify SetDefaults is called
rg -n -A5 -B5 'newPostgresComponent'

Length of output: 2030


I need to gather more information to verify the type assertion safety. Let me examine the SetDefaults() method and the complete initialization flow.


---

🏁 Script executed:

```shell
#!/bin/bash
# Find SetDefaults method for PostgresInstallArgs
rg -n 'func.*SetDefaults' -A 10 deployments/pulumi/pkg/storage/

# View the full setup_postgres.go to understand initialization order
cat deployments/pulumi/pkg/storage/setup_postgres.go

Length of output: 7153


I need to see the complete SetDefaults() method for PostgresInstallArgs to verify if ChartVersion gets a default value.


---

🏁 Script executed:

```shell
#!/bin/bash
# Get full SetDefaults method for PostgresInstallArgs and view ChartVersion field definition
cat deployments/pulumi/pkg/storage/component_postgres.go | head -85

Length of output: 2088


Now I need to verify the type assertion at line 101 and see if ChartVersion is actually being used there.


---

🏁 Script executed:

```shell
#!/bin/bash
# View lines 95-110 to see the ChartVersion assertion at line 101
sed -n '95,110p' deployments/pulumi/pkg/storage/component_postgres.go

Length of output: 574


Let me verify if ChartVersion gets a default elsewhere or if this is truly missing.


---

🏁 Script executed:

```shell
#!/bin/bash
# Search for ChartVersion references and defaults
rg -n 'ChartVersion' deployments/pulumi/pkg/storage/

# Check if there are multiple SetDefaults() calls or if ChartVersion is set in constructor
rg -n 'ChartVersion.*=' deployments/pulumi/pkg/storage/

Length of output: 236


Add default for ChartVersion in PostgresInstallArgs.SetDefaults().

The type assertion at line 101 will panic if ChartVersion is nil. The SetDefaults() method sets defaults for Username and Password but does not initialize ChartVersion, leaving it null and causing a panic at the assertion. Add a default (e.g., "" or a minimum supported version) in SetDefaults() at component_postgres.go:64-81.

🤖 Prompt for AI Agents
In deployments/pulumi/pkg/storage/component_postgres.go around line 101 (and
update SetDefaults() at ~lines 64-81), the code type-asserts
args.ChartVersion.ToOutput(...).Untyped().(pulumi.StringOutput) which will panic
if ChartVersion is nil; modify PostgresInstallArgs.SetDefaults() to initialize
ChartVersion when nil (e.g., set to an empty string "" or a specified minimum
supported version) so the field is non-nil and the subsequent ToOutput/Untyped
type assertion succeeds; ensure the default is of the same type used elsewhere
and keep existing defaulting for Username/Password.

@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.88%. Comparing base (340b22b) to head (90e8568).
⚠️ Report is 2 commits behind head on release/v2.3.

Additional details and impacted files
@@               Coverage Diff                @@
##           release/v2.3    #1140      +/-   ##
================================================
- Coverage         81.90%   81.88%   -0.03%     
================================================
  Files               187      187              
  Lines              8924     8924              
================================================
- Hits               7309     7307       -2     
- Misses             1188     1191       +3     
+ Partials            427      426       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gfyrag gfyrag merged commit 11e7f1f into release/v2.3 Nov 19, 2025
7 of 8 checks passed
@gfyrag gfyrag deleted the hotfix/v2.3/pulumi-postgres-chart-version branch November 19, 2025 12:51
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